Templates -- Meow
1.1.4
A C++ template which is unable and also not allowed to compile to obj-file first.
|
利用register的概念, 達到runtime用string選擇要new的class More...
#include "ObjSelector.h"
Public Member Functions | |
ObjSelector (std::string name, ObjBase *obj, bool autoDelete) | |
宣告一個ObjSelector實體, 並且註冊一個 ObjBase More... | |
ObjSelector (ObjBase *obj, bool autoDelete) | |
宣告一個ObjSelector實體, 並且註冊一個 ObjBase More... | |
~ObjSelector () | |
解構子 More... | |
Static Public Member Functions | |
static void | add (std::string name, ObjBase *obj, bool autoDelete) |
新增(註冊) 一個Class (必須要繼承自 ObjBase ) 並且給定其Name More... | |
static void | add (ObjBase *obj, bool autoDelete) |
新增(註冊) 一個Class (必須要繼承自 ObjBase ) 並且默認type為name More... | |
static void | del (std::string name) |
依照name刪除之前註冊過得Class More... | |
static ObjBase const * | get (std::string name) |
取得之前註冊過得Class More... | |
static ObjBase * | create (std::string name) |
回傳一個之前註冊過得Class new出來的實體 More... | |
static bool | exist (ObjBase *obj) |
利用type檢查是否有註冊過同種類的Class More... | |
static std::string | name (ObjBase *obj) |
利用type尋找name More... | |
static std::vector< std::string > | names () |
回傳所有註冊過的name More... | |
static bool | write (FILE *f, bool binary, ObjBase *obj, unsigned int fg) |
將一個物件寫到檔案裡(該物件必須要有註冊過) More... | |
static ObjBase * | read (FILE *f, bool binary) |
從檔案中讀取一個物件(該物件必須要有註冊過) More... | |
Friends | |
struct | Info |
利用register的概念, 達到runtime用string選擇要new的class
Definition at line 22 of file ObjSelector.h.
|
inline |
宣告一個ObjSelector實體, 並且註冊一個 ObjBase
Definition at line 148 of file ObjSelector.h.
|
inline |
宣告一個ObjSelector實體, 並且註冊一個 ObjBase
Definition at line 156 of file ObjSelector.h.
|
inline |
解構子
Definition at line 162 of file ObjSelector.h.
|
inlinestatic |
新增(註冊) 一個Class (必須要繼承自 ObjBase
) 並且給定其Name
Definition at line 69 of file ObjSelector.h.
|
inlinestatic |
新增(註冊) 一個Class (必須要繼承自 ObjBase
) 並且默認type為name
Definition at line 76 of file ObjSelector.h.
|
inlinestatic |
回傳一個之前註冊過得Class new出來的實體
Definition at line 101 of file ObjSelector.h.
|
inlinestatic |
依照name刪除之前註冊過得Class
Definition at line 83 of file ObjSelector.h.
|
inlinestatic |
利用type檢查是否有註冊過同種類的Class
Definition at line 110 of file ObjSelector.h.
|
inlinestatic |
取得之前註冊過得Class
Definition at line 93 of file ObjSelector.h.
|
inlinestatic |
利用type尋找name
Definition at line 124 of file ObjSelector.h.
|
inlinestatic |
回傳所有註冊過的name
Definition at line 138 of file ObjSelector.h.
|
inlinestatic |
從檔案中讀取一個物件(該物件必須要有註冊過)
Definition at line 188 of file ObjSelector.h.
|
inlinestatic |
將一個物件寫到檔案裡(該物件必須要有註冊過)
Definition at line 171 of file ObjSelector.h.
|
friend |
Definition at line 45 of file ObjSelector.h.