<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>CapiSuite: capiexception.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.3.8 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</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="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div> <h1>capiexception.h</h1><a href="capiexception_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 00007 <span class="comment">/***************************************************************************</span> 00008 <span class="comment"> * *</span> 00009 <span class="comment"> * This program is free software; you can redistribute it and/or modify *</span> 00010 <span class="comment"> * it under the terms of the GNU General Public License as published by *</span> 00011 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or *</span> 00012 <span class="comment"> * (at your option) any later version. *</span> 00013 <span class="comment"> * *</span> 00014 <span class="comment"> ***************************************************************************/</span> 00015 00016 <span class="preprocessor">#ifndef CAPIEXCEPTION_H</span> 00017 <span class="preprocessor"></span><span class="preprocessor">#define CAPIEXCEPTION_H</span> 00018 <span class="preprocessor"></span> 00019 <span class="preprocessor">#include <iostream></span> 00020 <span class="preprocessor">#include <sstream></span> 00021 <span class="preprocessor">#include <string></span> 00022 00023 <span class="keyword">using</span> <span class="keyword">namespace </span>std; 00024 <a name="l00035"></a><a class="code" href="classCapiError.html">00035</a> <span class="keyword">class </span><a class="code" href="classCapiError.html">CapiError</a> 00036 { 00037 <span class="keyword">public</span>: <a name="l00043"></a><a class="code" href="classCapiError.html#a0">00043</a> <a class="code" href="classCapiError.html#a0">CapiError</a>(string errormsg,string function_name): 00044 errormsg(errormsg),function_name(function_name) 00045 {} 00046 <a name="l00052"></a><a class="code" href="classCapiError.html#a1">00052</a> <span class="keyword">virtual</span> string <a class="code" href="classCapiError.html#a1">message</a>() 00053 { 00054 <span class="keywordflow">return</span> (<span class="stringliteral">"CapiError: "</span>+<a class="code" href="classCapiError.html#p0">errormsg</a>+<span class="stringliteral">" occured in "</span>+<a class="code" href="classCapiError.html#p1">function_name</a>); 00055 } 00056 00057 <span class="keyword">protected</span>: <a name="l00058"></a><a class="code" href="classCapiError.html#p0">00058</a> string <a class="code" href="classCapiError.html#p0">errormsg</a>; <a name="l00059"></a><a class="code" href="classCapiError.html#p1">00059</a> string <a class="code" href="classCapiError.html#p1">function_name</a>; 00060 }; 00061 <a name="l00070"></a><a class="code" href="classCapiWrongState.html">00070</a> <span class="keyword">class </span><a class="code" href="classCapiWrongState.html">CapiWrongState</a> : <span class="keyword">public</span> <a class="code" href="classCapiError.html">CapiError</a> 00071 { 00072 <span class="keyword">public</span>: <a name="l00078"></a><a class="code" href="classCapiWrongState.html#a0">00078</a> <a class="code" href="classCapiWrongState.html#a0">CapiWrongState</a>(string errormsg,string function_name): 00079 <a class="code" href="classCapiError.html">CapiError</a>(<span class="stringliteral">"CapiWrongstate: "</span>+errormsg,function_name) 00080 {} 00081 <a name="l00087"></a><a class="code" href="classCapiWrongState.html#a1">00087</a> <span class="keyword">virtual</span> string <a class="code" href="classCapiWrongState.html#a1">message</a>() 00088 { 00089 <span class="keywordflow">return</span> (<span class="stringliteral">"CapiWrongState: "</span>+errormsg+<span class="stringliteral">" occured in "</span>+function_name); 00090 } 00091 }; 00092 <a name="l00102"></a><a class="code" href="classCapiMsgError.html">00102</a> <span class="keyword">class </span><a class="code" href="classCapiMsgError.html">CapiMsgError</a> : <span class="keyword">public</span> <a class="code" href="classCapiError.html">CapiError</a> 00103 { 00104 <span class="keyword">public</span>: <a name="l00111"></a><a class="code" href="classCapiMsgError.html#a0">00111</a> <a class="code" href="classCapiMsgError.html#a0">CapiMsgError</a>(<span class="keywordtype">unsigned</span> info, string errormsg ,string function_name): 00112 <a class="code" href="classCapiError.html">CapiError</a>(errormsg,function_name),info(info) 00113 {} 00114 <a name="l00120"></a><a class="code" href="classCapiMsgError.html#a1">00120</a> <span class="keyword">virtual</span> string <a class="code" href="classCapiMsgError.html#a1">message</a>() 00121 { 00122 stringstream m; 00123 m << <span class="stringliteral">"CapiMsgError: "</span> << errormsg << <span class="stringliteral">" (error code 0x"</span> << hex << <a class="code" href="classCapiMsgError.html#p0">info</a> << <span class="stringliteral">") occured in "</span> << function_name; 00124 <span class="keywordflow">return</span> (m.str()); 00125 } 00126 00127 <span class="keyword">protected</span>: <a name="l00128"></a><a class="code" href="classCapiMsgError.html#p0">00128</a> <span class="keywordtype">unsigned</span> <a class="code" href="classCapiMsgError.html#p0">info</a>; 00129 }; 00130 <a name="l00138"></a><a class="code" href="classCapiExternalError.html">00138</a> <span class="keyword">class </span><a class="code" href="classCapiExternalError.html">CapiExternalError</a> : <span class="keyword">public</span> <a class="code" href="classCapiError.html">CapiError</a> 00139 { 00140 <span class="keyword">public</span>: <a name="l00146"></a><a class="code" href="classCapiExternalError.html#a0">00146</a> <a class="code" href="classCapiExternalError.html#a0">CapiExternalError</a>(string errormsg,string function_name): 00147 <a class="code" href="classCapiError.html">CapiError</a>(<span class="stringliteral">"CapiExternalError: "</span>+errormsg,function_name) 00148 {} 00149 <a name="l00155"></a><a class="code" href="classCapiExternalError.html#a1">00155</a> <span class="keyword">virtual</span> string <a class="code" href="classCapiExternalError.html#a1">message</a>() 00156 { 00157 <span class="keywordflow">return</span> (<span class="stringliteral">"CapiExternalError: "</span>+errormsg+<span class="stringliteral">" occured in "</span>+function_name); 00158 } 00159 }; 00160 <a name="l00163"></a><a class="code" href="capiexception_8h.html#a0">00163</a> <span class="keyword">inline</span> ostream& <a class="code" href="capiexception_8h.html#a0">operator<<</a>(ostream &s, <a class="code" href="classCapiError.html">CapiError</a> &e) 00164 { 00165 s << e.<a class="code" href="classCapiError.html#a1">message</a>(); 00166 <span class="keywordflow">return</span> s; 00167 } 00168 00169 <span class="preprocessor">#endif</span> 00170 <span class="preprocessor"></span> 00171 <span class="comment">/* History</span> 00172 <span class="comment"></span> 00173 <span class="comment">$Log: capiexception.h,v $</span> 00174 <span class="comment">Revision 1.1 2003/02/19 08:19:53 gernot</span> 00175 <span class="comment">Initial revision</span> 00176 <span class="comment"></span> 00177 <span class="comment">Revision 1.9 2003/01/19 16:50:27 ghillie</span> 00178 <span class="comment">- removed severity in exceptions. No FATAL-automatic-exit any more.</span> 00179 <span class="comment"> Removed many FATAL conditions, other ones are exiting now by themselves</span> 00180 <span class="comment"></span> 00181 <span class="comment">Revision 1.8 2002/12/13 09:57:10 ghillie</span> 00182 <span class="comment">- error message formatting done by exception classes now</span> 00183 <span class="comment"></span> 00184 <span class="comment">Revision 1.7 2002/12/11 13:05:34 ghillie</span> 00185 <span class="comment">- minor comment improvements</span> 00186 <span class="comment"></span> 00187 <span class="comment">Revision 1.6 2002/12/09 15:39:01 ghillie</span> 00188 <span class="comment">- removed severity WARNING</span> 00189 <span class="comment">- exception class doesn't print error message any more</span> 00190 <span class="comment"></span> 00191 <span class="comment">Revision 1.5 2002/11/29 10:24:09 ghillie</span> 00192 <span class="comment">- updated comments, use doxygen format now</span> 00193 <span class="comment">- changed some parameter names in constructor of CapiMsgError</span> 00194 <span class="comment"></span> 00195 <span class="comment">Revision 1.4 2002/11/27 16:00:02 ghillie</span> 00196 <span class="comment">updated comments for doxygen</span> 00197 <span class="comment"></span> 00198 <span class="comment">Revision 1.3 2002/11/19 15:57:18 ghillie</span> 00199 <span class="comment">- Added missing throw() declarations</span> 00200 <span class="comment">- phew. Added error handling. All exceptions are caught now.</span> 00201 <span class="comment"></span> 00202 <span class="comment">Revision 1.2 2002/11/18 14:24:09 ghillie</span> 00203 <span class="comment">- moved global severity_t to CapiError::severity_t</span> 00204 <span class="comment">- added throw() declarations</span> 00205 <span class="comment"></span> 00206 <span class="comment">Revision 1.1 2002/11/17 14:42:22 ghillie</span> 00207 <span class="comment">initial checkin</span> 00208 <span class="comment"></span> 00209 <span class="comment">*/</span> </div></pre><hr size="1"><address style="align: right;"><small>Generated on Sun Nov 28 14:37:44 2004 for CapiSuite by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address> </body> </html>