AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzTemplates.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #if !defined(_CZ_TEMPLATES_H_)
00015 #define _CZ_TEMPLATES_H_
00016 
00017 #include "CzUtil.h"
00018 #include "CzXoml.h"
00019 
00020 //
00021 //
00022 //
00023 //
00024 //  CzTemplate - A XOML template which can be used to instantiate a custom version of a class
00025 //
00026 //
00027 //
00028 //
00029 class CzTemplate : public IzXomlResource
00030 {
00031 public:
00032     // Properties
00033 protected:
00034     unsigned int            TargetType;             // Type of class that this template can be applied to such as actor, scene etc..
00035     CzXmlNode*              Root;                   // Root node
00036 public:
00037     unsigned int            getTargetType() const                   { return TargetType; }
00038     CzXmlNode*              getRoot()                               { return Root; }
00039     // Properties end
00040 protected:
00041     void                ReplaceAttributes(CzXmlAttribute* attrib, CzXmlNode* replacements);
00042     void                ReplaceTreeAttributes(CzXmlNode* node, CzXmlNode* replacements);
00043 public:
00044     CzTemplate() : IzXomlResource(), Root(NULL) { setClassType("template"); }
00045     virtual ~CzTemplate()
00046     {
00047         SAFE_DELETE(Root)
00048     }
00049 
00050     bool                Instantiate(IzXomlResource* parent, CzXmlNode* replacements);
00051 
00052     // Implementation of IzXomlClass interface
00053     int                 LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node);
00054 };
00055 
00056 //
00057 //
00058 //
00059 //
00060 //  CzTemplateCreator - Creates an instance of a template
00061 //
00062 //
00063 //
00064 //
00065 class CzTemplateCreator : public IzXomlClassCreator
00066 {
00067 public:
00068     CzTemplateCreator()
00069     {
00070         setClassName("template");
00071     }
00072     IzXomlResource* CreateInstance(IzXomlResource* parent)  { return new CzTemplate(); }
00073 };
00074 
00075 //
00076 //
00077 //
00078 //
00079 // CzTemplateFrom utility class to allow loading of XOMl files from XOML
00080 // 
00081 //
00082 // 
00083 //
00084 class CzTemplateFrom : public IzXomlResource
00085 {
00086 public:
00087 protected:
00088     // Properties
00089 public:
00090     // Properties end
00091 protected:
00092 
00093 public:
00094     CzTemplateFrom() : IzXomlResource() { setClassType("fromtemplate"); }
00095     // Implementation of IzXomlClass interface
00096     int                 LoadFromXoml(IzXomlResource* parebt, bool load_children, CzXmlNode* node);
00097 };
00098 
00099 class CzTemplateFromCreator : public IzXomlClassCreator
00100 {
00101 public:
00102     CzTemplateFromCreator()
00103     {
00104         setClassName("fromtemplate");
00105     }
00106     IzXomlResource* CreateInstance(IzXomlResource* parent)  { return new CzTemplateFrom(); }
00107 };
00108 
00109 
00110 
00111 
00112 #endif // _CZ_TEMPLATES_H_