#include <tb_dynamic_structure.hpp>
Public Types | |
typedef std::vector< DynamicStructure > | ArrayContainer |
typedef std::map< tbCore::tbString, DynamicStructure > | StructureContainer |
Public Member Functions | |
DynamicStructure (void) | |
DynamicStructure (const int &integerValue) | |
DynamicStructure (const tbCore::int64 &integerValue) | |
DynamicStructure (const size_t &intergerValue) | |
DynamicStructure (const float &floatValue) | |
DynamicStructure (const bool &booleanValue) | |
DynamicStructure (const tbCore::tbString &stringValue) | |
DynamicStructure (const char *stringValue) | |
template<typename Type > | |
DynamicStructure (std::initializer_list< const Type > arguments) | |
DynamicStructure (std::initializer_list< std::pair< const tbCore::tbString, const DynamicStructure >> arguments) | |
DynamicStructure (const DynamicStructure &other) | |
DynamicStructure (DynamicStructure &&other) | |
DynamicStructure & | operator= (const DynamicStructure &other) |
DynamicStructure & | operator= (DynamicStructure &&other) |
~DynamicStructure (void) | |
bool | IsNil (void) const |
bool | IsArray (void) const |
bool | IsStructure (void) const |
bool | IsInteger (void) const |
bool | IsFloat (void) const |
bool | IsBoolean (void) const |
bool | IsString (void) const |
tbCore::int64 | AsInteger (bool implicitConversion=kImplicitConversions) const |
template<typename Type > | |
Type | AsRangedInteger (const tbCore::tbString &errorMessage="Out of Range", const Type minimumValue=std::numeric_limits< Type >::min(), const Type maximumValue=std::numeric_limits< Type >::max(), bool implicitConversion=kImplicitConversions) const |
template<typename Type > | |
Type | AsRangedIntegerWithDefault (const tbCore::tbString &errorMessage, const Type &defaultValue, const Type minimumValue=std::numeric_limits< Type >::min(), const Type maximumValue=std::numeric_limits< Type >::max(), bool implicitConversion=kImplicitConversions) const |
float | AsFloat (bool implicitConversion=kImplicitConversions) const |
bool | AsBoolean (bool implicitConversion=kImplicitConversions) const |
tbCore::tbString | AsString (bool implicitConversion=kImplicitConversions) const |
tbCore::int64 | AsIntegerWithDefault (const tbCore::int64 &defaultValue, bool implicitConversion=true) const |
template<typename Type > | |
Type | AsRangedIntegerWithDefault (const Type &defaultValue, const tbCore::tbString &errorMessage, const Type minimumValue=std::numeric_limits< Type >::min(), const Type maximumValue=std::numeric_limits< Type >::max()) const |
float | AsFloatWithDefault (const float defaultValue, bool implicitConversion=true) const |
bool | AsBooleanWithDefault (const bool defaultValue, bool implicitConversion=true) const |
tbCore::tbString | AsStringWithDefault (const tbCore::tbString &defaultValue, bool implicitConversion=true) const |
void | SetValue (const int &integerValue, bool implicitTypeChange=kImplicitTypeChange) |
void | SetValue (const tbCore::int64 &integerValue, bool implicitTypeChange=kImplicitTypeChange) |
void | SetValue (const float &floatValue, bool implicitTypeChange=kImplicitTypeChange) |
void | SetValue (const bool &booleanValue, bool implicitTypeChange=kImplicitTypeChange) |
void | SetValue (const tbCore::tbString &stringValue, bool implicitTypeChange=kImplicitTypeChange) |
template<typename Type > | |
const DynamicStructure & | operator[] (const Type &nameOrIndex) const |
template<typename Type > | |
DynamicStructure & | operator[] (const Type &nameOrIndex) |
DynamicStructure & | PushValue (const DynamicStructure &value) |
const DynamicStructure & | GetValue (const tbCore::uint64 &arrayIndex) const |
DynamicStructure & | GetValue (const tbCore::uint64 &arrayIndex) |
size_t | ArraySize (void) const |
size_t | size (void) const |
ArrayContainer::const_iterator | BeginArray (void) const |
ArrayContainer::iterator | BeginArray (void) |
ArrayContainer::const_iterator | begin (void) const |
ArrayContainer::iterator | begin (void) |
ArrayContainer::const_iterator | EndArray (void) const |
ArrayContainer::iterator | EndArray (void) |
ArrayContainer::const_iterator | end (void) const |
ArrayContainer::iterator | end (void) |
const ArrayContainer & | AsArray (void) const |
ArrayContainer & | AsArray (void) |
DynamicStructure & | AddMember (const tbCore::tbString &memberName, const DynamicStructure &memberValue) |
DynamicStructure & | SetMember (const tbCore::tbString &memberName, const DynamicStructure &memberValue) |
const DynamicStructure & | GetMember (const tbCore::tbString &memberName) const |
DynamicStructure & | GetMember (const tbCore::tbString &memberName) |
size_t | StructureSize (void) const |
StructureContainer::const_iterator | BeginStructure (void) const |
StructureContainer::iterator | BeginStructure (void) |
StructureContainer::const_iterator | EndStructure (void) const |
StructureContainer::iterator | EndStructure (void) |
const StructureContainer & | AsStructure (void) const |
StructureContainer & | AsStructure (void) |
operator tbCore::int64 () const | |
operator int () const | |
operator float () const | |
operator bool () const | |
operator tbCore::tbString () const | |
bool | operator== (const DynamicStructure &rightSide) const |
bool | operator!= (const DynamicStructure &rightSide) const |
Static Public Attributes | |
static const DynamicStructure | kNullValue |
static const tbCore::tbString | kNullAsString |
static const tbCore::tbString | kTrueAsString |
static const tbCore::tbString | kFalseAsString |
static const unsigned int | kInvalidSize |
static const bool | kImplicitConversions |
static const bool | kImplicitTypeChange |
static const float | kFloatElipson |
Friends | |
void | WriteBinary (const tbCore::DynamicStructure &data, std::ostream &output) |
tbCore::DynamicStructure | ReadBinary (std::istream &input) |
Provide a simple interface for creating structures that can be changed dynamically, for file loading, scripting and other exchanges of complex objects or structures in a semi defined manner.
typedef std::vector<DynamicStructure> TurtleBrains::Core::DynamicStructure::ArrayContainer |
TODO: TIM: InternalDoc: This is a TurtleBrains implementation detail, and should be documented as such.
typedef std::map<tbCore::tbString, DynamicStructure> TurtleBrains::Core::DynamicStructure::StructureContainer |
TODO: TIM: InternalDoc: This is a TurtleBrains implementation detail, and should be documented as such.
TurtleBrains::Core::DynamicStructure::DynamicStructure | ( | void | ) |
Creates an empty "Nil" structure with no values or data contained.
TurtleBrains::Core::DynamicStructure::DynamicStructure | ( | const int & | integerValue | ) |
Creates a DynamicStructure object from an integer value that will represent the integer.
TurtleBrains::Core::DynamicStructure::DynamicStructure | ( | const float & | floatValue | ) |
Creates a DynamicStructure object from a float value that will represent the float.
TurtleBrains::Core::DynamicStructure::DynamicStructure | ( | const bool & | booleanValue | ) |
Creates a DynamicStructure object from a boolean value that will represent the boolean.
TurtleBrains::Core::DynamicStructure::DynamicStructure | ( | const tbCore::tbString & | stringValue | ) |
Creates a DynamicStructure object from a string value that will contain and represent the string.
TurtleBrains::Core::DynamicStructure::DynamicStructure | ( | const char * | stringValue | ) |
Creates a DynamicStructure object from a string value that will contain and represent the string.
|
inline |
Creates a DynamicStructure array from a list of values so that initialization from within code can look/act very close to the json it resembles:
tbCore::DynamicStructure object = { { "names", { "TimBeaudet", "shakesoda", "tsjost" } }, { "numbers", { 42, 8, 35, 10 } }, };
arguments | The initializer list to initialize the array from. |
TurtleBrains::Core::DynamicStructure::DynamicStructure | ( | std::initializer_list< std::pair< const tbCore::tbString, const DynamicStructure >> | arguments | ) |
Creates a DynamicStructure object from key-value pairs so that initialization from within code can look/act very close to the json it resembles:
tbCore::DynamicStructure object = { { "name", "TimBeaudet" }, { "fortyTwo", 42 }, { "pi", 3.14159f }, { "valid", true, } };
arguments | The initializer list to initialize the object from. |
TurtleBrains::Core::DynamicStructure::DynamicStructure | ( | const DynamicStructure & | other | ) |
Creates a DynamicStruction object from an existing object. Because the objects can be quite large and complex, this could potentially use a fair bit of memory or copy overhead.
TurtleBrains::Core::DynamicStructure::~DynamicStructure | ( | void | ) |
Cleans up after the DynamicStructure which for simple objects does not require any cleanup but for strings, arrays or structure objects can involve deleting any memory allocated during the lifespan of the structure, and any child structure as well.
DynamicStructure& TurtleBrains::Core::DynamicStructure::AddMember | ( | const tbCore::tbString & | memberName, |
const DynamicStructure & | memberValue | ||
) |
Attempts to add a member with name and value to an object with type Structure or Nil. Any other types will cause an error condition to be triggered. If the type is Nil, the type will become Structure and the first member will be added. If a value already exists for the member an error condition will be triggered. A reference to the added value object will then be returned.
memberName | The name of the member to be able to retrieve the value later. If a value with the memberName has already been added to the Structure an error condition will be triggered. |
memberValue | The value of the member which will be retrieved by it's name. |
size_t TurtleBrains::Core::DynamicStructure::ArraySize | ( | void | ) | const |
Returns the number of values contained within an array type structure. If the type is NOT an array-type then 0 will be returned so a loop could be used on an Array type without checking that the array object was valid.
const ArrayContainer& TurtleBrains::Core::DynamicStructure::AsArray | ( | void | ) | const |
Returns the underlying structure type for the array object. This should only be used to iterate over the items in an array object.
for (const DynamicStructure& object : myArrayObject.AsArray() { ... }
ArrayContainer& TurtleBrains::Core::DynamicStructure::AsArray | ( | void | ) |
Returns the underlying structure type for the array object. This should only be used to iterate over the items in an array object.
for (const DynamicStructure& object : myArrayObject.AsArray() { ... }
bool TurtleBrains::Core::DynamicStructure::AsBoolean | ( | bool | implicitConversion = kImplicitConversions | ) | const |
Gets the value of the object as a bool using implicit conversions if allowed, otherwise an error condition will be triggered if the Type is not a bool and implicitConversion is false.
implicitConversion | Set to true to allow other basic types (Integer, Float, String, Nil) to convert to an integer value automatically. If false, no conversion will be attempted and an error condition will be triggered. |
bool TurtleBrains::Core::DynamicStructure::AsBooleanWithDefault | ( | const bool | defaultValue, |
bool | implicitConversion = true |
||
) | const |
First checks to make sure the type of the object is a boolean, then returns the value as a boolean without any conversions*. If the type is not a boolean the defaultValue will be returned.
defaultValue | The boolean value to return if the type is not specifically a boolean, even if the type could be implicitly converted. |
implicitConversion | Set to true to allow other basic types (Bool, Integer, Float) to convert to an integer value automatically, although a Nil value will return default. If false, no conversion will be attempted and the defaultValue will be returned. |
float TurtleBrains::Core::DynamicStructure::AsFloat | ( | bool | implicitConversion = kImplicitConversions | ) | const |
Gets the value of the object as a float using implicit conversions if allowed, otherwise an error condition will be triggered if the Type is not a float and implicitConversion is false.
implicitConversion | Set to true to allow other basic types (Bool, Integer, String, Nil) to convert to an integer value automatically. If false, no conversion will be attempted and an error condition will be triggered. |
float TurtleBrains::Core::DynamicStructure::AsFloatWithDefault | ( | const float | defaultValue, |
bool | implicitConversion = true |
||
) | const |
First checks to make sure the type of the object is a float, then returns the value as a float without any conversions*. If the type is not a float the defaultValue will be returned.
defaultValue | The float value to return if the type is not specifically a float, even if the type could be implicitly converted. |
implicitConversion | Set to true to allow other basic types (Bool, Integer, Float) to convert to an integer value automatically, although a Nil value will return default. If false, no conversion will be attempted and the defaultValue will be returned. |
tbCore::int64 TurtleBrains::Core::DynamicStructure::AsInteger | ( | bool | implicitConversion = kImplicitConversions | ) | const |
Gets the value of the object as an integer using implicit conversions if allowed, otherwise an error condition will be triggered if the Type is not an integer and implicitConversion is false.
implicitConversion | Set to true to allow other basic types (Bool, Float, String, Nil) to convert to an integer value automatically. If false, no conversion will be attempted and an error condition will be triggered. |
tbCore::int64 TurtleBrains::Core::DynamicStructure::AsIntegerWithDefault | ( | const tbCore::int64 & | defaultValue, |
bool | implicitConversion = true |
||
) | const |
First checks to make sure the type of the object is an integer, then returns the value as an integer without any conversions*. If the type is not an integer the defaultValue will be returned.
defaultValue | The integer value to return if the type is not specifically an integer, even if the type could be implicitly converted. |
implicitConversion | Set to true to allow other basic types (Bool, Integer, Float) to convert to an integer value automatically, although a Nil value will return default. If false, no conversion will be attempted and the defaultValue will be returned. |
|
inline |
First grabs the integer value by calling AsInteger, (using implicit conversion if allowed) then checks the range with minimum and maximum value parameters that default to min/max of the type, throwing the errorMessage if it fails to match range.
errorMessage | The message to display if the values range is less than min or greater than max. An additional string will be added to the end showing the expected range. |
minimumValue | This is the inclusive minimum value of the range. Passes when value is >= minimum. This will default to the minimum value supported by the Type as given by std::numeric_limits. |
maximumValue | This is the inclusive maximum value of the range. Passes when value is <= maximum. This will default to the maximum value supported by the Type as given by std::numeric_limits. |
implicitConversion | Set to true to allow other basic types (Bool, Float, String, Nil) to convert to an integer value automatically. If false, no conversion will be attempted and an error condition will be triggered. |
|
inline |
First grabs the integer value by calling AsIntegerWithDefault, (ensuring the object is an integer) then checks the range with minimum and maximum value parameters that default to min/max of the type, throwing the errorMessage if it fails to match range.
defaultValue | The integer value to return if the type is not specifically an integer, even if the type could be implicitly converted. |
errorMessage | The message to display if the values range is less than min or greater than max. An additional string will be added to the end showing the expected range. |
minimumValue | This is the inclusive minimum value of the range. Passes when value is >= minimum. This will default to the minimum value supported by the Type as given by std::numeric_limits. |
maximumValue | This is the inclusive maximum value of the range. Passes when value is <= maximum. This will default to the maximum value supported by the Type as given by std::numeric_limits. |
tbCore::tbString TurtleBrains::Core::DynamicStructure::AsString | ( | bool | implicitConversion = kImplicitConversions | ) | const |
Gets the value of the object as a string using implicit conversions if allowed, otherwise an error condition will be triggered if the Type is not a string and implicitConversion is false.
implicitConversion | Set to true to allow other basic types (Bool, Integer, Float, Nil) to convert to an integer value automatically. If false, no conversion will be attempted and an error condition will be triggered. |
tbCore::tbString TurtleBrains::Core::DynamicStructure::AsStringWithDefault | ( | const tbCore::tbString & | defaultValue, |
bool | implicitConversion = true |
||
) | const |
First checks to make sure the type of the object is a string, then returns the value as a string without any conversions*. If the type is not a string the defaultValue will be returned.
defaultValue | The string value to return if the type is not specifically a string, even if the type could be implicitly converted. |
implicitConversion | Set to true to allow other basic types (Bool, Integer, Float) to convert to an integer value automatically, although a Nil value will return default. If false, no conversion will be attempted and the defaultValue will be returned. |
const StructureContainer& TurtleBrains::Core::DynamicStructure::AsStructure | ( | void | ) | const |
Returns the underlying structure type for the structure object. This should only be used to iterate over the items in a structure object, for saving or exporting etc.
for (const DynamicStructure& keyValue : myStructureObject.AsStructure() { const tbCore::tbString& keyName = keyValue.first; const tbCore::DynamicStructure& value = keyValue.second; ... }
StructureContainer& TurtleBrains::Core::DynamicStructure::AsStructure | ( | void | ) |
Returns the underlying structure type for the structure object. This should only be used to iterate over the items in a structure object, for saving or exporting etc.
for (const DynamicStructure& keyValue : myStructureObject.AsStructure() { const tbCore::tbString& keyName = keyValue.first; const tbCore::DynamicStructure& value = keyValue.second; ... }
ArrayContainer::const_iterator TurtleBrains::Core::DynamicStructure::begin | ( | void | ) | const |
Returns an array iterator at the start of the container. To be used to iterate over each member in the array.
ArrayContainer::iterator TurtleBrains::Core::DynamicStructure::begin | ( | void | ) |
Returns an array iterator at the start of the container. To be used to iterate over each member in the array.
ArrayContainer::const_iterator TurtleBrains::Core::DynamicStructure::BeginArray | ( | void | ) | const |
Returns an array iterator at the start of the container. To be used to iterate over each member in the array.
ArrayContainer::iterator TurtleBrains::Core::DynamicStructure::BeginArray | ( | void | ) |
Returns an array iterator at the start of the container. To be used to iterate over each member in the array.
StructureContainer::const_iterator TurtleBrains::Core::DynamicStructure::BeginStructure | ( | void | ) | const |
Returns a structure iterator at the start of the container for a Structure value. To be used to iterate over each member in the structure, typically for saving/exporting the dynamic structure.
StructureContainer::iterator TurtleBrains::Core::DynamicStructure::BeginStructure | ( | void | ) |
Returns a structure iterator at the start of the container for a Structure value. To be used to iterate over each member in the structure, typically for saving/exporting the dynamic structure.
ArrayContainer::const_iterator TurtleBrains::Core::DynamicStructure::end | ( | void | ) | const |
Returns an array iterator at the end of the container. To be used to iterate over each member in the array.
ArrayContainer::iterator TurtleBrains::Core::DynamicStructure::end | ( | void | ) |
Returns an array iterator at the end of the container. To be used to iterate over each member in the array.
ArrayContainer::const_iterator TurtleBrains::Core::DynamicStructure::EndArray | ( | void | ) | const |
Returns an array iterator at the end of the container. To be used to iterate over each member in the array.
ArrayContainer::iterator TurtleBrains::Core::DynamicStructure::EndArray | ( | void | ) |
Returns an array iterator at the end of the container. To be used to iterate over each member in the array.
StructureContainer::const_iterator TurtleBrains::Core::DynamicStructure::EndStructure | ( | void | ) | const |
Returns a structure iterator representing the end of the container for a Structure value. To be used to iterate over each member in the structure.
StructureContainer::iterator TurtleBrains::Core::DynamicStructure::EndStructure | ( | void | ) |
Returns a structure iterator representing the end of the container for a Structure value. To be used to iterate over each member in the structure.
const DynamicStructure& TurtleBrains::Core::DynamicStructure::GetMember | ( | const tbCore::tbString & | memberName | ) | const |
Attempts to retrieve a DynamicStructure object for the memberName given, if this object is of type Nil then a Nil object will be returned,* but if this object is a Structure the member will be searched for and returned if found otherwise if not found a Nil object will be returned.*
memberName | The name of the member as it was added during AddMember. |
DynamicStructure& TurtleBrains::Core::DynamicStructure::GetMember | ( | const tbCore::tbString & | memberName | ) |
Attempts to retrieve a DynamicStructure object for the memberName given, if this object is of type Nil then a Nil object will be returned,* but if this object is a Structure the member will be searched for and returned if found otherwise if not found a Nil object will be returned.*
memberName | The name of the member as it was added during AddMember. |
const DynamicStructure& TurtleBrains::Core::DynamicStructure::GetValue | ( | const tbCore::uint64 & | arrayIndex | ) | const |
Returns a const reference to the value in the array at the specified index. If this object is not an Array type an error condition will be triggered.
arrayIndex | is the index of the desired element. Must be within the range: 0 <= arrayIndex <= size() or an error condition will be triggered for going out of range. |
DynamicStructure& TurtleBrains::Core::DynamicStructure::GetValue | ( | const tbCore::uint64 & | arrayIndex | ) |
Returns a reference to the value in the array at the specified index. If this object is not an Array type an error condition will be triggered.
arrayIndex | is the index of the desired element. Must be within the range: 0 <= arrayIndex <= size() or an error condition will be triggered for going out of range. |
bool TurtleBrains::Core::DynamicStructure::IsArray | ( | void | ) | const |
Checks to see if the object is holding an array returning true if it is, otherwise false.
bool TurtleBrains::Core::DynamicStructure::IsBoolean | ( | void | ) | const |
Checks to see if the object is holding an boolean type returning true if it is.
bool TurtleBrains::Core::DynamicStructure::IsFloat | ( | void | ) | const |
Checks to see if the object is holding an float type returning true if it is.
bool TurtleBrains::Core::DynamicStructure::IsInteger | ( | void | ) | const |
Checks to see if the object is holding an integer type returning true if it is.
bool TurtleBrains::Core::DynamicStructure::IsNil | ( | void | ) | const |
Checks to see if the dynamic structure is a Nil object, representing no data, empty/clean, and returns the result, true if the object is Nil otherwise false.
bool TurtleBrains::Core::DynamicStructure::IsString | ( | void | ) | const |
Checks to see if the object is holding an string type returning true if it is.
bool TurtleBrains::Core::DynamicStructure::IsStructure | ( | void | ) | const |
Checks to see if the object is a structure type which could hold multiple other objects within returning true if it is a structure type, otherwise false.
|
inlineexplicit |
This operator will cast a DynamicStructure object into a bool with implicit conversion allowed.
|
inlineexplicit |
This operator will cast a DynamicStructure object into a float with implicit conversion allowed.
|
inlineexplicit |
This operator will cast a DynamicStructure object into an integer with implicit conversion allowed.
|
inlineexplicit |
This operator will cast a DynamicStructure object into a string with implicit conversion allowed.
bool TurtleBrains::Core::DynamicStructure::operator!= | ( | const DynamicStructure & | rightSide | ) | const |
Checks two DynamicStructures for non-equality. This can only check the basic types (Nil, Integer, Float, Boolean and String) for equality with another of the same type. Checking for inequality with an Array or Structure type will result in an error condition being triggered.
DynamicStructure& TurtleBrains::Core::DynamicStructure::operator= | ( | const DynamicStructure & | other | ) |
Cleans up the current object then assigns itself to an existing object. Because the objects can be quite large and complex, this could potentially use a fair bit of memory or copy overhead.
bool TurtleBrains::Core::DynamicStructure::operator== | ( | const DynamicStructure & | rightSide | ) | const |
Checks two DynamicStructures for equality. This can only check the basic types (Nil, Integer, Float, Boolean and String) for equality with another of the same type. Checking for equality with an Array or Structure type will result in an error condition being triggered.
DynamicStructure& TurtleBrains::Core::DynamicStructure::PushValue | ( | const DynamicStructure & | value | ) |
Attempts to push the value onto the back of a standard vector if this object is either a Nil type or an Array type. If the type is not Nil or an Array an error condition will be triggered.
value | The value to push into the array of values, it can be of any type. |
DynamicStructure& TurtleBrains::Core::DynamicStructure::SetMember | ( | const tbCore::tbString & | memberName, |
const DynamicStructure & | memberValue | ||
) |
Sets the value of an existing structure member, or adds the member if it did not exists, to an object with type Structure or Nil. Any other types will cause an error condition to be triggered. If the type is Nil, the object/type will become a Structure and the member will be added. If a value already exists for the member, it will be set to the new value. A reference to the object will then be returned.
memberName | The name of the member to be able to retrieve the value later. If a value with the memberName has already been added to the Structure an error condition will be triggered. |
memberValue | The value of the member which will be retrieved by it's name. |
void TurtleBrains::Core::DynamicStructure::SetValue | ( | const int & | integerValue, |
bool | implicitTypeChange = kImplicitTypeChange |
||
) |
Attempts to change the value of the object to the value specified, if the object Type is an integer, Nil or implicityTypeChange is allowed this will succeed, otherwise an error condition will be triggered. The object type will become an integer type during this process.
integerValue | The value for the object to hold as an integer type. |
implicitTypeChange | Set to true the value and type will always be set properly, however if false, and the object is not already an integer or Nil type this will cause an error condition to trigger. |
void TurtleBrains::Core::DynamicStructure::SetValue | ( | const float & | floatValue, |
bool | implicitTypeChange = kImplicitTypeChange |
||
) |
Attempts to change the value of the object to the value specified, if the object Type is a float, Nil or implicityTypeChange is allowed this will succeed, otherwise an error condition will be triggered. The object type will become a float type during this process.
floatValue | The value for the object to hold as a float type. |
implicitTypeChange | Set to true the value and type will always be set properly, however if false, and the object is not already a float or Nil type this will cause an error condition to trigger. |
void TurtleBrains::Core::DynamicStructure::SetValue | ( | const bool & | booleanValue, |
bool | implicitTypeChange = kImplicitTypeChange |
||
) |
Attempts to change the value of the object to the value specified, if the object Type is a boolean, Nil or implicityTypeChange is allowed this will succeed, otherwise an error condition will be triggered. The object type will become a float type during this process.
booleanValue | The value for the object to hold as a boolean type. |
implicitTypeChange | Set to true the value and type will always be set properly, however if false, and the object is not already a boolean or Nil type this will cause an error condition to trigger. |
void TurtleBrains::Core::DynamicStructure::SetValue | ( | const tbCore::tbString & | stringValue, |
bool | implicitTypeChange = kImplicitTypeChange |
||
) |
Attempts to change the value of the object to the value specified, if the object Type is a string, Nil or implicityTypeChange is allowed this will succeed, otherwise an error condition will be triggered. The object type will become a string type during this process.
stringValue | The value for the object to hold as a string type. |
implicitTypeChange | Set to true the value and type will always be set properly, however if false, and the object is not already a string or Nil type this will cause an error condition to trigger. |
size_t TurtleBrains::Core::DynamicStructure::size | ( | void | ) | const |
Returns the number of values contained with an array type structure or the number of values within an object like structure. Returns 0 for any other type.
size_t TurtleBrains::Core::DynamicStructure::StructureSize | ( | void | ) | const |
Returns the number of values contained within an structure type structure. If the type is NOT an structure-type then 0 will be returned without triggering an error condition.
|
friend |
TODO: TurtleBrains: Documentation: Teach the user how to use.
|
static |
The value returned when a false boolean is converted to a string.
|
static |
Consider two floating point values equal if the difference is less than epsilon.
|
static |
Changes the behavior of the DynamicStructure's AsType functions.
|
static |
Allows the DynamicStructure to change type on the fly.
|
static |
The value returned when size() is called with an invalid type, likely to be 0.
|
static |
The value returned when a null structure is converted to a string.
|
static |
The value returned to represent a const-reference to null.
|
static |
The value returned when a true boolean is converted to a string.