Digital Authentication Framework 6.0.1.33
|
00001 /* 00002 * (c) 2014 Good Technology Corporation. All rights reserved. 00003 */ 00004 00010 #ifndef BASIC_ERROR_H 00011 #define BASIC_ERROR_H 00012 #include "DigitalAuthenticationFramework.h" 00013 00014 #include <cstdlib> 00015 00022 class BasicError : public DAError 00023 { 00024 public: 00025 BasicError() : m_err(0) {} 00026 00027 virtual int getCode() 00028 { 00029 return m_err; 00030 } 00031 00036 bool setCode(int e) 00037 { 00038 m_err = e; 00039 return (e==SUCCESS); 00040 } 00041 00042 virtual void clear() 00043 { 00044 setCode(SUCCESS); 00045 } 00046 00047 virtual void getAsStringUTF8(std::string &out) 00048 { 00049 switch (getCode()) 00050 { 00051 #if !(DOXYGEN) 00052 #define F(code, str) case (code): out = str; break; 00053 ALL_ERRORS(F); 00054 #undef F 00055 #endif 00056 default: 00057 out = "Unknown error"; 00058 abort(); /* Should never happen */ 00059 } 00060 } 00061 00062 protected: 00063 int m_err; 00064 }; 00065 00066 #endif