Changeset 16538 in vbox
- Timestamp:
- Feb 5, 2009 11:25:01 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
include/VBox/settings.h (modified) (4 diffs)
-
include/VBox/xml.h (modified) (1 diff)
-
src/VBox/Main/VirtualBoxBase.cpp (modified) (4 diffs)
-
src/VBox/Main/xml/Settings.cpp (modified) (8 diffs)
-
src/VBox/Main/xml/xml.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r16188 r16538 47 47 #include <VBox/xml.h> 48 48 49 #include <stdarg.h>49 // #include <stdarg.h> 50 50 51 51 … … 592 592 catch (const ENoValue &) 593 593 { 594 throw ENoValue( xml::FmtStr("No such attribute '%s'", aName));594 throw ENoValue(com::Utf8StrFmt("No such attribute '%s'", aName)); 595 595 } 596 596 } … … 647 647 catch (const ENoValue &) 648 648 { 649 throw ENoValue( xml::FmtStr("No value for attribute '%s'", aName));649 throw ENoValue(com::Utf8StrFmt("No value for attribute '%s'", aName)); 650 650 } 651 651 } … … 761 761 if (key.isNull()) 762 762 { 763 throw ENoKey( xml::FmtStr("No such key '%s'", aName));763 throw ENoKey(com::Utf8StrFmt("No such key '%s'", aName)); 764 764 } 765 765 return key; -
trunk/include/VBox/xml.h
r16325 r16538 101 101 { 102 102 103 // Helpers104 //////////////////////////////////////////////////////////////////////////////105 106 /**107 * Temporary holder for the formatted string.108 *109 * Instances of this class are used for passing the formatted string as an110 * argument to an Error constructor or to another function that takes111 * <tr>const char *</tr> and makes a copy of the string it points to.112 */113 class VBOXXML_CLASS FmtStr114 {115 public:116 117 /**118 * Creates a formatted string using the format string and a set of119 * printf-like arguments.120 */121 FmtStr(const char *aFmt, ...)122 {123 va_list args;124 va_start(args, aFmt);125 RTStrAPrintfV(&mStr, aFmt, args);126 va_end(args);127 }128 129 ~FmtStr() { RTStrFree (mStr); }130 131 operator const char *() { return mStr; }132 133 private:134 135 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (FmtStr)136 137 char *mStr;138 };139 140 141 103 // Exceptions 142 104 ////////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/Main/VirtualBoxBase.cpp
r16188 r16538 21 21 * additional information or have any questions. 22 22 */ 23 24 #include <iprt/semaphore.h> 25 #include <iprt/asm.h> 23 26 24 27 #if !defined (VBOX_WITH_XPCOM) … … 34 37 #include "VirtualBoxErrorInfoImpl.h" 35 38 #include "Logging.h" 36 37 #include <iprt/semaphore.h>38 #include <iprt/asm.h>39 39 40 40 // VirtualBoxBaseProto methods … … 1270 1270 strlen (aValue) != RTUUID_STR_LENGTH + 1 || 1271 1271 aValue [RTUUID_STR_LENGTH] != '}') 1272 throw ENoConversion( xml::FmtStr("'%s' is not Guid", aValue));1272 throw ENoConversion(com::Utf8StrFmt("'%s' is not Guid", aValue)); 1273 1273 1274 1274 /* strip { and } */ … … 1280 1280 int vrc = RTUuidFromStr (&uuid, buf); 1281 1281 if (RT_FAILURE (vrc)) 1282 throw ENoConversion( xml::FmtStr("'%s' is not Guid (%Rrc)", aValue, vrc));1282 throw ENoConversion(com::Utf8StrFmt("'%s' is not Guid (%Rrc)", aValue, vrc)); 1283 1283 1284 1284 return com::Guid (uuid); -
trunk/src/VBox/Main/xml/Settings.cpp
r16188 r16538 19 19 */ 20 20 21 #include "VBox/settings.h"22 23 #include "Logging.h"24 25 21 #include <iprt/err.h> 26 22 #include <iprt/file.h> … … 40 36 #include <libxslt/xsltutils.h> 41 37 42 #include <string.h> 43 38 #include <list> 39 40 // #include <string.h> 41 42 #include "VBox/settings.h" 43 44 #include "Logging.h" 44 45 45 46 namespace settings … … 58 59 return aChar - 'a' + 0xA; 59 60 60 throw ENoConversion( xml::FmtStr("'%c' (0x%02X) is not hex", aChar, aChar));61 throw ENoConversion(com::Utf8StrFmt("'%c' (0x%02X) is not hex", aChar, aChar)); 61 62 } 62 63 … … 121 122 } 122 123 123 throw ENoConversion( xml::FmtStr("'%s' is not integer", aValue));124 throw ENoConversion(com::Utf8StrFmt("'%s' is not integer", aValue)); 124 125 } 125 126 … … 142 143 return false; 143 144 144 throw ENoConversion( xml::FmtStr("'%s' is not bool", aValue));145 throw ENoConversion(com::Utf8StrFmt("'%s' is not bool", aValue)); 145 146 } 146 147 … … 176 177 } 177 178 else 178 throw ENoConversion( xml::FmtStr("'%s' is not UTC date", aValue));179 } 180 181 throw ENoConversion( xml::FmtStr("'%s' is not ISO date", aValue));179 throw ENoConversion(com::Utf8StrFmt("'%s' is not UTC date", aValue)); 180 } 181 182 throw ENoConversion(com::Utf8StrFmt("'%s' is not ISO date", aValue)); 182 183 } 183 184 … … 192 193 /* therefore, the original length must be even */ 193 194 if (len % 2 != 0) 194 throw ENoConversion( xml::FmtStr("'%.*s' is not binary data",195 aLen, aValue));195 throw ENoConversion(com::Utf8StrFmt("'%.*s' is not binary data", 196 aLen, aValue)); 196 197 197 198 stdx::char_auto_ptr result (new char [len]); … … 265 266 RTTIME time; 266 267 if (!RTTimeExplode (&time, &aValue)) 267 throw ENoConversion( xml::FmtStr("timespec %lld ms is invalid",268 RTTimeSpecGetMilli (&aValue)));268 throw ENoConversion(com::Utf8StrFmt("timespec %lld ms is invalid", 269 RTTimeSpecGetMilli (&aValue))); 269 270 270 271 /* Store ISO date (xsd:dateTime). The format is: -
trunk/src/VBox/Main/xml/xml.cpp
r16325 r16538 21 21 #include "Logging.h" 22 22 23 #include <boost/shared_ptr.hpp> 24 23 #include <iprt/cdefs.h> 25 24 #include <iprt/err.h> 26 25 #include <iprt/file.h> … … 39 38 #include <list> 40 39 #include <map> 40 #include <boost/shared_ptr.hpp> 41 41 42 42 #include "VBox/xml.h"
Note:
See TracChangeset
for help on using the changeset viewer.

