start with implementing fields

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@12 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-09 16:21:38 +00:00
parent 35ece4674d
commit b6c7e5bd01
16 changed files with 453 additions and 21 deletions
+10 -1
View File
@@ -99,6 +99,15 @@ class Reader {
// ----------------------------------------------------------------------------- : Container types
/// Construct a new type, possibly reading something in the process.
/** By default just creates a new object.
* This function can be overloaded to provide different behaviour
*/
template <typename T>
shared_ptr<T> read_new(Reader& reader) {
return new_shared<T>();
}
template <typename T>
void Reader::handle(vector<T>& vector) {
String vectorKey = key;
@@ -111,7 +120,7 @@ void Reader::handle(vector<T>& vector) {
template <typename T>
void Reader::handle(shared_ptr<T>& pointer) {
if (!pointer) pointer.reset(new T);
if (!pointer) pointer = read_new<T>(*this);
handle(*pointer);
}