18 #ifndef __eerror_h_included 19 #define __eerror_h_included 39 #define DECLARE_ERR_MAP(__name__) EErrorMapEntry __name__[]; 40 #define BGN_ERR_MAP(__name__) EErrorMapEntry __name__[] = { 42 #define ERR_MAP_ENTRY(id, err) {id, err}, 44 #define END_ERR_MAP() \ 53 #define DECLARE_ERROR(__e__) \ 54 class __e__ : public EError \ 57 __e__() { setText(#__e__); } \ 58 virtual const cpStr Name() const { return #__e__; } \ 60 #define DECLARE_ERROR_ADVANCED(__e__) \ 62 class __e__ : public EError \ 66 virtual const cpStr Name() const { return #__e__; } \ 68 #define DECLARE_ERROR_ADVANCED2(__e__) \ 70 class __e__ : public EError \ 74 virtual const cpStr Name() const { return #__e__; } \ 76 #define DECLARE_ERROR_ADVANCED3(__e__) \ 78 class __e__ : public EError \ 81 __e__(Int err, cpChar msg); \ 82 virtual const cpStr Name() const { return #__e__; } \ 84 #define DECLARE_ERROR_ADVANCED4(__e__) \ 86 class __e__ : public EError \ 90 virtual const cpStr Name() const { return #__e__; } \ 124 m_eSeverity = eSeverity;
135 m_eSeverity = eSeverity;
145 m_eSeverity = eSeverity;
147 setText(txt.c_str());
155 m_eSeverity = eSeverity;
157 setText(txt.c_str());
173 operator cpStr() {
return m_str.c_str(); }
179 m_str.assign(val.m_str);
191 virtual const cpStr
Name()
const 210 m_str.assign(pszText);
216 Void setTextf(cpStr pszFormat, ...);
221 m_str.append(pszText);
228 Void appendTextf(cpStr pszText, ...);
234 m_eSeverity = eSeverity;
244 m_eSeverity = Warning;
255 return m_eSeverity == Error;
261 return m_eSeverity == Warning;
267 return m_eSeverity == Info;
273 return m_eSeverity == Error;
279 return m_eSeverity != Info;
291 return m_pszSeverity[m_eSeverity];
298 return m_pszSeverity[eSeverity];
309 Void setLastOsError(Dword dwError = -1);
312 Void appendLastOsError(Dword dwError = -1);
318 static cpStr getError(Int nError, EErrorMapEntry *pErrors);
322 virtual const char*
what()
const throw ()
324 return m_str.c_str();
329 static cpStr m_pszSeverity[];
336 #endif // #define __eerror_h_included static cpStr getSeverityText(Severity eSeverity)
Returns the text asociated with the specified severity code.
Definition: eerror.h:296
Void setWarning()
Sets the severity level of this error object to "Warning".
Definition: eerror.h:242
Bool isSevere()
Returns True if the severity is "Error".
Definition: eerror.h:253
Encapsulates and extends a std::string object.
Bool isErrorOrWarning()
Returns True if the severity is "Error" or "Warning".
Definition: eerror.h:277
Bool isInfo()
Returns True if the severity is "Info".
Definition: eerror.h:265
Void setSevere()
Sets the severity level of this error object to "Error".
Definition: eerror.h:237
Warning.
Definition: eerror.h:103
Severity
Error severity levels.
Definition: eerror.h:98
EError & copy(const EError &val)
Copies the contents of the specified object to this object.
Definition: eerror.h:177
Void setText(cpStr pszText)
Sets the text associated with this error.
Definition: eerror.h:208
Void setInfo()
Sets the severity level of this error object to "Info".
Definition: eerror.h:247
Severity m_eSeverity
Represents the severity of the error.
Definition: eerror.h:110
cpStr getSeverityText()
Returns the text based on the current error object's severity.
Definition: eerror.h:289
Bool isWarning()
Returns True if the severity is "Warning".
Definition: eerror.h:259
Void setSeverity(Severity eSeverity)
Sets the severity level of this error object.
Definition: eerror.h:232
EError(Severity eSeverity, cpStr pszText=NULL)
Additonal constructor.
Definition: eerror.h:122
EError()
Default constructor.
Definition: eerror.h:114
EError(Severity eSeverity, Dword err, cpStr pszText=NULL)
Additonal constructor.
Definition: eerror.h:133
Severity getSeverity()
Returns the current severity setting of this error object.
Definition: eerror.h:283
The base class for exceptions derived from std::exception.
Definition: eerror.h:94
EError(Severity eSeverity, const std::string &txt)
Additonal constructor.
Definition: eerror.h:143
virtual const char * what() const
The overloaded definition of the std::exception::what() method.
Definition: eerror.h:322
EError & operator=(const EError &val)
Assignment operator.
Definition: eerror.h:167
Informational.
Definition: eerror.h:101
EError(Severity eSeverity, Dword err, const std::string &txt)
Additonal constructor.
Definition: eerror.h:153
Bool isError()
Returns True if the severity is "Error".
Definition: eerror.h:271
Dword m_dwError
The unsigned long error code (if appropriate)
Definition: eerror.h:108
Void appendText(cpStr pszText)
appends the specified text to the current text of this error.
Definition: eerror.h:219
Void clear()
Clears the current contents of this error object.
Definition: eerror.h:196
virtual const cpStr Name() const
Returns the name of this object.
Definition: eerror.h:191
cpStr getText()
Returns the text associated with this error.
Definition: eerror.h:202
String class.
Definition: estring.h:31
Dword getLastOsError()
Returns the current value of m_dwError.
Definition: eerror.h:303
EError(const EError &val)
Copy constructor.
Definition: eerror.h:160