![]() |
AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
Base class that is used by all classes that can be instantiated from XOML markup. More...
#include <CzXomlResource.h>
Public Types | |
enum | eSetPropertyError { NotFound = 0, Success = 1, SearchForResource = 2, IncompatibleTypes = -1, NoAccess = -2 } |
Values that represent a SetProperty error. More... | |
Public Member Functions | |
void | setParent (CzXomlResourceManager *parent) |
CzXomlResourceManager * | getParent () |
void | setName (const char *name) |
Sets the name of the resource. Note that resource names should be unique across the same resource type. For example, two images should not share the same name. | |
CzString & | getName () |
void | setDebugInfo (const char *info) |
CzString & | getDebugInfo () |
unsigned int | getNameHash () |
void | setClassType (const char *type_name) |
Sets the class type. | |
unsigned int | getClassTypeHash () |
void | setActualClassType (const char *type_name) |
Sets the actual class type. | |
unsigned int | getActualClassTypeHash () |
void | setTag (const char *Tag) |
Sets the resource group tag. | |
unsigned int | getTagHash () |
void | setManaged (bool managed) |
bool | isManaged () const |
void | setContainer (IzXomlResource *container) |
IzXomlResource * | getContainer () |
IzXomlResource () | |
virtual | ~IzXomlResource () |
virtual int | LoadFromXoml (IzXomlResource *parent, bool load_children, CzXmlNode *node)=0 |
virtual bool | PostLoadFromXoml (IzXomlResource *parent, CzXmlNode *node) |
virtual void | Remove () |
Removes and destroys this resource. | |
Static Public Member Functions | |
static int | setProperty (CzXomlClassDef *class_def, IzXomlResource *target, unsigned int property_name, const CzString &data, bool delta) |
Sets the named property of the specified target resource. | |
static int | setProperty (CzXomlClassDef *class_def, IzXomlResource *target, unsigned int property_name, const CzXomlProperty &prop, bool delta) |
Sets the named property of the specified target resource. | |
static int | setProperty (CzXomlClassDef *class_def, IzAnimTarget *target, CzAnimInstance *animation) |
Updates property from supplied animation. | |
static int | setProperty (CzXomlClassDef *class_def, IzXomlResource *target, unsigned int property_name, CzXomlVariable *variable) |
Sets the named property of the specified target resource from a variable. | |
static int | getProperty (CzXomlClassDef *class_def, IzXomlResource *target, unsigned int property_name, CzXomlProperty &prop) |
Gets the named property of the resource. | |
Protected Attributes | |
CzString | Name |
Resource name (unique per resource type) | |
CzString | DebugInfo |
Filename and line number for debug info. | |
CzXomlResourceManager * | Parent |
Parent manager. | |
bool | Managed |
True if managed by the resource system. Managed resources are auto cleaned up by the resource system. | |
unsigned int | NameHash |
Resource name hash. | |
unsigned int | ClassTypeHash |
Base type of XOML class (e.g. Scene, Actor, Animation, Game etc..) | |
unsigned int | ActualClassTypeHash |
Actual type of XOML class. | |
unsigned int | TagHash |
Tag name as a string hash, used to put resources into loading groups. | |
IzXomlResource * | Container |
The resource that acts as the container for this resource. |
Base class that is used by all classes that can be instantiated from XOML markup.
All classes that can be created from XOML are derived from IzXomlResource. IzXomlResource provides the base details of the XOML resource including:
Each class that is derived from IzXomlResource must have a creator which is a class derived from IzXomlClassCreator which creates an instance of our XOML class. The creator class is a very simple class as is shown by the scene creator class example below:
class CzSceneCreator : public IzXomlClassCreator { public: CzSceneCreator() { setClassName("scene"); } IzXomlResource* CreateInstance(IzXomlResource* parent) { return new CzScene(); } };
To create a class that can be instantiated from XOML you should:
Values that represent a SetProperty error.
NotFound - The requested property was not found Success - Property was set successfully IncompatibleTypes - The supplied data is not compatible with the target property type ReadOnly - The property is read only SearchForResource - The property that was supplied is of type string but the target property is a resuorce. If this occurs then usually the caller will search for the resuorce
IzXomlResource::IzXomlResource | ( | ) | [inline] |
virtual IzXomlResource::~IzXomlResource | ( | ) | [inline, virtual] |
unsigned int IzXomlResource::getActualClassTypeHash | ( | ) | [inline] |
unsigned int IzXomlResource::getClassTypeHash | ( | ) | [inline] |
IzXomlResource* IzXomlResource::getContainer | ( | ) | [inline] |
CzString& IzXomlResource::getDebugInfo | ( | ) | [inline] |
CzString& IzXomlResource::getName | ( | ) | [inline] |
unsigned int IzXomlResource::getNameHash | ( | ) | [inline] |
CzXomlResourceManager* IzXomlResource::getParent | ( | ) | [inline] |
Reimplemented in CzAnimTimeline, and CzScene.
int IzXomlResource::getProperty | ( | CzXomlClassDef * | class_def, |
IzXomlResource * | target, | ||
unsigned int | property_name, | ||
CzXomlProperty & | prop | ||
) | [static] |
Gets the named property of the resource.
Returns the named property of the scene. The properties value is returned in a CzXomlProperty which is a structure that contains a union of all possible property types.
[in] | class_def | If non-null, class definition used to determine properties. |
[in] | target | If non-null, target resource that contains the property. |
property_name | Name of the target element as a string hash (faster searching). | |
[out] | prop | The output property. |
unsigned int IzXomlResource::getTagHash | ( | ) | [inline] |
bool IzXomlResource::isManaged | ( | ) | const [inline] |
virtual int IzXomlResource::LoadFromXoml | ( | IzXomlResource * | parent, |
bool | load_children, | ||
CzXmlNode * | node | ||
) | [pure virtual] |
Implemented in CzActor, CzScene, CzAnimTimeline, CzXomlAddVariable, CzAnim, CzActions, CzActorParticles, CzDataFile, CzApp, CzProgram, CzUIBase, CzUITabBar, CzBox2dJoints, CzUIGrid, CzCamera, CzUIListBox, CzXomlTimer, CzUITabs, CzImage, CzScript, CzRemoteReq, CzModifierManager, CzActorImage, CzActorText, CzGeometry, CzSound, CzTemplateFrom, CzMarket, CzUIWebView, CzActorConnector, CzUIImageView, CzVideo, CzUISlider, CzUITextView, CzShape, CzUILabel, CzXomlBindings, CzFont, CzVideoCam, CzStyle, CzActorTilemap, CzBox2dMaterial, CzUITab, CzFacebook, CzUserPropertyList, CzUITextBox, CzUIVideoOverlay, IzBrush, CzUIStackPanel, CzTemplate, CzXomlLoad, CzUIWrapPanel, CzUICanvas, and CzBox2dFixtures.
virtual bool IzXomlResource::PostLoadFromXoml | ( | IzXomlResource * | parent, |
CzXmlNode * | node | ||
) | [inline, virtual] |
void IzXomlResource::Remove | ( | ) | [virtual] |
Removes and destroys this resource.
Reimplemented in CzAnimTimeline.
void IzXomlResource::setActualClassType | ( | const char * | type_name | ) |
Sets the actual class type.
The actual class type is the actual name of the class without the Cz. For example CzAxtorImage would be actually called ActorImage and this is how it would be referred to in XOML.
type_name | Name of the type. |
void IzXomlResource::setClassType | ( | const char * | type_name | ) |
Sets the class type.
The class type is used to dtermine what type of category the class belongs to (e.g. Scene, Actor, Animation, Game etc..)
type_name | Class tyoe name. |
void IzXomlResource::setContainer | ( | IzXomlResource * | container | ) | [inline] |
void IzXomlResource::setDebugInfo | ( | const char * | info | ) | [inline] |
void IzXomlResource::setManaged | ( | bool | managed | ) | [inline] |
void IzXomlResource::setName | ( | const char * | name | ) |
Sets the name of the resource. Note that resource names should be unique across the same resource type. For example, two images should not share the same name.
name | Resource name. |
void IzXomlResource::setParent | ( | CzXomlResourceManager * | parent | ) | [inline] |
int IzXomlResource::setProperty | ( | CzXomlClassDef * | class_def, |
IzXomlResource * | target, | ||
unsigned int | property_name, | ||
const CzString & | data, | ||
bool | delta | ||
) | [static] |
Sets the named property of the specified target resource.
Sets the named property of this object. The properties value (data) is supplied as a string and will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced.
[in] | class_def | If non-null, class definition used to determine properties |
[in,out] | target | If non-null, target resource that contains the property. |
property_name | Name of the target element as a string hash (faster searching). | |
[in] | data | The data to set to the property. |
delta | true if property should be added to instead of replaced. |
int IzXomlResource::setProperty | ( | CzXomlClassDef * | class_def, |
IzXomlResource * | target, | ||
unsigned int | property_name, | ||
const CzXomlProperty & | prop, | ||
bool | delta | ||
) | [static] |
Sets the named property of the specified target resource.
Sets the named property of this object. The properties value (data) is supplied as a property and will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced. if the class property is of type PT_Resource and the supplied property value is of type string then the this method will return SearchForResource which informs the caller to take the supplied property value as a string that contains the named string and shoudl search for it
Note that only the following automatic type conversions are supported:
[in] | class_def | If non-null, class definition used to determine properties. |
[in,out] | target | If non-null, target resource that contains the property. |
property_name | Name of the target element as a string hash (faster searching). | |
[in] | prop | The data to set to the property. |
delta | true if property should be added to instead of replaced. |
int IzXomlResource::setProperty | ( | CzXomlClassDef * | class_def, |
IzAnimTarget * | target, | ||
CzAnimInstance * | animation | ||
) | [static] |
Updates property from supplied animation.
Sets the property that is specified by the supplied animation. When a timeline animation targets the property of the object this method will be called by the animation to move the animations frame data into its target property.
Note that only the following automatic type conversions are supported:
[in,out] | class_def | If non-null, class definition used to determine properties. |
[in,out] | target | If non-null, target resource that contains the property. |
[in] | animation | If non-null, the animation. |
int IzXomlResource::setProperty | ( | CzXomlClassDef * | class_def, |
IzXomlResource * | target, | ||
unsigned int | property_name, | ||
CzXomlVariable * | variable | ||
) | [static] |
Sets the named property of the specified target resource from a variable.
Sets the named property of this object. The properties value (data) is supplied as a variable and will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced.
Note that only the following automatic type conversions are supported:
[in] | class_def | If non-null, class definition used to determine properties. |
[in,out] | target | If non-null, target resource that contains the property. |
property_name | Name of the target element as a string hash (faster searching). | |
[in,out] | variable | If non-null, the suorce variable. |
void IzXomlResource::setTag | ( | const char * | Tag | ) |
Sets the resource group tag.
Its often useful to be able to determine which group certain resources belong to. For example, you may load a group of resources into the global resource manager but later want to remove them. To save having to individually remove each resource you could remove all of those that fit into a specific group.
Tag | The tag. |
unsigned int IzXomlResource::ActualClassTypeHash [protected] |
Actual type of XOML class.
unsigned int IzXomlResource::ClassTypeHash [protected] |
Base type of XOML class (e.g. Scene, Actor, Animation, Game etc..)
IzXomlResource* IzXomlResource::Container [protected] |
The resource that acts as the container for this resource.
CzString IzXomlResource::DebugInfo [protected] |
Filename and line number for debug info.
bool IzXomlResource::Managed [protected] |
True if managed by the resource system. Managed resources are auto cleaned up by the resource system.
CzString IzXomlResource::Name [protected] |
Resource name (unique per resource type)
unsigned int IzXomlResource::NameHash [protected] |
Resource name hash.
CzXomlResourceManager* IzXomlResource::Parent [protected] |
Parent manager.
Reimplemented in CzAnimTimeline, and CzScene.
unsigned int IzXomlResource::TagHash [protected] |
Tag name as a string hash, used to put resources into loading groups.