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
CzUserProperty.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_USER_PROPERTY_H_)
00015 #define _CZ_USER_PROPERTY_H_
00016 
00017 #include "CzString.h"
00018 #include "CzUtil.h"
00019 #include "CzXoml.h"
00020 
00021 
00022 /**
00023  @addtogroup XOML
00024  @{
00025  */
00026 
00027 
00028 /**
00029  @class CzUserPropertyList
00030 
00031  @brief A user property list.
00032 
00033  Property lists can be added to scenes and actors to provide a mechanism for users to track and modify their own properties
00034 
00035  */
00036 
00037 class CzUserPropertyList : public IzXomlResource
00038 {
00039     // Public access to class creator iteration
00040     typedef CzList<CzXomlNamedProperty*>::iterator _Iterator;
00041     _Iterator               begin()     { return Properties.begin(); }
00042     _Iterator               end()       { return Properties.end(); }
00043 
00044 protected:
00045     CzList<CzXomlNamedProperty*>    Properties;
00046 public:
00047     CzUserPropertyList() : IzXomlResource() { setClassType("userproperties"); }
00048     ~CzUserPropertyList()   { clearProperties(); }
00049 
00050     bool                    addProperty(CzXomlNamedProperty* prop);
00051     void                    removeProperty(CzXomlNamedProperty* prop, bool destroy = true);
00052     void                    clearProperties(bool destroy = true);
00053     CzXomlNamedProperty*    findProperty(unsigned int name_hash);
00054     CzXomlNamedProperty*    findProperty(const char* name);
00055     bool                    setProperty(const char* name, const CzString& data, bool delta);
00056     bool                    setProperty(unsigned int name_hash, const CzString& data, bool delta);
00057     bool                    setPropertyToVariable(unsigned int name_hash, CzXomlVariable& var);
00058 
00059     // Implementation of IzXomlClass interface
00060     int                 LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node);
00061 };
00062 
00063 /**
00064  @class CzUserPropertyListCreator
00065 
00066  @brief Creates an instance of a user properties class.
00067 
00068  */
00069 
00070 class CzUserPropertyListCreator : public IzXomlClassCreator
00071 {
00072 public:
00073     CzUserPropertyListCreator()
00074     {
00075         setClassName("userproperties");
00076     }
00077     IzXomlResource* CreateInstance(IzXomlResource* parent)  { return new CzUserPropertyList(); }
00078 };
00079 
00080 
00081 /// @}
00082 
00083 #endif  // _CZ_USER_PROPERTY_H_