]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/TypeDescription.h
initialize objects after loading
[l2e.git] / src / loader / TypeDescription.h
index fb1b07890a8fe57bff4b46d58e540d7734e583eb..078002fed916c2a96481be4b050c205edae60331 100644 (file)
@@ -40,10 +40,11 @@ public:
        bool HasField(const std::string &name) const;
        const FieldDescription &GetField(const std::string &name) const;
        void Construct(void *) const;
+       void Init(void *) const;
        void Load(void *) const;
-       bool NeedsLinking() const { return link; }
 
        void SetConstructor(void (*ctor)(void *)) { constructor = ctor; }
+       void SetInitializer(void (*init)(void *)) { initializer = init; }
        void SetLoader(void (*ld)(void *)) { loader = ld; }
        void AddSupertype(int id, std::ptrdiff_t offset);
        bool IsSubtypeOf(int id) const;
@@ -73,10 +74,19 @@ public:
        static void WriteSourceWiki(std::ostream &);
 
 private:
-       TypeDescription(int id, const std::string &name) : constructor(0), loader(0), description(0), name(name), id(id), size(0), link(false) { }
+       TypeDescription(int id, const std::string &name)
+       : constructor(0)
+       , initializer(0)
+       , loader(0)
+       , description(0)
+       , name(name)
+       , id(id)
+       , size(0)
+       { }
 
 private:
        void (*constructor)(void *);
+       void (*initializer)(void *);
        void (*loader)(void *);
        const char *description;
        std::string name;
@@ -84,7 +94,6 @@ private:
        std::map<int, std::ptrdiff_t> supertypes;
        int id;
        int size;
-       bool link;
 
        static std::map<int, TypeDescription> typeDescriptions;
        static std::map<std::string, int> typeName2ID;