Defines a properties file for loading text files. More...
Public Types | |
enum | Type |
Data types supported by the properties class. | |
Public Member Functions | |
~Properties () | |
Destructor. | |
~Properties () | |
Destructor. | |
~Properties () | |
Destructor. | |
const char * | getNextProperty () |
Get the name of the next property. More... | |
local | getNextProperty () |
Get the name of the next property. More... | |
Properties * | getNextNamespace () |
Get the next namespace. | |
local | getNextNamespace () |
Get the next namespace. | |
void | rewind () |
Rewind the getNextProperty() and getNextNamespace() iterators to the beginning of the file. | |
Properties * | getNamespace (const char *id, bool searchNames=false, bool recurse=true) const |
Get a specific namespace by ID or name. More... | |
local | getNamespace ( local id, local false, local true) |
Get a specific namespace by ID or name. More... | |
const char * | getNamespace () const |
Get the name of this Property's namespace. More... | |
var | getNamespace () |
Get the name of this Property's namespace. More... | |
local | getNamespace () |
Get the name of this Property's namespace. More... | |
const char * | getId () const |
Get the ID of this Property's namespace. More... | |
bool | exists (const char *name) const |
Check if a property with the given name is specified in this Properties object. More... | |
var | exists ( var name) |
Check if a property with the given name is specified in this Properties object. More... | |
local | exists ( local name) |
Check if a property with the given name is specified in this Properties object. More... | |
Type | getType (const char *name=NULL) const |
Returns the type of a property. More... | |
const char * | getString (const char *name=NULL, const char *defaultValue=NULL) const |
Get the value of the given property as a string. More... | |
local | getString ( local NULL, local NULL) |
Get the value of the given property as a string. More... | |
bool | setString (const char *name, const char *value) |
Sets the value of the property with the specified name. More... | |
bool | getBool (const char *name=NULL, bool defaultValue=false) const |
Interpret the value of the given property as a boolean. More... | |
var | getBool ( var NULL, var false) |
Interpret the value of the given property as a boolean. More... | |
local | getBool ( local NULL, local false) |
Interpret the value of the given property as a boolean. More... | |
int | getInt (const char *name=NULL) const |
Interpret the value of the given property as an integer. More... | |
float | getFloat (const char *name=NULL) const |
Interpret the value of the given property as a floating-point number. More... | |
long | getLong (const char *name=NULL) const |
Interpret the value of the given property as a long integer. More... | |
var | getLong ( var NULL) |
Interpret the value of the given property as a long integer. More... | |
bool | getMat4 (const char *name, Mat4 *out) const |
Interpret the value of the given property as a Matrix. More... | |
bool | getVec2 (const char *name, Vec2 *out) const |
Interpret the value of the given property as a Vec2. More... | |
var | getVec2 ( var name, var out) |
Interpret the value of the given property as a Vec2. More... | |
local | getVec2 ( local name, local out) |
Interpret the value of the given property as a Vec2. More... | |
bool | getVec3 (const char *name, Vec3 *out) const |
Interpret the value of the given property as a Vec3. More... | |
var | getVec3 ( var name, var out) |
Interpret the value of the given property as a Vec3. More... | |
local | getVec3 ( local name, local out) |
Interpret the value of the given property as a Vec3. More... | |
bool | getVec4 (const char *name, Vec4 *out) const |
Interpret the value of the given property as a Vec4. More... | |
var | getVec4 ( var name, var out) |
Interpret the value of the given property as a Vec4. More... | |
local | getVec4 ( local name, local out) |
Interpret the value of the given property as a Vec4. More... | |
bool | getQuaternionFromAxisAngle (const char *name, Quaternion *out) const |
Interpret the value of the given property as a Quaternion specified as an axis angle. More... | |
var | getQuaternionFromAxisAngle ( var name, var out) |
Interpret the value of the given property as a Quaternion specified as an axis angle. More... | |
local | getQuaternionFromAxisAngle ( local name, local out) |
Interpret the value of the given property as a Quaternion specified as an axis angle. More... | |
bool | getColor (const char *name, Vec3 *out) const |
Interpret the value of the given property as an RGB color in hex and write this color to a Vec3. More... | |
bool | getColor (const char *name, Vec4 *out) const |
Interpret the value of the given property as an RGBA color in hex and write this color to a Vec4. More... | |
var | getColor ( var name, var out) |
Interpret the value of the given property as an RGBA color in hex and write this color to a Vec4. More... | |
local | getColor ( local name, local out) |
Interpret the value of the given property as an RGBA color in hex and write this color to a Vec4. More... | |
bool | getPath (const char *name, std::string *path) const |
Gets the file path for the given property if the file exists. More... | |
const char * | getVariable (const char *name, const char *defaultValue=NULL) const |
Returns the value of a variable that is set in this Properties object. More... | |
void | setVariable (const char *name, const char *value) |
Sets the value of the specified variable. More... | |
var | setVariable ( var name, var value) |
Sets the value of the specified variable. More... | |
local | setVariable ( local name, local value) |
Sets the value of the specified variable. More... | |
Static Public Member Functions | |
static Properties * | createNonRefCounted (const std::string &url) |
Creates a Properties runtime settings from the specified URL, where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional). More... | |
static bool | parseVec2 (const char *str, Vec2 *out) |
Attempts to parse the specified string as a Vec2 value. More... | |
local | parseVec2 ( local str, local out) |
Attempts to parse the specified string as a Vec2 value. More... | |
static bool | parseVec3 (const char *str, Vec3 *out) |
Attempts to parse the specified string as a Vec3 value. More... | |
var | parseVec3 ( var str, var out) |
Attempts to parse the specified string as a Vec3 value. More... | |
local | parseVec3 ( local str, local out) |
Attempts to parse the specified string as a Vec3 value. More... | |
static bool | parseVec4 (const char *str, Vec4 *out) |
Attempts to parse the specified string as a Vec4 value. More... | |
var | parseVec4 ( var str, var out) |
Attempts to parse the specified string as a Vec4 value. More... | |
local | parseVec4 ( local str, local out) |
Attempts to parse the specified string as a Vec4 value. More... | |
static bool | parseAxisAngle (const char *str, Quaternion *out) |
Attempts to parse the specified string as an axis-angle value. More... | |
var | parseAxisAngle ( var str, var out) |
Attempts to parse the specified string as an axis-angle value. More... | |
local | parseAxisAngle ( local str, local out) |
Attempts to parse the specified string as an axis-angle value. More... | |
static bool | parseColor (const char *str, Vec3 *out) |
Attempts to parse the specified string as an RGB color value. More... | |
var | parseColor ( var str, var out) |
Attempts to parse the specified string as an RGB color value. More... | |
local | parseColor ( local str, local out) |
Attempts to parse the specified string as an RGB color value. More... | |
static bool | parseColor (const char *str, Vec4 *out) |
Attempts to parse the specified string as an RGBA color value. More... | |
Defines a properties file for loading text files.
A properties file has very simple syntax and can contain only namespaces and name/value pairs (the properties of a namespace). The file can have any file extension a user specifies.
Here's an example of a simple file that uses all the available features of the markup language:
// This is a comment. // This property is in the default namespace: integerProperty = 5 // This line defines a namespace of type "mynamespace" without an ID: mynamespace { // This namespace can be retrieved by searching for its ID, "spriteTexture", // or by its name "texture": texture spriteTexture { fileName = sprite.png width = 64 height = 64 } // This property is in the "space" namespace: booleanProperty = true // It's legal to have a name without a value if you leave out the '=' character: foo // In fact, the '=' character is optional if you'd rather write: bar 23 // But don't write this or you'll get an error: // illegalProperty = // Or this: // = 15 // Properties objects let you retrieve values as various types. floatProperty = 3.333 stringProperty = This is a string. vector3Property = 1.0, 5.0, 3.55 colorProperty = 1.0, 0.4, 0.0, 1.0 }
Retrieving information out of a file like this could be done in two ways. If the available namespaces and name/value pairs are known in advance they can be queried by ID or name. For example, if the namespace "spriteTexture" and its properties are required then they can be retrieved with a call to getNamespace() followed by calls to getString() and getInt(). A namespace is stored and retrieved as a Properties object. Reading the spriteTexture properties out of the file above in this way could be done with the following code:
// Create the top-level Properties object. Properties* properties = Properties::createNonRefCounted("example.properties"); // Retrieve the "spriteTexture" namespace. Properties* spriteTexture = properties->getNamespace("spriteTexture"); // Get the values of known texture properties out of the namespace. const char* fileName = spriteTexture->getString("fileName"); int width = spriteTexture->getInt("width"); int height = spriteTexture->getInt("height"); // Deleting the top-level Properties object will clean up all nested namespaces. SAFE_DELETE(properties);
On the other hand, if the structure of the file is not known in advance its namespaces and name/value pairs can be retrieved one by one using the getNextNamespace() and getNextProperty() methods. The following method prints the contents of any properties file to the console:
void printProperties(Properties* properties) { // Print the name and ID of the current namespace. const char* spacename = properties->getNamespace(); const char* id = properties->getId(); GP_WARN("Namespace: %s ID: %s\n{", spacename, id); // Print all properties in this namespace. const char* name = properties->getNextProperty(); const char* value = NULL; while (name != NULL) { value = properties->getString(name); GP_WARN("%s = %s", name, value); name = properties->getNextProperty(); } GP_WARN("}\n"); // Print the properties of every namespace within this one. Properties* space = properties->getNextNamespace(); while (space != NULL) { printProperties(space); space = properties->getNextNamespace(); } }
Note that this method does not keep track of the namespace hierarchy, but could be modified to do so. Also note that nothing in a properties file indicates the type of a property. If the type is unknown, its string can be retrieved and interpreted as necessary.
|
static |
Creates a Properties runtime settings from the specified URL, where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).
The URL to create the properties from.
The created Properties or NULL if there was an error.
|
static |
Creates a Properties runtime settings from the specified URL, where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).
The URL to create the properties from.
The created Properties or NULL if there was an error.
|
static |
Creates a Properties runtime settings from the specified URL, where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).
The URL to create the properties from.
The created Properties or NULL if there was an error.
const char* getNextProperty | ( | ) |
Get the name of the next property.
If a valid next property is returned, the value of the property can be retrieved using any of the get methods in this class, passing NULL for the property name.
The name of the next property, or NULL if there are no properties remaining.
var getNextProperty | ( | ) |
Get the name of the next property.
If a valid next property is returned, the value of the property can be retrieved using any of the get methods in this class, passing NULL for the property name.
The name of the next property, or NULL if there are no properties remaining.
local getNextProperty | ( | ) |
Get the name of the next property.
If a valid next property is returned, the value of the property can be retrieved using any of the get methods in this class, passing NULL for the property name.
The name of the next property, or NULL if there are no properties remaining.
Properties* getNamespace | ( | const char * | id, |
bool | searchNames = false , |
||
bool | recurse = true |
||
) | const |
Get a specific namespace by ID or name.
This method will optionally perform a depth-first search on all namespaces and inner namespaces within this Property.
The ID or name of the namespace to find. If true, namespace names are used in the search, instead of namespace IDs. By default this parameter is false and namespace IDs are searched. If true, perform a depth-first search, otherwise search only the immediate child namespaces.
A properties object with the given ID or name.
var getNamespace | ( | var | id, |
var | searchNames = false , |
||
var | recurse = true |
||
) |
Get a specific namespace by ID or name.
This method will optionally perform a depth-first search on all namespaces and inner namespaces within this Property.
The ID or name of the namespace to find. If true, namespace names are used in the search, instead of namespace IDs. By default this parameter is false and namespace IDs are searched. If true, perform a depth-first search, otherwise search only the immediate child namespaces.
A properties object with the given ID or name.
local getNamespace | ( | local | id, |
local | searchNames = false , |
||
local | recurse = true |
||
) |
Get a specific namespace by ID or name.
This method will optionally perform a depth-first search on all namespaces and inner namespaces within this Property.
The ID or name of the namespace to find. If true, namespace names are used in the search, instead of namespace IDs. By default this parameter is false and namespace IDs are searched. If true, perform a depth-first search, otherwise search only the immediate child namespaces.
A properties object with the given ID or name.
const char* getNamespace | ( | ) | const |
Get the name of this Property's namespace.
The name of this Property's namespace.
var getNamespace | ( | ) |
Get the name of this Property's namespace.
The name of this Property's namespace.
local getNamespace | ( | ) |
Get the name of this Property's namespace.
The name of this Property's namespace.
const char* getId | ( | ) | const |
Get the ID of this Property's namespace.
The ID should be a unique identifier, but its uniqueness is not enforced.
The ID of this Property's namespace.
var getId | ( | ) |
Get the ID of this Property's namespace.
The ID should be a unique identifier, but its uniqueness is not enforced.
The ID of this Property's namespace.
local getId | ( | ) |
Get the ID of this Property's namespace.
The ID should be a unique identifier, but its uniqueness is not enforced.
The ID of this Property's namespace.
bool exists | ( | const char * | name | ) | const |
Check if a property with the given name is specified in this Properties object.
The name of the property to query.
True if the property exists, false otherwise.
var exists | ( | var | name | ) |
Check if a property with the given name is specified in this Properties object.
The name of the property to query.
True if the property exists, false otherwise.
local exists | ( | local | name | ) |
Check if a property with the given name is specified in this Properties object.
The name of the property to query.
True if the property exists, false otherwise.
Type getType | ( | const char * | name = NULL | ) | const |
Returns the type of a property.
The name of the property to interpret, or NULL to return the current property's type.
The type of the property.
var getType | ( | var | name = NULL | ) |
Returns the type of a property.
The name of the property to interpret, or NULL to return the current property's type.
The type of the property.
local getType | ( | local | name = NULL | ) |
Returns the type of a property.
The name of the property to interpret, or NULL to return the current property's type.
The type of the property.
const char* getString | ( | const char * | name = NULL , |
const char * | defaultValue = NULL |
||
) | const |
Get the value of the given property as a string.
This can always be retrieved, whatever the intended type of the property.
The name of the property to interpret, or NULL to return the current property's value. The default value to return if the specified property does not exist.
The value of the given property as a string, or the empty string if no property with that name exists.
var getString | ( | var | name = NULL , |
var | defaultValue = NULL |
||
) |
Get the value of the given property as a string.
This can always be retrieved, whatever the intended type of the property.
The name of the property to interpret, or NULL to return the current property's value. The default value to return if the specified property does not exist.
The value of the given property as a string, or the empty string if no property with that name exists.
local getString | ( | local | name = NULL , |
local | defaultValue = NULL |
||
) |
Get the value of the given property as a string.
This can always be retrieved, whatever the intended type of the property.
The name of the property to interpret, or NULL to return the current property's value. The default value to return if the specified property does not exist.
The value of the given property as a string, or the empty string if no property with that name exists.
bool setString | ( | const char * | name, |
const char * | value | ||
) |
Sets the value of the property with the specified name.
If there is no property in this namespace with the current name, one is added. Otherwise, the value of the first property with the specified name is updated.
If name is NULL, the value current property (see getNextProperty) is set, unless there is no current property, in which case false is returned.
The name of the property to set. The property value.
True if the property was set, false otherwise.
var setString | ( | var | name, |
var | value | ||
) |
Sets the value of the property with the specified name.
If there is no property in this namespace with the current name, one is added. Otherwise, the value of the first property with the specified name is updated.
If name is NULL, the value current property (see getNextProperty) is set, unless there is no current property, in which case false is returned.
The name of the property to set. The property value.
True if the property was set, false otherwise.
local setString | ( | local | name, |
local | value | ||
) |
Sets the value of the property with the specified name.
If there is no property in this namespace with the current name, one is added. Otherwise, the value of the first property with the specified name is updated.
If name is NULL, the value current property (see getNextProperty) is set, unless there is no current property, in which case false is returned.
The name of the property to set. The property value.
True if the property was set, false otherwise.
bool getBool | ( | const char * | name = NULL , |
bool | defaultValue = false |
||
) | const |
Interpret the value of the given property as a boolean.
The name of the property to interpret, or NULL to return the current property's value. the default value to return if the specified property does not exist within the properties file.
true if the property exists and its value is "true", otherwise false.
var getBool | ( | var | name = NULL , |
var | defaultValue = false |
||
) |
Interpret the value of the given property as a boolean.
The name of the property to interpret, or NULL to return the current property's value. the default value to return if the specified property does not exist within the properties file.
true if the property exists and its value is "true", otherwise false.
local getBool | ( | local | name = NULL , |
local | defaultValue = false |
||
) |
Interpret the value of the given property as a boolean.
The name of the property to interpret, or NULL to return the current property's value. the default value to return if the specified property does not exist within the properties file.
true if the property exists and its value is "true", otherwise false.
int getInt | ( | const char * | name = NULL | ) | const |
Interpret the value of the given property as an integer.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as an integer. Zero if the property does not exist or could not be scanned.
var getInt | ( | var | name = NULL | ) |
Interpret the value of the given property as an integer.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as an integer. Zero if the property does not exist or could not be scanned.
local getInt | ( | local | name = NULL | ) |
Interpret the value of the given property as an integer.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as an integer. Zero if the property does not exist or could not be scanned.
float getFloat | ( | const char * | name = NULL | ) | const |
Interpret the value of the given property as a floating-point number.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as a float. Zero if the property does not exist or could not be scanned.
var getFloat | ( | var | name = NULL | ) |
Interpret the value of the given property as a floating-point number.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as a float. Zero if the property does not exist or could not be scanned.
local getFloat | ( | local | name = NULL | ) |
Interpret the value of the given property as a floating-point number.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as a float. Zero if the property does not exist or could not be scanned.
long getLong | ( | const char * | name = NULL | ) | const |
Interpret the value of the given property as a long integer.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as a long. Zero if the property does not exist or could not be scanned.
var getLong | ( | var | name = NULL | ) |
Interpret the value of the given property as a long integer.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as a long. Zero if the property does not exist or could not be scanned.
local getLong | ( | local | name = NULL | ) |
Interpret the value of the given property as a long integer.
If the property does not exist, zero will be returned. If the property exists but could not be scanned, an error will be logged and zero will be returned.
The name of the property to interpret, or NULL to return the current property's value.
The value of the given property interpreted as a long. Zero if the property does not exist or could not be scanned.
bool getMat4 | ( | const char * | name, |
Mat4 * | out | ||
) | const |
Interpret the value of the given property as a Matrix.
If the property does not exist, out will be set to the identity matrix. If the property exists but could not be scanned, an error will be logged and out will be set to the identity matrix.
The name of the property to interpret, or NULL to return the current property's value. The matrix to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
var getMat4 | ( | var | name, |
var | out | ||
) |
Interpret the value of the given property as a Matrix.
If the property does not exist, out will be set to the identity matrix. If the property exists but could not be scanned, an error will be logged and out will be set to the identity matrix.
The name of the property to interpret, or NULL to return the current property's value. The matrix to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
local getMat4 | ( | local | name, |
local | out | ||
) |
Interpret the value of the given property as a Matrix.
If the property does not exist, out will be set to the identity matrix. If the property exists but could not be scanned, an error will be logged and out will be set to the identity matrix.
The name of the property to interpret, or NULL to return the current property's value. The matrix to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
bool getVec2 | ( | const char * | name, |
Vec2 * | out | ||
) | const |
Interpret the value of the given property as a Vec2.
If the property does not exist, out will be set to Vec2(0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec2(0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
var getVec2 | ( | var | name, |
var | out | ||
) |
Interpret the value of the given property as a Vec2.
If the property does not exist, out will be set to Vec2(0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec2(0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
local getVec2 | ( | local | name, |
local | out | ||
) |
Interpret the value of the given property as a Vec2.
If the property does not exist, out will be set to Vec2(0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec2(0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
bool getVec3 | ( | const char * | name, |
Vec3 * | out | ||
) | const |
Interpret the value of the given property as a Vec3.
If the property does not exist, out will be set to Vec3(0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec3(0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
var getVec3 | ( | var | name, |
var | out | ||
) |
Interpret the value of the given property as a Vec3.
If the property does not exist, out will be set to Vec3(0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec3(0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
local getVec3 | ( | local | name, |
local | out | ||
) |
Interpret the value of the given property as a Vec3.
If the property does not exist, out will be set to Vec3(0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec3(0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
bool getVec4 | ( | const char * | name, |
Vec4 * | out | ||
) | const |
Interpret the value of the given property as a Vec4.
If the property does not exist, out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
var getVec4 | ( | var | name, |
var | out | ||
) |
Interpret the value of the given property as a Vec4.
If the property does not exist, out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
local getVec4 | ( | local | name, |
local | out | ||
) |
Interpret the value of the given property as a Vec4.
If the property does not exist, out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
bool getQuaternionFromAxisAngle | ( | const char * | name, |
Quaternion * | out | ||
) | const |
Interpret the value of the given property as a Quaternion specified as an axis angle.
If the property does not exist, out will be set to Quaternion(). If the property exists but could not be scanned, an error will be logged and out will be set to Quaternion().
The name of the property to interpret, or NULL to return the current property's value. The quaternion to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
var getQuaternionFromAxisAngle | ( | var | name, |
var | out | ||
) |
Interpret the value of the given property as a Quaternion specified as an axis angle.
If the property does not exist, out will be set to Quaternion(). If the property exists but could not be scanned, an error will be logged and out will be set to Quaternion().
The name of the property to interpret, or NULL to return the current property's value. The quaternion to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
local getQuaternionFromAxisAngle | ( | local | name, |
local | out | ||
) |
Interpret the value of the given property as a Quaternion specified as an axis angle.
If the property does not exist, out will be set to Quaternion(). If the property exists but could not be scanned, an error will be logged and out will be set to Quaternion().
The name of the property to interpret, or NULL to return the current property's value. The quaternion to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
bool getColor | ( | const char * | name, |
Vec3 * | out | ||
) | const |
Interpret the value of the given property as an RGB color in hex and write this color to a Vec3.
E.g. 0xff0000 represents red and sets the vector to (1, 0, 0). If the property does not exist, out will be set to Vec3(0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec3(0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
var getColor | ( | var | name, |
var | out | ||
) |
Interpret the value of the given property as an RGB color in hex and write this color to a Vec3.
E.g. 0xff0000 represents red and sets the vector to (1, 0, 0). If the property does not exist, out will be set to Vec3(0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec3(0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
local getColor | ( | local | name, |
local | out | ||
) |
Interpret the value of the given property as an RGB color in hex and write this color to a Vec3.
E.g. 0xff0000 represents red and sets the vector to (1, 0, 0). If the property does not exist, out will be set to Vec3(0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec3(0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
bool getColor | ( | const char * | name, |
Vec4 * | out | ||
) | const |
Interpret the value of the given property as an RGBA color in hex and write this color to a Vec4.
E.g. 0xff0000ff represents opaque red and sets the vector to (1, 0, 0, 1). If the property does not exist, out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
var getColor | ( | var | name, |
var | out | ||
) |
Interpret the value of the given property as an RGBA color in hex and write this color to a Vec4.
E.g. 0xff0000ff represents opaque red and sets the vector to (1, 0, 0, 1). If the property does not exist, out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
local getColor | ( | local | name, |
local | out | ||
) |
Interpret the value of the given property as an RGBA color in hex and write this color to a Vec4.
E.g. 0xff0000ff represents opaque red and sets the vector to (1, 0, 0, 1). If the property does not exist, out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f). If the property exists but could not be scanned, an error will be logged and out will be set to Vec4(0.0f, 0.0f, 0.0f, 0.0f).
The name of the property to interpret, or NULL to return the current property's value. The vector to set to this property's interpreted value.
True on success, false if the property does not exist or could not be scanned.
bool getPath | ( | const char * | name, |
std::string * | path | ||
) | const |
Gets the file path for the given property if the file exists.
This method will first search for the file relative to the working directory. If the file is not found then it will search relative to the directory the bundle file is in.
The name of the property. The string to copy the path to if the file exists.
True if the property exists and the file exists, false otherwise.
var getPath | ( | var | name, |
var | path | ||
) |
Gets the file path for the given property if the file exists.
This method will first search for the file relative to the working directory. If the file is not found then it will search relative to the directory the bundle file is in.
The name of the property. The string to copy the path to if the file exists.
True if the property exists and the file exists, false otherwise.
local getPath | ( | local | name, |
local | path | ||
) |
Gets the file path for the given property if the file exists.
This method will first search for the file relative to the working directory. If the file is not found then it will search relative to the directory the bundle file is in.
The name of the property. The string to copy the path to if the file exists.
True if the property exists and the file exists, false otherwise.
const char* getVariable | ( | const char * | name, |
const char * | defaultValue = NULL |
||
) | const |
Returns the value of a variable that is set in this Properties object.
Variables take on the format ${name} and are inherited from parent Property objects.
Name of the variable to get. Value to return if the variable is not found.
The value of the specified variable, or defaultValue if not found.
var getVariable | ( | var | name, |
var | defaultValue = NULL |
||
) |
Returns the value of a variable that is set in this Properties object.
Variables take on the format ${name} and are inherited from parent Property objects.
Name of the variable to get. Value to return if the variable is not found.
The value of the specified variable, or defaultValue if not found.
local getVariable | ( | local | name, |
local | defaultValue = NULL |
||
) |
Returns the value of a variable that is set in this Properties object.
Variables take on the format ${name} and are inherited from parent Property objects.
Name of the variable to get. Value to return if the variable is not found.
The value of the specified variable, or defaultValue if not found.
void setVariable | ( | const char * | name, |
const char * | value | ||
) |
Sets the value of the specified variable.
Name of the variable to set. The value to set.
var setVariable | ( | var | name, |
var | value | ||
) |
Sets the value of the specified variable.
Name of the variable to set. The value to set.
local setVariable | ( | local | name, |
local | value | ||
) |
Sets the value of the specified variable.
Name of the variable to set. The value to set.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Attempts to parse the specified string as an axis-angle value.
The specified string is expected to contain four comma-separated values, where the first three values represents the axis and the fourth value represents the angle, in degrees.
On error, false is returned and the output is set to all zero values.
The string to parse. A Quaternion populated with the orientation of the axis-angle, if successful.
True if a valid axis-angle was parsed, false otherwise.
|
static |
Attempts to parse the specified string as an axis-angle value.
The specified string is expected to contain four comma-separated values, where the first three values represents the axis and the fourth value represents the angle, in degrees.
On error, false is returned and the output is set to all zero values.
The string to parse. A Quaternion populated with the orientation of the axis-angle, if successful.
True if a valid axis-angle was parsed, false otherwise.
|
static |
Attempts to parse the specified string as an axis-angle value.
The specified string is expected to contain four comma-separated values, where the first three values represents the axis and the fourth value represents the angle, in degrees.
On error, false is returned and the output is set to all zero values.
The string to parse. A Quaternion populated with the orientation of the axis-angle, if successful.
True if a valid axis-angle was parsed, false otherwise.
|
static |
Attempts to parse the specified string as an RGB color value.
The string to parse. The value to populate if successful.
True if a valid RGB color was parsed, false otherwise.
|
static |
Attempts to parse the specified string as an RGB color value.
The string to parse. The value to populate if successful.
True if a valid RGB color was parsed, false otherwise.
|
static |
Attempts to parse the specified string as an RGB color value.
The string to parse. The value to populate if successful.
True if a valid RGB color was parsed, false otherwise.
|
static |
Attempts to parse the specified string as an RGBA color value.
The string to parse. The value to populate if successful.
True if a valid RGBA color was parsed, false otherwise.
|
static |
Attempts to parse the specified string as an RGBA color value.
The string to parse. The value to populate if successful.
True if a valid RGBA color was parsed, false otherwise.
|
static |
Attempts to parse the specified string as an RGBA color value.
The string to parse. The value to populate if successful.
True if a valid RGBA color was parsed, false otherwise.