This class provides functions for pushing and popping data to and from the "error stack", used to pass information to accompany a simple status code.
- Note
- For most users, the functions provided in the file lt_utilStatusStrings.h are sufficient for error reporting. Only applications which need to add their own error strings or perform internationalization need to use this class.
-
This error management system is expected to be substantially changed in a future release.
Example usage:
// IN APPLICATION
LTUtilStatus::initialize();
...
// IN SOME LIBRARY
LT_STATUS sts = someFunction("foo.txt",99);
if (!LT_SUCCESS(sts))
{
LTUtilStatusData::pushBegin(sts);
LTUtilStatusData::pushString("foo.txt");
LTUtilStatusData::pushEnd();
return sts;
}
...
// IN LT_LIB_UTILS
LT_STATUS sts;
char* str;
int i;
LTUtilStatusData::popBegin(sts);
// parse string for code sts to determine needed data items...
LTUtilStatusData::popString(str);
LTUtilStatusData::popEnd();
...
// IN APPLICATION
LTUtilStatusData::terminate();
*
To set error data, you must first do pushBegin(), then push zero or more other data items (called Records), then do a pushEnd().
To retrieve error data, you must first do a popBegin(), followed by pops of whatever you pushed, then do a popEnd().
Note it is assumed the popper knows the order and type of things to be popped off. (This is not really a problem, since the status code is associated with a string which will contain d, s, etc telling him what to do. Furthermore, the only person who should ever need to use the pop calls will be lt_lib_statusStrings.)
If you do not call initialize(), the push and pop operations will do nothing. This way, apps need not use the StatusData system if they do not wish to.
Definition at line 86 of file lt_utilStatusData.h.