<html> <head> <title>OgreException.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link type="text/css" rel="stylesheet" href="style.css"> </head> <body> <!-- Generated by Doxygen 1.3.6 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> <h1>OgreException.h</h1><a href="OgreException_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> 00002 <span class="comment">-----------------------------------------------------------------------------</span> 00003 <span class="comment">This source file is part of OGRE</span> 00004 <span class="comment">(Object-oriented Graphics Rendering Engine)</span> 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> 00006 <span class="comment"></span> 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> 00008 <span class="comment">Also see acknowledgements in Readme.html</span> 00009 <span class="comment"></span> 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> 00013 <span class="comment">version.</span> 00014 <span class="comment"></span> 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> 00018 <span class="comment"></span> 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> 00023 <span class="comment">-----------------------------------------------------------------------------</span> 00024 <span class="comment">*/</span> 00025 <span class="preprocessor">#ifndef __Exception_H_</span> 00026 <span class="preprocessor"></span><span class="preprocessor">#define __Exception_H_</span> 00027 <span class="preprocessor"></span> 00028 <span class="comment">// Precompiler options</span> 00029 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> 00030 00031 <span class="preprocessor">#include "<a class="code" href="OgreString_8h.html">OgreString.h</a>"</span> 00032 <a name="l00033"></a><a class="code" href="OgreException_8h.html#a0">00033</a> <span class="preprocessor">#define OGRE_EXCEPT( num, desc, src ) throw( Ogre::Exception( num, desc, src, __FILE__, __LINE__ ) )</span> 00034 <span class="preprocessor"></span> 00035 <span class="comment">// Stack unwinding options</span> 00036 <span class="comment">// OgreUnguard and OgreUnguardRet are deprecated</span> 00037 <span class="preprocessor">#if OGRE_STACK_UNWINDING == 1</span> 00038 <span class="preprocessor"></span><span class="preprocessor"># if OGRE_COMPILER != OGRE_COMPILER_BORL</span> <a name="l00039"></a><a class="code" href="OgreException_8h.html#a1">00039</a> <span class="preprocessor"></span><span class="preprocessor"># define OgreGuard( a ) Ogre::AutomaticGuardUnguard _auto_guard_object( (a) )</span> 00040 <span class="preprocessor"></span><span class="preprocessor"># else</span> 00041 <span class="preprocessor"></span><span class="preprocessor"># define OgreGuard( a ) Ogre::AutomaticGuardUnguard _auto_guard_object( __FUNC__ )</span> 00042 <span class="preprocessor"></span><span class="preprocessor"># endif</span> 00043 <span class="preprocessor"></span> <a name="l00044"></a><a class="code" href="OgreException_8h.html#a2">00044</a> <span class="preprocessor"># define OgreUnguard() </span> <a name="l00045"></a><a class="code" href="OgreException_8h.html#a3">00045</a> <span class="preprocessor"></span><span class="preprocessor"># define OgreUnguardRet( a ) return a</span> 00046 <span class="preprocessor"></span> 00047 <span class="preprocessor">#else</span> 00048 <span class="preprocessor"></span><span class="preprocessor"># define OgreGuard( a )</span> 00049 <span class="preprocessor"></span><span class="preprocessor"># define OgreUnguard()</span> 00050 <span class="preprocessor"></span><span class="preprocessor"># define OgreUnguardRet( a ) return a</span> 00051 <span class="preprocessor"></span> 00052 <span class="preprocessor">#endif</span> 00053 <span class="preprocessor"></span> 00054 <span class="comment">// Backwards compatibility with old assert mode definitions</span> 00055 <span class="preprocessor">#if OGRE_RELEASE_ASSERT == 1</span> 00056 <span class="preprocessor"></span><span class="preprocessor"># define OGRE_ASSERT_MODE 1</span> 00057 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00058 <span class="preprocessor"></span> 00059 <span class="comment">// Check for OGRE assert mode</span> 00060 00061 <span class="comment">// RELEASE_EXCEPTIONS mode</span> 00062 <span class="preprocessor">#if OGRE_ASSERT_MODE == 1</span> 00063 <span class="preprocessor"></span><span class="preprocessor"># ifdef _DEBUG</span> 00064 <span class="preprocessor"></span><span class="preprocessor"># define OgreAssert( a, b ) assert( (a) && (b) )</span> 00065 <span class="preprocessor"></span> 00066 <span class="preprocessor"># else</span> 00067 <span class="preprocessor"></span><span class="preprocessor"># if OGRE_COMP != OGRE_COMPILER_BORL</span> 00068 <span class="preprocessor"></span><span class="preprocessor"># define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), "no function info")</span> 00069 <span class="preprocessor"></span><span class="preprocessor"># else</span> 00070 <span class="preprocessor"></span><span class="preprocessor"># define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), __FUNC__ )</span> 00071 <span class="preprocessor"></span><span class="preprocessor"># endif</span> 00072 <span class="preprocessor"></span> 00073 <span class="preprocessor"># endif</span> 00074 <span class="preprocessor"></span> 00075 <span class="comment">// EXCEPTIONS mode</span> 00076 <span class="preprocessor">#elif OGRE_ASSERT_MODE == 2</span> 00077 <span class="preprocessor"></span><span class="preprocessor"># if OGRE_COMP != OGRE_COMPILER_BORL</span> 00078 <span class="preprocessor"></span><span class="preprocessor"># define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), "no function info")</span> 00079 <span class="preprocessor"></span><span class="preprocessor"># else</span> 00080 <span class="preprocessor"></span><span class="preprocessor"># define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), __FUNC__ )</span> 00081 <span class="preprocessor"></span><span class="preprocessor"># endif</span> 00082 <span class="preprocessor"></span> 00083 <span class="comment">// STANDARD mode</span> 00084 <span class="preprocessor">#else</span> <a name="l00085"></a><a class="code" href="OgreException_8h.html#a4">00085</a> <span class="preprocessor"></span><span class="preprocessor"># define OgreAssert( a, b ) assert( (a) && (b) )</span> 00086 <span class="preprocessor"></span> 00087 <span class="preprocessor">#endif</span> 00088 <span class="preprocessor"></span> <a name="l00089"></a><a class="code" href="OgreException_8h.html#a5">00089</a> <span class="preprocessor">#define OGRE_CALL_STACK_DEPTH 512</span> 00090 <span class="preprocessor"></span> 00091 <span class="keyword">namespace </span>Ogre { <a name="l00105"></a><a class="code" href="classOgre_1_1Exception.html">00105</a> <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a13">_OgreExport</a> Exception 00106 { 00107 <span class="keyword">protected</span>: <a name="l00108"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp0">00108</a> <span class="keywordtype">long</span> line; <a name="l00109"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp1">00109</a> <span class="keywordtype">int</span> number; <a name="l00110"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp2">00110</a> <a class="code" href="namespaceOgre.html#a426">String</a> description; <a name="l00111"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp3">00111</a> <a class="code" href="namespaceOgre.html#a426">String</a> source; <a name="l00112"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp4">00112</a> <a class="code" href="namespaceOgre.html#a426">String</a> file; <a name="l00113"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp5">00113</a> <a class="code" href="namespaceOgre.html#a422">ushort</a> stackDepth; <a name="l00114"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiont0">00114</a> <span class="keyword">static</span> Exception* last; 00115 <a name="l00116"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiont1">00116</a> <span class="keyword">static</span> <a class="code" href="namespaceOgre.html#a426">String</a> msFunctionStack[ <a class="code" href="OgreException_8h.html#a5">OGRE_CALL_STACK_DEPTH</a> ]; <a name="l00117"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiont2">00117</a> <span class="keyword">static</span> <a class="code" href="namespaceOgre.html#a422">ushort</a> msStackDepth; 00118 <span class="keyword">public</span>: <a name="l00124"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionw11">00124</a> <span class="keyword">enum</span> ExceptionCodes { 00125 UNIMPLEMENTED_FEATURE, 00126 ERR_CANNOT_WRITE_TO_FILE, 00127 ERR_NO_RENDERSYSTEM_SELECTED, 00128 ERR_DIALOG_OPEN_ERROR, 00129 ERR_INVALIDPARAMS, 00130 ERR_RENDERINGAPI_ERROR, 00131 ERR_DUPLICATE_ITEM, 00132 ERR_ITEM_NOT_FOUND, 00133 ERR_FILE_NOT_FOUND, 00134 ERR_INTERNAL_ERROR, 00135 ERR_RT_ASSERTION_FAILED 00136 }; 00137 00140 Exception( <span class="keywordtype">int</span> number, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& description, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& source ); 00141 00144 Exception( <span class="keywordtype">int</span> number, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& description, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& source, <span class="keywordtype">char</span>* file, <span class="keywordtype">long</span> line ); 00145 00148 Exception(<span class="keyword">const</span> Exception& rhs); 00149 00152 <span class="keywordtype">void</span> operator = (<span class="keyword">const</span> Exception& rhs); 00153 00164 <a class="code" href="namespaceOgre.html#a426">String</a> getFullDescription(<span class="keywordtype">void</span>) <span class="keyword">const</span>; 00165 00168 <span class="keywordtype">int</span> getNumber(<span class="keywordtype">void</span>) <span class="keyword">const</span> <span class="keywordflow">throw</span>(); 00169 <a name="l00172"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiona6">00172</a> <a class="code" href="namespaceOgre.html#a426">String</a> getFile() {<span class="keywordflow">return</span> file; } 00173 <a name="l00176"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiona7">00176</a> <span class="keywordtype">long</span> getLine() {<span class="keywordflow">return</span> line; } 00177 00178 00181 <span class="keyword">static</span> Exception* getLastException(<span class="keywordtype">void</span>) <span class="keywordflow">throw</span>(); 00182 00185 <span class="keyword">static</span> <span class="keywordtype">void</span> _pushFunction( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& strFuncName ) <span class="keywordflow">throw</span>(); 00188 <span class="keyword">static</span> <span class="keywordtype">void</span> _popFunction() <span class="keywordflow">throw</span>(); 00189 00190 00191 }; 00192 <a name="l00194"></a><a class="code" href="classOgre_1_1AutomaticGuardUnguard.html">00194</a> <span class="keyword">class </span><a class="code" href="class__OgreExport.html">_OgreExport</a> AutomaticGuardUnguard { 00195 <span class="keyword">public</span>: <a name="l00196"></a><a class="code" href="classOgre_1_1AutomaticGuardUnguard.html#Ogre_1_1AutomaticGuardUnguarda0">00196</a> AutomaticGuardUnguard(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& funcName) <span class="keywordflow">throw</span>() 00197 { 00198 Exception::_pushFunction(funcName); 00199 } <a name="l00200"></a><a class="code" href="classOgre_1_1AutomaticGuardUnguard.html#Ogre_1_1AutomaticGuardUnguarda1">00200</a> ~AutomaticGuardUnguard() <span class="keywordflow">throw</span>() 00201 { 00202 Exception::_popFunction(); 00203 } 00204 }; 00205 00206 } <span class="comment">// Namespace Ogre</span> 00207 <span class="preprocessor">#endif</span> </pre></div><p> Copyright © 2000-2005 by The OGRE Team<br /> Last modified Wed Feb 23 00:19:05 2005 </p> </body> </html>