9 #ifndef _TurtleBrains_DynamicStructure_h_
10 #define _TurtleBrains_DynamicStructure_h_
12 #include "tb_string.h"
96 bool IsNil(
void)
const;
420 StructureContainer::const_iterator
EndStructure(
void)
const;
445 size_t Size(
void)
const;
459 operator float()
const {
return AsFloat(
true); }
494 int ConvertToInteger(
void)
const;
499 float ConvertToFloat(
void)
const;
504 bool ConvertToBoolean(
void)
const;
514 enum DynamicStructureValueType
540 DynamicStructureValueType mValueType;
551 ArrayContainer* mArray;
552 StructureContainer* mStructure;
570 inline bool operator==(
const DynamicStructure& leftSide,
const int& rightSide) {
return (leftSide.
AsInteger() == rightSide) ?
true :
false; }
571 inline bool operator==(
const int& leftSide,
const DynamicStructure& rightSide) {
return (rightSide.AsInteger() == leftSide) ?
true :
false; }
572 inline bool operator!=(
const DynamicStructure& leftSide,
const int& rightSide) {
return (leftSide.AsInteger() != rightSide) ?
true :
false; }
573 inline bool operator!=(
const int& leftSide,
const DynamicStructure& rightSide) {
return (rightSide.AsInteger() != leftSide) ?
true :
false; }
575 inline bool operator==(
const DynamicStructure& leftSide,
const float& rightSide) {
return (fabs(leftSide.AsFloat() - rightSide) <=
DynamicStructure::kFloatElipson) ?
true :
false; }
576 inline bool operator==(
const float& leftSide,
const DynamicStructure& rightSide) {
return (fabs(rightSide.AsFloat() - leftSide) <=
DynamicStructure::kFloatElipson) ?
true :
false; }
577 inline bool operator!=(
const DynamicStructure& leftSide,
const float& rightSide) {
return (fabs(leftSide.AsFloat() - rightSide) >
DynamicStructure::kFloatElipson) ?
true :
false; }
578 inline bool operator!=(
const float& leftSide,
const DynamicStructure& rightSide) {
return (fabs(rightSide.AsFloat() - leftSide) >
DynamicStructure::kFloatElipson) ?
true :
false; }
580 inline bool operator==(
const DynamicStructure& leftSide,
const bool& rightSide) {
return (leftSide.AsBoolean() == rightSide) ?
true :
false; }
581 inline bool operator==(
const bool& leftSide,
const DynamicStructure& rightSide) {
return (rightSide.AsBoolean() == leftSide) ?
true :
false; }
582 inline bool operator!=(
const DynamicStructure& leftSide,
const bool& rightSide) {
return (leftSide.AsBoolean() != rightSide) ?
true :
false; }
583 inline bool operator!=(
const bool& leftSide,
const DynamicStructure& rightSide) {
return (rightSide.AsBoolean() != leftSide) ?
true :
false; }
585 inline bool operator==(
const DynamicStructure& leftSide,
const tbCore::tbString& rightSide) {
return (leftSide.AsString() == rightSide) ?
true :
false; }
586 inline bool operator==(
const tbCore::tbString& leftSide,
const DynamicStructure& rightSide) {
return (rightSide.AsString() == leftSide) ?
true :
false; }
587 inline bool operator!=(
const DynamicStructure& leftSide,
const tbCore::tbString& rightSide) {
return (leftSide.AsString() != rightSide) ?
true :
false; }
588 inline bool operator!=(
const tbCore::tbString& leftSide,
const DynamicStructure& rightSide) {
return (rightSide.AsString() != leftSide) ?
true :
false; }
const DynamicStructure & GetMember(const tbCore::tbString &memberName) const
bool IsString(void) const
DynamicStructure & PushValue(const DynamicStructure &value)
static const bool kImplicitConversions
Definition: tb_dynamic_structure.h:562
static const DynamicStructure kNullValue
Definition: tb_dynamic_structure.h:556
tbCore::tbString AsString(bool implicitConversion=kImplicitConversions) const
tbCore::tbString AsStringWithDefault(const tbCore::tbString &defaultValue) const
StructureContainer::const_iterator EndStructure(void) const
static const float kFloatElipson
Definition: tb_dynamic_structure.h:564
Contains all functions, classes and helpers related to game/application development written by Tim "B...
Definition: tb_application_dialog.h:21
float AsFloat(bool implicitConversion=kImplicitConversions) const
static const tbCore::tbString kTrueAsString
Definition: tb_dynamic_structure.h:558
float AsFloatWithDefault(const float defaultValue) const
const DynamicStructure & operator[](const size_t &arrayIndex) const
static const unsigned int kInvalidSize
Definition: tb_dynamic_structure.h:560
const DynamicStructure & GetValue(const size_t &arrayIndex) const
int AsInteger(bool implicitConversion=kImplicitConversions) const
static const bool kTypeSafeArrays
Definition: tb_dynamic_structure.h:561
static const tbCore::tbString kNullAsString
Definition: tb_dynamic_structure.h:557
bool IsBoolean(void) const
Definition: tb_dynamic_structure.h:28
bool IsInteger(void) const
std::map< tbCore::tbString, DynamicStructure > StructureContainer
Definition: tb_dynamic_structure.h:39
static const tbCore::tbString kFalseAsString
Definition: tb_dynamic_structure.h:559
bool operator==(const DynamicStructure &rightSide) const
bool AsBoolean(bool implicitConversion=kImplicitConversions) const
std::vector< DynamicStructure > ArrayContainer
Definition: tb_dynamic_structure.h:34
StructureContainer::const_iterator BeginStructure(void) const
DynamicStructure & AddMember(const tbCore::tbString &memberName, const DynamicStructure &memberValue)
void SetValue(const int &integerValue, bool implicitTypeChange=kImplicitTypeChange)
Contains core functionality for each component of the API.
Definition: tb_debug_logger.h:91
std::string tbString
Definition: tb_string.h:335
bool IsStructure(void) const
DynamicStructure & operator=(const DynamicStructure &other)
bool AsBooleanWithDefault(const bool defaultValue) const
int AsIntegerWithDefault(const int defaultValue) const
static const bool kImplicitTypeChange
Definition: tb_dynamic_structure.h:563
DynamicStructure & SetMember(const tbCore::tbString &memberName, const DynamicStructure &memberValue)