1 | <html> |
---|
2 | <head> |
---|
3 | <title>OgreException.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body> |
---|
8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
9 | <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> |
---|
10 | <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> |
---|
11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
13 | 00004 <span class="comment">(Object-oriented Graphics Rendering Engine)</span> |
---|
14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
15 | 00006 <span class="comment"></span> |
---|
16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
18 | 00009 <span class="comment"></span> |
---|
19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
22 | 00013 <span class="comment">version.</span> |
---|
23 | 00014 <span class="comment"></span> |
---|
24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
27 | 00018 <span class="comment"></span> |
---|
28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
33 | 00024 <span class="comment">*/</span> |
---|
34 | 00025 <span class="preprocessor">#ifndef __Exception_H_</span> |
---|
35 | 00026 <span class="preprocessor"></span><span class="preprocessor">#define __Exception_H_</span> |
---|
36 | 00027 <span class="preprocessor"></span> |
---|
37 | 00028 <span class="comment">// Precompiler options</span> |
---|
38 | 00029 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> |
---|
39 | 00030 |
---|
40 | 00031 <span class="preprocessor">#include "<a class="code" href="OgreString_8h.html">OgreString.h</a>"</span> |
---|
41 | 00032 |
---|
42 | <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> |
---|
43 | 00034 <span class="preprocessor"></span> |
---|
44 | 00035 <span class="comment">// Stack unwinding options</span> |
---|
45 | 00036 <span class="comment">// OgreUnguard and OgreUnguardRet are deprecated</span> |
---|
46 | 00037 <span class="preprocessor">#if OGRE_STACK_UNWINDING == 1</span> |
---|
47 | 00038 <span class="preprocessor"></span><span class="preprocessor"># if OGRE_COMPILER != OGRE_COMPILER_BORL</span> |
---|
48 | 00039 <span class="preprocessor"></span><span class="preprocessor"># define OgreGuard( a ) Ogre::AutomaticGuardUnguard _auto_guard_object( (a) )</span> |
---|
49 | 00040 <span class="preprocessor"></span><span class="preprocessor"># else</span> |
---|
50 | 00041 <span class="preprocessor"></span><span class="preprocessor"># define OgreGuard( a ) Ogre::AutomaticGuardUnguard _auto_guard_object( __FUNC__ )</span> |
---|
51 | 00042 <span class="preprocessor"></span><span class="preprocessor"># endif</span> |
---|
52 | 00043 <span class="preprocessor"></span> |
---|
53 | 00044 <span class="preprocessor"># define OgreUnguard() </span> |
---|
54 | 00045 <span class="preprocessor"></span><span class="preprocessor"># define OgreUnguardRet( a ) return a</span> |
---|
55 | 00046 <span class="preprocessor"></span> |
---|
56 | 00047 <span class="preprocessor">#else</span> |
---|
57 | <a name="l00048"></a><a class="code" href="OgreException_8h.html#a1">00048</a> <span class="preprocessor"></span><span class="preprocessor"># define OgreGuard( a )</span> |
---|
58 | <a name="l00049"></a><a class="code" href="OgreException_8h.html#a2">00049</a> <span class="preprocessor"></span><span class="preprocessor"># define OgreUnguard()</span> |
---|
59 | <a name="l00050"></a><a class="code" href="OgreException_8h.html#a3">00050</a> <span class="preprocessor"></span><span class="preprocessor"># define OgreUnguardRet( a ) return a</span> |
---|
60 | 00051 <span class="preprocessor"></span> |
---|
61 | 00052 <span class="preprocessor">#endif</span> |
---|
62 | 00053 <span class="preprocessor"></span> |
---|
63 | 00054 <span class="comment">// Backwards compatibility with old assert mode definitions</span> |
---|
64 | 00055 <span class="preprocessor">#if OGRE_RELEASE_ASSERT == 1</span> |
---|
65 | 00056 <span class="preprocessor"></span><span class="preprocessor"># define OGRE_ASSERT_MODE 1</span> |
---|
66 | 00057 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
---|
67 | 00058 <span class="preprocessor"></span> |
---|
68 | 00059 <span class="comment">// Check for OGRE assert mode</span> |
---|
69 | 00060 |
---|
70 | 00061 <span class="comment">// RELEASE_EXCEPTIONS mode</span> |
---|
71 | 00062 <span class="preprocessor">#if OGRE_ASSERT_MODE == 1</span> |
---|
72 | 00063 <span class="preprocessor"></span><span class="preprocessor"># ifdef _DEBUG</span> |
---|
73 | 00064 <span class="preprocessor"></span><span class="preprocessor"># define OgreAssert( a, b ) assert( (a) && (b) )</span> |
---|
74 | 00065 <span class="preprocessor"></span> |
---|
75 | 00066 <span class="preprocessor"># else</span> |
---|
76 | 00067 <span class="preprocessor"></span><span class="preprocessor"># if OGRE_COMP != OGRE_COMPILER_BORL</span> |
---|
77 | 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> |
---|
78 | 00069 <span class="preprocessor"></span><span class="preprocessor"># else</span> |
---|
79 | 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> |
---|
80 | 00071 <span class="preprocessor"></span><span class="preprocessor"># endif</span> |
---|
81 | 00072 <span class="preprocessor"></span> |
---|
82 | 00073 <span class="preprocessor"># endif</span> |
---|
83 | 00074 <span class="preprocessor"></span> |
---|
84 | 00075 <span class="comment">// EXCEPTIONS mode</span> |
---|
85 | 00076 <span class="preprocessor">#elif OGRE_ASSERT_MODE == 2</span> |
---|
86 | 00077 <span class="preprocessor"></span><span class="preprocessor"># if OGRE_COMP != OGRE_COMPILER_BORL</span> |
---|
87 | 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> |
---|
88 | 00079 <span class="preprocessor"></span><span class="preprocessor"># else</span> |
---|
89 | 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> |
---|
90 | 00081 <span class="preprocessor"></span><span class="preprocessor"># endif</span> |
---|
91 | 00082 <span class="preprocessor"></span> |
---|
92 | 00083 <span class="comment">// STANDARD mode</span> |
---|
93 | 00084 <span class="preprocessor">#else</span> |
---|
94 | <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> |
---|
95 | 00086 <span class="preprocessor"></span> |
---|
96 | 00087 <span class="preprocessor">#endif</span> |
---|
97 | 00088 <span class="preprocessor"></span> |
---|
98 | <a name="l00089"></a><a class="code" href="OgreException_8h.html#a5">00089</a> <span class="preprocessor">#define OGRE_CALL_STACK_DEPTH 512</span> |
---|
99 | 00090 <span class="preprocessor"></span> |
---|
100 | 00091 <span class="keyword">namespace </span>Ogre { |
---|
101 | <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#a16">_OgreExport</a> Exception |
---|
102 | 00106 { |
---|
103 | 00107 <span class="keyword">protected</span>: |
---|
104 | <a name="l00108"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp0">00108</a> <span class="keywordtype">long</span> line; |
---|
105 | <a name="l00109"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp1">00109</a> <span class="keywordtype">int</span> number; |
---|
106 | <a name="l00110"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp2">00110</a> <a class="code" href="namespaceOgre.html#a471">String</a> description; |
---|
107 | <a name="l00111"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp3">00111</a> <a class="code" href="namespaceOgre.html#a471">String</a> source; |
---|
108 | <a name="l00112"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp4">00112</a> <a class="code" href="namespaceOgre.html#a471">String</a> file; |
---|
109 | <a name="l00113"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionp5">00113</a> <a class="code" href="namespaceOgre.html#a467">ushort</a> stackDepth; |
---|
110 | <a name="l00114"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiont0">00114</a> <span class="keyword">static</span> Exception* last; |
---|
111 | 00115 |
---|
112 | <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#a471">String</a> msFunctionStack[ <a class="code" href="OgreException_8h.html#a5">OGRE_CALL_STACK_DEPTH</a> ]; |
---|
113 | <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#a467">ushort</a> msStackDepth; |
---|
114 | 00118 <span class="keyword">public</span>: |
---|
115 | <a name="l00124"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptionw12">00124</a> <span class="keyword">enum</span> ExceptionCodes { |
---|
116 | 00125 UNIMPLEMENTED_FEATURE, |
---|
117 | 00126 ERR_CANNOT_WRITE_TO_FILE, |
---|
118 | 00127 ERR_NO_RENDERSYSTEM_SELECTED, |
---|
119 | 00128 ERR_DIALOG_OPEN_ERROR, |
---|
120 | 00129 ERR_INVALIDPARAMS, |
---|
121 | 00130 ERR_RENDERINGAPI_ERROR, |
---|
122 | 00131 ERR_DUPLICATE_ITEM, |
---|
123 | 00132 ERR_ITEM_NOT_FOUND, |
---|
124 | 00133 ERR_FILE_NOT_FOUND, |
---|
125 | 00134 ERR_INTERNAL_ERROR, |
---|
126 | 00135 ERR_RT_ASSERTION_FAILED, |
---|
127 | 00136 ERR_NOT_IMPLEMENTED |
---|
128 | 00137 }; |
---|
129 | 00138 |
---|
130 | 00141 Exception( <span class="keywordtype">int</span> number, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& description, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& source ); |
---|
131 | 00142 |
---|
132 | 00145 Exception( <span class="keywordtype">int</span> number, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& description, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& source, <span class="keywordtype">char</span>* file, <span class="keywordtype">long</span> line ); |
---|
133 | 00146 |
---|
134 | 00149 Exception(<span class="keyword">const</span> Exception& rhs); |
---|
135 | 00150 |
---|
136 | 00153 <span class="keywordtype">void</span> operator = (<span class="keyword">const</span> Exception& rhs); |
---|
137 | 00154 |
---|
138 | 00165 <a class="code" href="namespaceOgre.html#a471">String</a> getFullDescription(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
139 | 00166 |
---|
140 | 00169 <span class="keywordtype">int</span> getNumber(<span class="keywordtype">void</span>) <span class="keyword">const</span> <span class="keywordflow">throw</span>(); |
---|
141 | 00170 |
---|
142 | <a name="l00173"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiona6">00173</a> <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a> &getSource()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> source; } |
---|
143 | 00174 |
---|
144 | <a name="l00177"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiona7">00177</a> <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a> &getFile()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> file; } |
---|
145 | 00178 |
---|
146 | <a name="l00181"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiona8">00181</a> <span class="keywordtype">long</span> getLine()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> line; } |
---|
147 | 00182 |
---|
148 | <a name="l00187"></a><a class="code" href="classOgre_1_1Exception.html#Ogre_1_1Exceptiona9">00187</a> <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a> &getDescription(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> description; } |
---|
149 | 00188 |
---|
150 | 00191 <span class="keyword">static</span> Exception* getLastException(<span class="keywordtype">void</span>) <span class="keywordflow">throw</span>(); |
---|
151 | 00192 |
---|
152 | 00195 <span class="keyword">static</span> <span class="keywordtype">void</span> _pushFunction( <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& strFuncName ) <span class="keywordflow">throw</span>(); |
---|
153 | 00198 <span class="keyword">static</span> <span class="keywordtype">void</span> _popFunction() <span class="keywordflow">throw</span>(); |
---|
154 | 00199 |
---|
155 | 00200 |
---|
156 | 00201 }; |
---|
157 | 00202 |
---|
158 | <a name="l00204"></a><a class="code" href="classOgre_1_1AutomaticGuardUnguard.html">00204</a> <span class="keyword">class </span><a class="code" href="class__OgreExport.html">_OgreExport</a> AutomaticGuardUnguard { |
---|
159 | 00205 <span class="keyword">public</span>: |
---|
160 | <a name="l00206"></a><a class="code" href="classOgre_1_1AutomaticGuardUnguard.html#Ogre_1_1AutomaticGuardUnguarda0">00206</a> AutomaticGuardUnguard(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a471">String</a>& funcName) <span class="keywordflow">throw</span>() |
---|
161 | 00207 { |
---|
162 | 00208 Exception::_pushFunction(funcName); |
---|
163 | 00209 } |
---|
164 | <a name="l00210"></a><a class="code" href="classOgre_1_1AutomaticGuardUnguard.html#Ogre_1_1AutomaticGuardUnguarda1">00210</a> ~AutomaticGuardUnguard() <span class="keywordflow">throw</span>() |
---|
165 | 00211 { |
---|
166 | 00212 Exception::_popFunction(); |
---|
167 | 00213 } |
---|
168 | 00214 }; |
---|
169 | 00215 |
---|
170 | 00216 } <span class="comment">// Namespace Ogre</span> |
---|
171 | 00217 <span class="preprocessor">#endif</span> |
---|
172 | </pre></div><hr> |
---|
173 | <p> |
---|
174 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
175 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
176 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
177 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
178 | <Work rdf:about=""> |
---|
179 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
180 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
181 | </Work> |
---|
182 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
183 | |
---|
184 | Last modified Sun Mar 12 14:37:40 2006 |
---|
185 | </p> |
---|
186 | </body> |
---|
187 | </html> |
---|