VirtualBox

儲存庫 vbox 的更動 16539


忽略:
時間撮記:
2009-2-5 下午11:31:33 (16 年 以前)
作者:
vboxsync
訊息:

Main: remove special string class in XML exceptions

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/include/VBox/xml.h

    r16538 r16539  
    3131#define ___VBox_vboxxml_h
    3232
    33 #include <iprt/cdefs.h>
    34 #include <iprt/cpputils.h>
    35 
    36 /* these conflict with numeric_digits<>::min and max */
    37 #undef min
    38 #undef max
    39 
    40 #include <iprt/mem.h>
    41 
    4233#ifndef IN_RING3
    4334# error "There are no XML APIs available in Ring-0 Context!"
     
    112103
    113104    Error(const char *aMsg = NULL)
    114         : m (aMsg ? Str::New (aMsg) : NULL) {}
     105        : m(aMsg) {}
    115106
    116107    virtual ~Error() throw() {}
    117108
    118     void setWhat (const char *aMsg) { m = aMsg ? Str::New (aMsg) : NULL; }
    119 
    120     const char *what() const throw() { return m.is_null() ? NULL : m->str; }
     109    void setWhat (const char *aMsg) { m = aMsg; }
     110
     111    const char* what() const throw() { return m.c_str(); }
    121112
    122113private:
     
    124115//     Error() {};     // hide the default constructor to make sure the extended one above is always used
    125116
    126     /** smart string with support for reference counting */
    127     struct Str
    128     {
    129         size_t ref() { return ++ refs; }
    130         size_t unref() { return -- refs; }
    131 
    132         size_t refs;
    133         char str [1];
    134 
    135         static Str *New (const char *aStr)
    136         {
    137             Str *that = (Str *) RTMemAllocZ (sizeof (Str) + strlen (aStr));
    138             AssertReturn (that, NULL);
    139             strcpy (that->str, aStr);
    140             return that;
    141         }
    142 
    143         void operator delete (void *that, size_t) { RTMemFree (that); }
    144     };
    145 
    146     stdx::auto_ref_ptr <Str> m;
     117    com::Utf8Str m;
    147118};
    148119
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette