ducttape-engine  0.2.0
A universal game engine
 All Classes Functions Variables Typedefs Enumerations Enumerator
Serializer.hpp
00001 
00002 // ----------------------------------------------------------------------------
00003 // This file is part of the Ducttape Project (http://ducttape-dev.org) and is
00004 // licensed under the GNU LESSER PUBLIC LICENSE version 3. For the full license
00005 // text, please see the LICENSE file in the root of this project or at
00006 // http://www.gnu.org/licenses/lgpl.html
00007 // ----------------------------------------------------------------------------
00008 
00009 #ifndef DUCTTAPE_ENGINE_SCENE_SERIALIZER
00010 #define DUCTTAPE_ENGINE_SCENE_SERIALIZER
00011 
00012 #include <Config.hpp>
00013 
00014 #include <Scene/Component.hpp>
00015 #include <Utils/Logger.hpp>
00016 #include <Utils/Utils.hpp>
00017 
00018 #include <QMetaType>
00023 #define DT_SERIALIZABLE(class_name) DT_SERIALIZABLE_INHERITED(class_name, Component)
00024 
00025 #define DT_SERIALIZABLE_INHERITED(class_name, base_class_name) \
00026     class_name(const class_name& other) : base_class_name() { \
00027         assert(false && "This copy-constructor should never be called. (class_name)"); \
00028     }
00029 
00030 namespace dt {
00031 
00032 // forward declaration
00033 class Component;
00034 class Node;
00035 
00043 class DUCTTAPE_API Serializer {
00044 public:
00048     static void initialize();
00049 
00053     static void deinitialize();
00054 
00055     template <typename T>
00056     static void registerComponent(const std::string& name) {
00057         qRegisterMetaType<T>(name.c_str());
00058     }
00059 
00060     static Component* createComponent(const std::string& name);
00061 
00062     static void serializeNode(Node* node);
00063 
00064 private:
00065 
00066 
00067 };
00068 
00069 } // namespace dt
00070 
00071 #endif