TrueReality  v0.1.1912
trUtil::JSON::Array Class Reference

A JSON array. More...

#include <Array.h>

Inheritance diagram for trUtil::JSON::Array:
Collaboration diagram for trUtil::JSON::Array:

Public Member Functions

 Array ()
 ctor. More...
 
 Array (const Value &Array)
 ctor that takes a JSON Value of an Array type as input. More...
 
 ~Array ()
 dtor. More...
 
Value operator[] (int index)
 Access an array element (zero based index ). More...
 
void SetComment (const std::string &comment)
 Sets a comment. More...
 
bool HasComment () const
 Checks if the internal value has a comment. More...
 
std::string GetComment () const
 Returns the internal comment. More...
 
int Size ()
 Get the size of the array. More...
 
void Resize (int newSize)
 Change the size of the array to the new passed in size. More...
 
void Clear () override
 Clears the internal JSON Root node. More...
 
bool RemoveIndex (int index, Value *removedVal)
 Removes a given element of the array. More...
 
virtual ValueGetJSONRoot () override
 Returns a reference to the internal JSON Root node. More...
 
virtual void PrintJSONRoot () override
 Prints out to the screen the whole JSON Root content. More...
 
virtual bool IsNull (int &index) const override
 Checks if the value stored at the specific index is a NULL. More...
 
virtual void AddNull () override
 Add a NULL Value to the Array. More...
 
virtual bool IsBool (int &index) const override
 Checks if the value stored at the specific index is a Boolean. More...
 
virtual bool GetBool (int &index) const override
 Returns the Boolean value stored at the given index. More...
 
virtual void AddBool (const bool &value) override
 Adds a Boolean to the Array. More...
 
virtual bool IsTrue (int &index) const override
 Checks if the value stored at the specific index is True. More...
 
virtual bool IsFalse (int &index) const override
 Checks if the value stored at the specific index is False. More...
 
virtual bool IsNumber (int &index) const override
 Checks if the value stored at the specific index is a Number. More...
 
virtual bool IsInt (int &index) const override
 Checks if the value stored at the specific index is an Integer. More...
 
virtual int GetInt (int &index) const override
 Returns the Integer value stored at the given index. More...
 
virtual void AddInt (const int &value) override
 Adds the Integer value to the Array. More...
 
virtual bool IsDouble (int &index) const override
 Checks if the value stored at the specific index is a Double. More...
 
virtual double GetDouble (int &index) const override
 Returns the Double value stored at the given index. More...
 
virtual void AddDouble (const double &value) override
 Adds the Double value to the Array. More...
 
virtual bool IsUInt (int &index) const override
 Checks if the value stored at the specific index is an Unsigned Integer. More...
 
virtual unsigned int GetUInt (int &index) const override
 Returns the Unsigned Integer value stored at the given index. More...
 
virtual void AddUInt (const unsigned int &value) override
 Adds the Unsigned Integer value the Array. More...
 
virtual bool IsInt64 (int &index) const override
 Checks if the value stored at the specific index is a 64bit Integer. More...
 
virtual Int64 GetInt64 (int &index) const override
 Returns the 64bit Integer value stored at the given index. More...
 
virtual void AddInt64 (const Int64 &value) override
 Adds the 64bit Integer value to the Array. More...
 
virtual bool IsUInt64 (int &index) const override
 Checks if the value stored at the specific index is a 64bit Integer. More...
 
virtual UInt64 GetUInt64 (int &index) const override
 Returns the 64bit Integer value stored at the given index. More...
 
virtual void AddUInt64 (const UInt64 &value) override
 Adds the 64bit Integer value to the Array. More...
 
virtual bool IsFloat (int &index) const override
 Checks if the value stored at the specific index is a float. More...
 
virtual float GetFloat (int &index) const override
 Returns the float value stored at the given index. More...
 
virtual void AddFloat (const float &value) override
 Adds the float value to the Array. More...
 
virtual bool IsString (int &index) const override
 Checks if the value stored at the specific index is a String. More...
 
virtual const std::string GetString (int &index) const override
 Returns the String value stored at the given index. More...
 
virtual void AddString (const std::string &value) override
 Adds the String to the Array. More...
 
virtual bool IsArray (int &index) const override
 Checks if the value stored at the specific index is an Array. More...
 
virtual Array GetArray (int &index) const override
 Returns the Array value stored at the given index. More...
 
virtual void AddArray (Array &Array) override
 Adds the Array to the Array. More...
 
virtual bool IsObject (int &index) const override
 Checks if the value stored at the specific index is an Object. More...
 
virtual Object GetObject (int &index) const override
 Returns the Object value stored at the given index. More...
 
virtual void AddObject (Object &Object) override
 Adds the Object to the Array. More...
 

Private Attributes

Value mRoot = Value(ValueType::ArrayValue)
 The root. More...
 

Additional Inherited Members

Detailed Description

A JSON array.

An array.

Author
Maxim Serebrennik

Definition at line 46 of file Array.h.

Constructor & Destructor Documentation

◆ Array() [1/2]

trUtil::JSON::Array::Array ( )

ctor.

Definition at line 33 of file Array.cpp.

Referenced by Array().

Here is the caller graph for this function:

◆ Array() [2/2]

trUtil::JSON::Array::Array ( const Value Array)

ctor that takes a JSON Value of an Array type as input.

Parameters
ArrayThe array.

Definition at line 38 of file Array.cpp.

References Array(), and mRoot.

Here is the call graph for this function:

◆ ~Array()

trUtil::JSON::Array::~Array ( )

dtor.

Definition at line 44 of file Array.cpp.

Member Function Documentation

◆ AddArray()

void trUtil::JSON::Array::AddArray ( Array Array)
overridevirtual

Adds the Array to the Array.

Parameters
[in,out]ArrayThe array.

Implements trUtil::JSON::ArrayBase.

Definition at line 312 of file Array.cpp.

References trUtil::JSON::Value::Append(), GetJSONRoot(), and mRoot.

Here is the call graph for this function:

◆ AddBool()

void trUtil::JSON::Array::AddBool ( const bool &  value)
overridevirtual

Adds a Boolean to the Array.

Parameters
valueThe value.

Implements trUtil::JSON::ArrayBase.

Definition at line 136 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ AddDouble()

void trUtil::JSON::Array::AddDouble ( const double &  value)
overridevirtual

Adds the Double value to the Array.

Parameters
valueThe value.

Implements trUtil::JSON::ArrayBase.

Definition at line 204 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ AddFloat()

void trUtil::JSON::Array::AddFloat ( const float &  value)
overridevirtual

Adds the float value to the Array.

Parameters
valueThe value.

Implements trUtil::JSON::ArrayBase.

Definition at line 276 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ AddInt()

void trUtil::JSON::Array::AddInt ( const int &  value)
overridevirtual

Adds the Integer value to the Array.

Parameters
valueThe value.

Implements trUtil::JSON::ArrayBase.

Definition at line 186 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ AddInt64()

void trUtil::JSON::Array::AddInt64 ( const Int64 value)
overridevirtual

Adds the 64bit Integer value to the Array.

Parameters
valueThe value.

Implements trUtil::JSON::ArrayBase.

Definition at line 240 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ AddNull()

void trUtil::JSON::Array::AddNull ( )
overridevirtual

Add a NULL Value to the Array.

Implements trUtil::JSON::ArrayBase.

Definition at line 118 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ AddObject()

void trUtil::JSON::Array::AddObject ( Object Object)
overridevirtual

Adds the Object to the Array.

Parameters
[in,out]ObjectThe object.

Implements trUtil::JSON::ArrayBase.

Definition at line 330 of file Array.cpp.

References trUtil::JSON::Value::Append(), trUtil::JSON::Object::GetJSONRoot(), and mRoot.

Here is the call graph for this function:

◆ AddString()

void trUtil::JSON::Array::AddString ( const std::string &  value)
overridevirtual

Adds the String to the Array.

Parameters
valueThe value.

Implements trUtil::JSON::ArrayBase.

Definition at line 294 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ AddUInt()

void trUtil::JSON::Array::AddUInt ( const unsigned int &  value)
overridevirtual

Adds the Unsigned Integer value the Array.

Parameters
valueThe value.

Implements trUtil::JSON::ArrayBase.

Definition at line 222 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ AddUInt64()

void trUtil::JSON::Array::AddUInt64 ( const UInt64 value)
overridevirtual

Adds the 64bit Integer value to the Array.

Parameters
valueThe value.

Implements trUtil::JSON::ArrayBase.

Definition at line 258 of file Array.cpp.

References trUtil::JSON::Value::Append(), and mRoot.

Here is the call graph for this function:

◆ Clear()

void trUtil::JSON::Array::Clear ( )
overridevirtual

Clears the internal JSON Root node.

Implements trUtil::JSON::ArrayBase.

Definition at line 88 of file Array.cpp.

References trUtil::JSON::Value::Clear(), and mRoot.

Here is the call graph for this function:

◆ GetArray()

Array trUtil::JSON::Array::GetArray ( int &  index) const
overridevirtual

Returns the Array value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The array.

Implements trUtil::JSON::ArrayBase.

Definition at line 306 of file Array.cpp.

References trUtil::JSON::Value::GetArray(), and mRoot.

Here is the call graph for this function:

◆ GetBool()

bool trUtil::JSON::Array::GetBool ( int &  index) const
overridevirtual

Returns the Boolean value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
True if it succeeds, false if it fails.

Implements trUtil::JSON::ArrayBase.

Definition at line 130 of file Array.cpp.

References trUtil::JSON::Value::GetBool(), and mRoot.

Referenced by IsFalse(), and IsTrue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetComment()

std::string trUtil::JSON::Array::GetComment ( ) const

Returns the internal comment.

Returns
The comment.

Definition at line 71 of file Array.cpp.

References trUtil::JSON::Value::GetComment(), and mRoot.

Here is the call graph for this function:

◆ GetDouble()

double trUtil::JSON::Array::GetDouble ( int &  index) const
overridevirtual

Returns the Double value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The double.

Implements trUtil::JSON::ArrayBase.

Definition at line 198 of file Array.cpp.

References trUtil::JSON::Value::GetDouble(), and mRoot.

Here is the call graph for this function:

◆ GetFloat()

float trUtil::JSON::Array::GetFloat ( int &  index) const
overridevirtual

Returns the float value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The float.

Implements trUtil::JSON::ArrayBase.

Definition at line 270 of file Array.cpp.

References trUtil::JSON::Value::GetFloat(), and mRoot.

Here is the call graph for this function:

◆ GetInt()

int trUtil::JSON::Array::GetInt ( int &  index) const
overridevirtual

Returns the Integer value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The int.

Implements trUtil::JSON::ArrayBase.

Definition at line 180 of file Array.cpp.

References trUtil::JSON::Value::GetInt(), and mRoot.

Here is the call graph for this function:

◆ GetInt64()

Int64 trUtil::JSON::Array::GetInt64 ( int &  index) const
overridevirtual

Returns the 64bit Integer value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The int 64.

Implements trUtil::JSON::ArrayBase.

Definition at line 234 of file Array.cpp.

References trUtil::JSON::Value::GetInt64(), and mRoot.

Here is the call graph for this function:

◆ GetJSONRoot()

Value & trUtil::JSON::Array::GetJSONRoot ( )
overridevirtual

Returns a reference to the internal JSON Root node.

Returns
The JSON root.

Implements trUtil::JSON::ArrayBase.

Definition at line 100 of file Array.cpp.

References mRoot.

Referenced by AddArray(), and trUtil::JSON::Value::SetArray().

Here is the caller graph for this function:

◆ GetObject()

Object trUtil::JSON::Array::GetObject ( int &  index) const
overridevirtual

Returns the Object value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The object.

Implements trUtil::JSON::ArrayBase.

Definition at line 324 of file Array.cpp.

References trUtil::JSON::Value::GetObject(), and mRoot.

Here is the call graph for this function:

◆ GetString()

const std::string trUtil::JSON::Array::GetString ( int &  index) const
overridevirtual

Returns the String value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The string.

Implements trUtil::JSON::ArrayBase.

Definition at line 288 of file Array.cpp.

References trUtil::JSON::Value::GetString(), and mRoot.

Here is the call graph for this function:

◆ GetUInt()

unsigned int trUtil::JSON::Array::GetUInt ( int &  index) const
overridevirtual

Returns the Unsigned Integer value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The u int.

Implements trUtil::JSON::ArrayBase.

Definition at line 216 of file Array.cpp.

References trUtil::JSON::Value::GetUInt(), and mRoot.

Here is the call graph for this function:

◆ GetUInt64()

UInt64 trUtil::JSON::Array::GetUInt64 ( int &  index) const
overridevirtual

Returns the 64bit Integer value stored at the given index.

Parameters
[in,out]indexZero-based index of the.
Returns
The u int 64.

Implements trUtil::JSON::ArrayBase.

Definition at line 252 of file Array.cpp.

References trUtil::JSON::Value::GetUInt64(), and mRoot.

Here is the call graph for this function:

◆ HasComment()

bool trUtil::JSON::Array::HasComment ( ) const

Checks if the internal value has a comment.

Returns
True if comment, false if not.

Definition at line 65 of file Array.cpp.

References trUtil::JSON::Value::HasComment(), and mRoot.

Here is the call graph for this function:

◆ IsArray()

bool trUtil::JSON::Array::IsArray ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is an Array.

Parameters
[in,out]indexZero-based index of the.
Returns
True if array, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 300 of file Array.cpp.

References trUtil::JSON::Value::IsArray(), and mRoot.

Here is the call graph for this function:

◆ IsBool()

bool trUtil::JSON::Array::IsBool ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is a Boolean.

Parameters
[in,out]indexZero-based index of the.
Returns
True if bool, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 124 of file Array.cpp.

References trUtil::JSON::Value::IsBool(), and mRoot.

Here is the call graph for this function:

◆ IsDouble()

bool trUtil::JSON::Array::IsDouble ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is a Double.

Parameters
[in,out]indexZero-based index of the.
Returns
True if double, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 192 of file Array.cpp.

References trUtil::JSON::Value::IsDouble(), and mRoot.

Here is the call graph for this function:

◆ IsFalse()

bool trUtil::JSON::Array::IsFalse ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is False.

Parameters
[in,out]indexZero-based index of the.
Returns
True if false, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 155 of file Array.cpp.

References GetBool().

Here is the call graph for this function:

◆ IsFloat()

bool trUtil::JSON::Array::IsFloat ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is a float.

Parameters
[in,out]indexZero-based index of the.
Returns
True if float, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 264 of file Array.cpp.

References trUtil::JSON::Value::IsFloat(), and mRoot.

Here is the call graph for this function:

◆ IsInt()

bool trUtil::JSON::Array::IsInt ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is an Integer.

Parameters
[in,out]indexZero-based index of the.
Returns
True if int, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 174 of file Array.cpp.

References trUtil::JSON::Value::IsInt(), and mRoot.

Here is the call graph for this function:

◆ IsInt64()

bool trUtil::JSON::Array::IsInt64 ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is a 64bit Integer.

Parameters
[in,out]indexZero-based index of the.
Returns
True if int 64, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 228 of file Array.cpp.

References trUtil::JSON::Value::IsInt64(), and mRoot.

Here is the call graph for this function:

◆ IsNull()

bool trUtil::JSON::Array::IsNull ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is a NULL.

Parameters
[in,out]indexZero-based index of the.
Returns
True if null, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 112 of file Array.cpp.

References trUtil::JSON::Value::IsNull(), and mRoot.

Here is the call graph for this function:

◆ IsNumber()

bool trUtil::JSON::Array::IsNumber ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is a Number.

Parameters
[in,out]indexZero-based index of the.
Returns
True if number, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 168 of file Array.cpp.

References trUtil::JSON::Value::IsNumber(), and mRoot.

Here is the call graph for this function:

◆ IsObject()

bool trUtil::JSON::Array::IsObject ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is an Object.

Parameters
[in,out]indexZero-based index of the.
Returns
True if object, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 318 of file Array.cpp.

References trUtil::JSON::Value::IsObject(), and mRoot.

Here is the call graph for this function:

◆ IsString()

bool trUtil::JSON::Array::IsString ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is a String.

Parameters
[in,out]indexZero-based index of the.
Returns
True if string, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 282 of file Array.cpp.

References trUtil::JSON::Value::IsString(), and mRoot.

Here is the call graph for this function:

◆ IsTrue()

bool trUtil::JSON::Array::IsTrue ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is True.

Parameters
[in,out]indexZero-based index of the.
Returns
True if true, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 142 of file Array.cpp.

References GetBool().

Here is the call graph for this function:

◆ IsUInt()

bool trUtil::JSON::Array::IsUInt ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is an Unsigned Integer.

Parameters
[in,out]indexZero-based index of the.
Returns
True if u int, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 210 of file Array.cpp.

References trUtil::JSON::Value::IsUInt(), and mRoot.

Here is the call graph for this function:

◆ IsUInt64()

bool trUtil::JSON::Array::IsUInt64 ( int &  index) const
overridevirtual

Checks if the value stored at the specific index is a 64bit Integer.

Parameters
[in,out]indexZero-based index of the.
Returns
True if u int 64, false if not.

Implements trUtil::JSON::ArrayBase.

Definition at line 246 of file Array.cpp.

References trUtil::JSON::Value::IsUInt64(), and mRoot.

Here is the call graph for this function:

◆ operator[]()

Value trUtil::JSON::Array::operator[] ( int  index)

Access an array element (zero based index ).

The return is by value, but the internal json object is stored by reference.

Parameters
indexZero-based index of the.
Returns
The indexed value.

Definition at line 49 of file Array.cpp.

References trUtil::JSON::Value::Index(), LOG_E, and mRoot.

Here is the call graph for this function:

◆ PrintJSONRoot()

void trUtil::JSON::Array::PrintJSONRoot ( )
overridevirtual

Prints out to the screen the whole JSON Root content.

Implements trUtil::JSON::ArrayBase.

Definition at line 106 of file Array.cpp.

References mRoot.

◆ RemoveIndex()

bool trUtil::JSON::Array::RemoveIndex ( int  index,
Value removedVal 
)

Removes a given element of the array.

Passes back the removed value though the pointer and sets the return to TRUE.

Parameters
indexZero-based index of the.
[in,out]removedValIf non-null, the removed value.
Returns
True if it succeeds, false if it fails.

Definition at line 94 of file Array.cpp.

References mRoot, and trUtil::JSON::Value::RemoveIndex().

Here is the call graph for this function:

◆ Resize()

void trUtil::JSON::Array::Resize ( int  newSize)

Change the size of the array to the new passed in size.

Parameters
newSizeSize of the new.

Definition at line 82 of file Array.cpp.

References mRoot, and trUtil::JSON::Value::Resize().

Here is the call graph for this function:

◆ SetComment()

void trUtil::JSON::Array::SetComment ( const std::string &  comment)

Sets a comment.

Parameters
commentThe comment.

Definition at line 59 of file Array.cpp.

References mRoot, and trUtil::JSON::Value::SetComment().

Here is the call graph for this function:

◆ Size()

int trUtil::JSON::Array::Size ( )

Get the size of the array.

Returns
An int.

Definition at line 76 of file Array.cpp.

References mRoot, and trUtil::JSON::Value::Size().

Here is the call graph for this function:

Member Data Documentation

◆ mRoot


The documentation for this class was generated from the following files: