diff options
Diffstat (limited to 'meowpp/oo/ObjBase.h')
-rw-r--r-- | meowpp/oo/ObjBase.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/meowpp/oo/ObjBase.h b/meowpp/oo/ObjBase.h index 0ae9427..253afb6 100644 --- a/meowpp/oo/ObjBase.h +++ b/meowpp/oo/ObjBase.h @@ -14,10 +14,14 @@ namespace meow { */ class ObjBase { protected: - ObjBase(){ } + + /*! + * @brief Constructor with doing nothing + */ + ObjBase() { } public: - virtual ~ObjBase(){ } - + virtual ~ObjBase() { } + /*! * @brief 將物件寫入檔案, 預設implement為直接回傳 \c false * @@ -29,7 +33,7 @@ public: virtual bool write(FILE* f, bool bin, unsigned int fg) const { return false; } - + /*! * @brief 將物件從檔案讀出, 預設implement為直接回傳 \c false * @@ -41,14 +45,14 @@ public: virtual bool read(FILE* f, bool bin, unsigned int fg) { return false; } - + /*! * @brief 回傳一個new出來的物件, 預設implement為直接回傳 \c NULL */ virtual ObjBase* create() const { return NULL; } - + /*! * @brief 複製, 預設使用operator= * @@ -59,29 +63,28 @@ public: (*this) = (*b); return this; } - + /*! * @brief 用C-style string回傳這個class的type name */ virtual char const* ctype() const { return typeid(*this).name(); } - + /*! * @brief 用std::string回傳這個class的type name */ virtual std::string type() const { - static std::string s(ctype()); - return s; + return std::string(ctype()); } - + /*! * @brief 用C-style string回傳base的type name */ static char const* ctypeBase() { return typeid(ObjBase).name(); } - + /*! * @brief 用std::string回傳base的type name */ |