⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpl__error_8h.html

📁 gdal库的学习文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
        </tr>        <tr>          <td class="paramkey"></td>          <td></td>          <td class="paramtype">&nbsp;</td>          <td class="paramname"> <em>...</em></td><td>&nbsp;</td>        </tr>        <tr>          <td></td>          <td>)</td>          <td></td><td></td><td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Report an error.<p>This function reports an error in a manner that can be hooked and reported appropriate by different applications.<p>The effect of this function can be altered by applications by installing a custom error handling using <a class="el" href="cpl__error_8h.html#74d0e649d58180e621540bf73b58e4a2">CPLSetErrorHandler()</a>.<p>The eErrClass argument can have the value CE_Warning indicating that the message is an informational warning, CE_Failure indicating that the action failed, but that normal recover mechanisms will be used or CE_Fatal meaning that a fatal error has occured, and that <a class="el" href="cpl__error_8h.html#ad2b98dd58e4de706a245faddac90403">CPLError()</a> should not return.<p>The default behaviour of <a class="el" href="cpl__error_8h.html#ad2b98dd58e4de706a245faddac90403">CPLError()</a> is to report errors to stderr, and to abort() after reporting a CE_Fatal error. It is expected that some applications will want to supress error reporting, and will want to install a C++ exception, or longjmp() approach to no local fatal error recovery.<p>Regardless of how application error handlers or the default error handler choose to handle an error, the error number, and message will be stored for recovery with <a class="el" href="cpl__error_8h.html#198afe56aced1d73226880aa90d39b99">CPLGetLastErrorNo()</a> and <a class="el" href="cpl__error_8h.html#7f71ade3bb0a0e9e45802975ec59ff5e">CPLGetLastErrorMsg()</a>.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>eErrClass</em>&nbsp;</td><td>one of CE_Warning, CE_Failure or CE_Fatal. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>err_no</em>&nbsp;</td><td>the error number (CPLE_*) from <a class="el" href="cpl__error_8h.html">cpl_error.h</a>. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>fmt</em>&nbsp;</td><td>a printf() style format string. Any additional arguments will be treated as arguments to fill in this format in a manner similar to printf(). </td></tr>  </table></dl></div></div><p><a class="anchor" name="29626fd8fdb658b19439beeb73a59560"></a><!-- doxytag: member="cpl_error.h::CPLErrorReset" ref="29626fd8fdb658b19439beeb73a59560" args="(void)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">void CPLErrorReset           </td>          <td>(</td>          <td class="paramtype">void&nbsp;</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Erase any traces of previous errors.<p>This is normally used to ensure that an error which has been recovered from does not appear to be still in play with high level functions. </div></div><p><a class="anchor" name="7f71ade3bb0a0e9e45802975ec59ff5e"></a><!-- doxytag: member="cpl_error.h::CPLGetLastErrorMsg" ref="7f71ade3bb0a0e9e45802975ec59ff5e" args="(void)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">const char* CPLGetLastErrorMsg           </td>          <td>(</td>          <td class="paramtype">void&nbsp;</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Get the last error message.<p>Fetches the last error message posted with <a class="el" href="cpl__error_8h.html#ad2b98dd58e4de706a245faddac90403">CPLError()</a>, that hasn't been cleared by <a class="el" href="cpl__error_8h.html#29626fd8fdb658b19439beeb73a59560">CPLErrorReset()</a>. The returned pointer is to an internal string that should not be altered or freed.<p><dl class="return" compact><dt><b>Returns:</b></dt><dd>the last error message, or NULL if there is no posted error message. </dd></dl></div></div><p><a class="anchor" name="198afe56aced1d73226880aa90d39b99"></a><!-- doxytag: member="cpl_error.h::CPLGetLastErrorNo" ref="198afe56aced1d73226880aa90d39b99" args="(void)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">int CPLGetLastErrorNo           </td>          <td>(</td>          <td class="paramtype">void&nbsp;</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Fetch the last error number.<p>This is the error number, not the error class.<p><dl class="return" compact><dt><b>Returns:</b></dt><dd>the error number of the last error to occur, or CPLE_None (0) if there are no posted errors. </dd></dl></div></div><p><a class="anchor" name="8df0d4e01034cf79202314c92251e920"></a><!-- doxytag: member="cpl_error.h::CPLGetLastErrorType" ref="8df0d4e01034cf79202314c92251e920" args="(void)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">CPLErr CPLGetLastErrorType           </td>          <td>(</td>          <td class="paramtype">void&nbsp;</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Fetch the last error type.<p>This is the error class, not the error number.<p><dl class="return" compact><dt><b>Returns:</b></dt><dd>the error number of the last error to occur, or CE_None (0) if there are no posted errors. </dd></dl></div></div><p><a class="anchor" name="c6c7c393c94b210e4be999f34fcb6680"></a><!-- doxytag: member="cpl_error.h::CPLPopErrorHandler" ref="c6c7c393c94b210e4be999f34fcb6680" args="(void)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">void CPLPopErrorHandler           </td>          <td>(</td>          <td class="paramtype">void&nbsp;</td>          <td class="paramname">          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Pop error handler off stack.<p>Discards the current error handler on the error handler stack, and restores the one in use before the last <a class="el" href="cpl__error_8h.html#d13c9c8f2037ddfd566c2a197f7b2537">CPLPushErrorHandler()</a> call. This method has no effect if there are no error handlers on the current threads error handler stack. </div></div><p><a class="anchor" name="d13c9c8f2037ddfd566c2a197f7b2537"></a><!-- doxytag: member="cpl_error.h::CPLPushErrorHandler" ref="d13c9c8f2037ddfd566c2a197f7b2537" args="(CPLErrorHandler)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">void CPLPushErrorHandler           </td>          <td>(</td>          <td class="paramtype">CPLErrorHandler&nbsp;</td>          <td class="paramname"> <em>pfnErrorHandlerNew</em>          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Push a new CPLError handler.<p>This pushes a new error handler on the thread-local error handler stack. This handler will be used untill removed with <a class="el" href="cpl__error_8h.html#c6c7c393c94b210e4be999f34fcb6680">CPLPopErrorHandler()</a>.<p>The <a class="el" href="cpl__error_8h.html#74d0e649d58180e621540bf73b58e4a2">CPLSetErrorHandler()</a> docs have further information on how CPLError handlers work.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>pfnErrorHandlerNew</em>&nbsp;</td><td>new error handler function. </td></tr>  </table></dl></div></div><p><a class="anchor" name="74d0e649d58180e621540bf73b58e4a2"></a><!-- doxytag: member="cpl_error.h::CPLSetErrorHandler" ref="74d0e649d58180e621540bf73b58e4a2" args="(CPLErrorHandler)" --><div class="memitem"><div class="memproto">      <table class="memname">        <tr>          <td class="memname">CPLErrorHandler CPLSetErrorHandler           </td>          <td>(</td>          <td class="paramtype">CPLErrorHandler&nbsp;</td>          <td class="paramname"> <em>pfnErrorHandlerNew</em>          </td>          <td>&nbsp;)&nbsp;</td>          <td width="100%"></td>        </tr>      </table></div><div class="memdoc"><p>Install custom error handler.<p>Allow the library's user to specify his own error handler function. A valid error handler is a C function with the following prototype:<p><pre>     void MyErrorHandler(CPLErr eErrClass, int err_no, const char *msg) </pre><p>Pass NULL to come back to the default behavior. The default behaviour (CPLDefaultErrorHandler()) is to write the message to stderr.<p>The msg will be a partially formatted error message not containing the "ERROR %d:" portion emitted by the default handler. Message formatting is handled by <a class="el" href="cpl__error_8h.html#ad2b98dd58e4de706a245faddac90403">CPLError()</a> before calling the handler. If the error handler function is passed a CE_Fatal class error and returns, then <a class="el" href="cpl__error_8h.html#ad2b98dd58e4de706a245faddac90403">CPLError()</a> will call abort(). Applications wanting to interrupt this fatal behaviour will have to use longjmp(), or a C++ exception to indirectly exit the function.<p>Another standard error handler is CPLQuietErrorHandler() which doesn't make any attempt to report the passed error or warning messages but will process debug messages via CPLDefaultErrorHandler.<p>Note that error handlers set with <a class="el" href="cpl__error_8h.html#74d0e649d58180e621540bf73b58e4a2">CPLSetErrorHandler()</a> apply to all threads in an application, while error handlers set with CPLPushErrorHandler are thread-local. However, any error handlers pushed with CPLPushErrorHandler (and not removed with CPLPopErrorHandler) take precidence over the global error handlers set with <a class="el" href="cpl__error_8h.html#74d0e649d58180e621540bf73b58e4a2">CPLSetErrorHandler()</a>. Generally speaking <a class="el" href="cpl__error_8h.html#74d0e649d58180e621540bf73b58e4a2">CPLSetErrorHandler()</a> would be used to set a desired global error handler, while <a class="el" href="cpl__error_8h.html#d13c9c8f2037ddfd566c2a197f7b2537">CPLPushErrorHandler()</a> would be used to install a temporary local error handler, such as CPLQuietErrorHandler() to suppress error reporting in a limited segment of code.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>pfnErrorHandlerNew</em>&nbsp;</td><td>new error handler function. </td></tr>  </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>returns the previously installed error handler. </dd></dl></div></div><p><hr>Generated for GDAL by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1.</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -