Changeset 19519 in vbox for trunk/include/VBox
- Timestamp:
- May 8, 2009 12:38:07 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/xml.h
r18515 r19519 102 102 public: 103 103 104 Error(const char *aMsg = NULL) 105 : m(aMsg) {} 106 107 virtual ~Error() throw() {} 108 109 void setWhat (const char *aMsg) { m = aMsg; } 110 111 const char* what() const throw() { return m.c_str(); } 112 113 private: 114 115 // Error() {}; // hide the default constructor to make sure the extended one above is always used 116 117 com::Utf8Str m; 104 Error(const char *pcszMessage = NULL) 105 : m_pcsz(NULL) 106 { 107 copyFrom(pcszMessage); 108 } 109 110 Error(const Error &s) 111 : std::exception(s) 112 { 113 copyFrom(s.what()); 114 } 115 116 virtual ~Error() throw() 117 { 118 cleanup(); 119 } 120 121 void operator=(const Error &s) 122 { 123 cleanup(); 124 copyFrom(s.what()); 125 } 126 127 void setWhat(const char *pcszMessage) 128 { 129 cleanup(); 130 copyFrom(pcszMessage); 131 } 132 133 virtual const char* what() const throw() 134 { 135 return m_pcsz; 136 } 137 138 private: 139 Error() {}; // hide the default constructor to make sure the extended one above is always used 140 141 void cleanup() 142 { 143 if (m_pcsz) 144 { 145 RTStrFree(m_pcsz); 146 m_pcsz = NULL; 147 } 148 } 149 150 void copyFrom(const char *pcszMessage) 151 { 152 if (pcszMessage) 153 m_pcsz = RTStrDup(pcszMessage); 154 } 155 156 char *m_pcsz; 118 157 }; 119 158 … … 122 161 public: 123 162 124 LogicError 163 LogicError(const char *aMsg = NULL) 125 164 : xml::Error(aMsg) 126 165 {} 127 166 128 LogicError 167 LogicError(RT_SRC_POS_DECL); 129 168 }; 130 169 … … 133 172 public: 134 173 135 RuntimeError (const char *aMsg = NULL) : Error (aMsg) {} 174 RuntimeError(const char *aMsg = NULL) 175 : xml::Error(aMsg) 176 {} 136 177 }; 137 178 … … 498 539 499 540 const AttributeNode* findAttribute(const char *pcszMatch) const; 500 bool getAttributeValue(const char *pcszMatch, co m::Utf8Str &str) const;541 bool getAttributeValue(const char *pcszMatch, const char *&ppcsz) const; 501 542 bool getAttributeValue(const char *pcszMatch, int64_t &i) const; 502 543 bool getAttributeValue(const char *pcszMatch, uint64_t &i) const;
Note:
See TracChangeset
for help on using the changeset viewer.