Use this class to read setting from resource. More...
#include <XRes.h>
Public Member Functions | |||||
| XRes (XCongo *xcongo, const char *repName, int resId=XCongo::ID_STATIC) | |||||
| Create resoucse from configuation object. | |||||
| XRes (XRes *xres, const char *repName, int resId=XCongo::ID_STATIC) | |||||
| Create sub-resource from resource object. | |||||
| ~XRes () | |||||
| XRes (XCongo *xcongo, const char *repName, int resId=XCongo::ID_STATIC) | |||||
| Create resoucse from configuation object. | |||||
| XRes (XRes *xres, const char *repName, int resId=XCongo::ID_STATIC) | |||||
| Create sub-resource from resource object. | |||||
| ~XRes () | |||||
Resource Variable Accessors All methods in this group has the same first argument and return value
| |||||
| bool | IntValue (const char *name, int *val) | ||||
| Query Integer value. | |||||
| bool | StringValue (const char *name, char **val) | ||||
| Query String value. | |||||
| bool | DoubleValue (const char *name, double *val) | ||||
| Query Double value. | |||||
Resource Variable Accessors All methods in this group has the same first argument and return value
| |||||
| bool | IntValue (const char *name, int *val) | ||||
| Query Integer value. | |||||
| bool | StringValue (const char *name, char **val) | ||||
| Query String value. | |||||
| bool | DoubleValue (const char *name, double *val) | ||||
| Query Double value. | |||||
Private Attributes | |||||
Initialization Attributes | |||||
Bellow attributes are used for initilization only and hidden afterwards. After creation resource is opaque to it's users. | |||||
| XCongo * | mpXCongo | ||||
| Parent of this resource. | |||||
| int | mResId | ||||
| Used when Resource is part of array container. | |||||
| char * | mRepName | ||||
| Name of resource parent. | |||||
Use this class to read setting from resource.
Resource contains initialisation data for singe object.
NAME is object property to read. Examples:
VALUE can be of type int, double and char*. In the case of char* memory for that value is allocated with new[] and user should take care for cleanup.
RESOURCE ID is integer from 0 to SizeOf(REP_NAME) including ID_STATIC. Resource ID with SizeOf function can be used as method to read array of objects from configuration files. If you want to read red component color of 3th quad you could use:
IntValue("Quads", 3, "mColor.mRed")
It is is equivalent to
IntValue("Quads[3].mColor.mRed")
| XRes::XRes | ( | XCongo * | xcongo, |
| const char * | repName, | ||
| int | resId = XCongo::ID_STATIC |
||
| ) |
Create resoucse from configuation object.
| xcongo | Configuration object. |
| repName | name of global repository in configuration object. |
| resId | Id (array index) of resource. |
XRes(xcongo, "Quads", 3) is equivalent to XRes(xcongo, "Quads[3]").
Definition at line 16 of file XRes.cpp.
References mRepName.
| XRes::XRes | ( | XRes * | xres, |
| const char * | repName, | ||
| int | resId = XCongo::ID_STATIC |
||
| ) |
| XRes::~XRes | ( | ) |
| XRes::XRes | ( | XCongo * | xcongo, |
| const char * | repName, | ||
| int | resId = XCongo::ID_STATIC |
||
| ) |
| XRes::XRes | ( | XRes * | xres, |
| const char * | repName, | ||
| int | resId = XCongo::ID_STATIC |
||
| ) |
| XRes::~XRes | ( | ) |
| bool XRes::DoubleValue | ( | const char * | name, |
| double * | val | ||
| ) |
Query Double value.
Definition at line 49 of file XRes.cpp.
References XCongo::DoubleValue(), mpXCongo, mRepName, and mResId.
Referenced by Bongo::Init(), Ball::Init(), Box::Init(), Arrow::Init(), BongoOrthoMover::Init(), BongoRealMover::Init(), and ViewController::Init().
{
return mpXCongo->DoubleValue(mRepName, mResId, name, val);
}
| bool XRes::DoubleValue | ( | const char * | name, |
| double * | val | ||
| ) |
Query Double value.
| bool XRes::IntValue | ( | const char * | name, |
| int * | val | ||
| ) |
Query Integer value.
| bool XRes::IntValue | ( | const char * | name, |
| int * | val | ||
| ) |
Query Integer value.
Definition at line 39 of file XRes.cpp.
References XCongo::IntValue(), mpXCongo, mRepName, and mResId.
Referenced by Lifetime::Init(), Bongo::Init(), Ball::Init(), Box::Init(), and Box::LoadTexture().
| bool XRes::StringValue | ( | const char * | name, |
| char ** | val | ||
| ) |
Query String value.
Definition at line 44 of file XRes.cpp.
References mpXCongo, mRepName, mResId, and XCongo::StringValue().
Referenced by Factory::CreateQuad(), Factory::CreateQuadMover(), and Box::LoadTexture().
{
return mpXCongo->StringValue(mRepName, mResId, name, val);
}
| bool XRes::StringValue | ( | const char * | name, |
| char ** | val | ||
| ) |
Query String value.
XCongo * XRes::mpXCongo [private] |
Parent of this resource.
Definition at line 109 of file XRes.h.
Referenced by DoubleValue(), IntValue(), and StringValue().
char * XRes::mRepName [private] |
Name of resource parent.
Definition at line 113 of file XRes.h.
Referenced by DoubleValue(), IntValue(), StringValue(), XRes(), and ~XRes().
int XRes::mResId [private] |
Used when Resource is part of array container.
Definition at line 111 of file XRes.h.
Referenced by DoubleValue(), IntValue(), StringValue(), and XRes().
1.8.0