"Fossies" - the Fresh Open Source Software Archive

Member "tesseract-ocr/doc/html/class_e_r_r_c_o_d_e.html" (26 Oct 2012, 15866 Bytes) of package /linux/misc/old/tesseract-ocr-3.02.02-doc-html.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the tesseract-ocr-3.02.02-doc-html.tar.gz project site itself.

Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ERRCODE Class Reference

#include <errcode.h>

List of all members.

Public Member Functions

void error (const char *caller, TessErrorLogCode action, const char *format,...) const
 ERRCODE (const char *string)

Detailed Description

Definition at line 69 of file errcode.h.


Constructor & Destructor Documentation

ERRCODE::ERRCODE ( const char *  string)
inline

Definition at line 77 of file errcode.h.

{
message = string;
} // initialize with string

Member Function Documentation

void ERRCODE::error ( const char *  caller,
TessErrorLogCode  action,
const char *  format,
  ... 
) const

Definition at line 41 of file errcode.cpp.

{
va_list args; // variable args
char msg[MAX_MSG];
char *msgptr = msg;
if (caller != NULL)
//name of caller
msgptr += sprintf (msgptr, "%s:", caller);
//actual message
msgptr += sprintf (msgptr, "Error:%s", message);
if (format != NULL) {
msgptr += sprintf (msgptr, ":");
va_start(args, format); //variable list
#ifdef _WIN32
//print remainder
msgptr += _vsnprintf (msgptr, MAX_MSG - 2 - (msgptr - msg), format, args);
msg[MAX_MSG - 2] = '\0'; //ensure termination
strcat (msg, "\n");
#else
//print remainder
msgptr += vsprintf (msgptr, format, args);
//no specific
msgptr += sprintf (msgptr, "\n");
#endif
va_end(args);
}
else
//no specific
msgptr += sprintf (msgptr, "\n");
// %s is needed here so msg is printed correctly!
fprintf(stderr, "%s", msg);
int* p = NULL;
switch (action) {
case DBG:
case TESSLOG:
return; //report only
case TESSEXIT:
//err_exit();
case ABORT:
// Create a deliberate segv as the stack trace is more useful that way.
if (!*p)
abort();
default:
}
}

The documentation for this class was generated from the following files: