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

Represents a JSON value. More...

#include <Value.h>

Public Types

using Members = std::vector< std::string >
 The members. More...
 

Public Member Functions

 Value (Json::Value &value)
 ctor. More...
 
 Value (ValueType type=NullValue)
 ctor. More...
 
 Value (Int value)
 ctor. More...
 
 Value (UInt value)
 ctor. More...
 
 Value (Int64 value)
 ctor. More...
 
 Value (UInt64 value)
 ctor. More...
 
 Value (double value)
 ctor. More...
 
 Value (const char *value)
 Copy til first 0. (NULL causes to seg-fault.) More...
 
 Value (const char *begin, const char *end)
 Copy all, incl zeroes. More...
 
 Value (const std::string &value)
 Copy data() til size(). Embedded zeroes too. More...
 
 Value (bool value)
 ctor. More...
 
 Value (const Value &other)
 ctor. More...
 
 ~Value ()
 dtor. More...
 
Json::Value & GetJsonValue ()
 Returns a reference to the internal Json::Value. More...
 
const Json::Value & GetJsonValue () const
 Returns a reference to the internal Json::Value. More...
 
void SetComment (const std::string &comment)
 Adds a comment to the internal value. More...
 
bool HasComment () const
 Checks if the internal value has a comment. More...
 
std::string GetComment () const
 Returns the internal comment. More...
 
virtual void Clear ()
 Clears the internal JSON Root node. More...
 
int Size ()
 Returns the size of the array. More...
 
void Resize (int newSize)
 Change the size of the array. More...
 
bool IsValidIndex (int index) const
 Return true if index < Size() More...
 
bool RemoveIndex (int index, Value *removedVal)
 Remove the given Index value. More...
 
Value Index (int index)
 Returns the Value at the given index if this Value is an Array The return is by value, but the internal json object is stored by reference. More...
 
const Value::Members GetMemberNames () const
 Returns the value names contained in the object. More...
 
bool HasMember (const std::string &key) const
 Returns true if a member with the passed in key is present. More...
 
virtual bool KeyPresent (const std::string &key) const
 Checks if the JSON Root Node has an entry with a given key present. More...
 
virtual bool IsNull () const
 Checks if the value stored is a NULL. More...
 
virtual bool IsNull (const int index) const
 Checks if the value stored is a NULL. More...
 
virtual bool IsNull (const std::string &key) const
 Checks if the value stored is a NULL. More...
 
virtual void SetNull (const std::string &key) const
 Sets the NULL value in the Object. More...
 
virtual bool IsEmpty () const
 Return true if empty array, empty object, or null, otherwise, false. More...
 
virtual bool IsEmpty (const int index) const
 Return true if empty array, empty object, or null, otherwise, false. More...
 
virtual bool IsEmpty (const std::string &key) const
 Return true if empty array, empty object, or null, otherwise, false. More...
 
virtual void Append (const Value &val)
 Add a value at the end of the array. More...
 
virtual bool IsBool () const
 Checks if the value stored is a Boolean. More...
 
virtual bool IsBool (const int index) const
 Checks if the value stored is a Boolean. More...
 
virtual bool IsBool (const std::string &key) const
 Checks if the value stored is a Boolean. More...
 
virtual bool GetBool () const
 Returns the Boolean value. More...
 
virtual bool GetBool (const int index) const
 Returns the Boolean value. More...
 
virtual bool GetBool (const std::string &key) const
 Returns the Boolean value. More...
 
virtual void SetBool (const std::string &key, bool value)
 Sets the Boolean value in the Object. More...
 
virtual bool IsNumber () const
 Checks if the value stored is a Number. More...
 
virtual bool IsNumber (const int index) const
 Checks if the value stored is a Number. More...
 
virtual bool IsNumber (const std::string &key) const
 Checks if the value stored is a Number. More...
 
virtual bool IsInt () const
 Checks if the value stored is an Integer. More...
 
virtual bool IsInt (const int index) const
 Checks if the value stored is an Integer. More...
 
virtual bool IsInt (const std::string &key) const
 Checks if the value stored is an Integer. More...
 
virtual int GetInt () const
 Returns the Integer value. More...
 
virtual int GetInt (const int index) const
 Returns the Integer value. More...
 
virtual int GetInt (const std::string &key) const
 Returns the Integer value. More...
 
virtual void SetInt (const std::string &key, int value)
 Sets the Integer value in the Object. More...
 
virtual bool IsDouble () const
 Checks if the value stored is a Double. More...
 
virtual bool IsDouble (const int index) const
 Checks if the value stored is a Double. More...
 
virtual bool IsDouble (const std::string &key) const
 Checks if the value stored is a Double. More...
 
virtual double GetDouble () const
 Returns the Double value. More...
 
virtual double GetDouble (const int index) const
 Returns the Double value. More...
 
virtual double GetDouble (const std::string &key) const
 Returns the Double value. More...
 
virtual void SetDouble (const std::string &key, double value)
 Sets the Double value in the Object. More...
 
virtual bool IsUInt () const
 Checks if the value stored Unsigned Integer. More...
 
virtual bool IsUInt (const int index) const
 Checks if the value stored Unsigned Integer. More...
 
virtual bool IsUInt (const std::string &key) const
 Checks if the value stored Unsigned Integer. More...
 
virtual unsigned int GetUInt () const
 Returns the Unsigned Integer value. More...
 
virtual unsigned int GetUInt (const int index) const
 Returns the Unsigned Integer value. More...
 
virtual unsigned int GetUInt (const std::string &key) const
 Returns the Unsigned Integer value. More...
 
virtual void SetUInt (const std::string &key, unsigned int value)
 Sets the Unsigned Int value in the Object. More...
 
virtual bool IsInt64 () const
 Checks if the value stored is a 64bit Integer. More...
 
virtual bool IsInt64 (const int index) const
 Checks if the value stored is a 64bit Integer. More...
 
virtual bool IsInt64 (const std::string &key) const
 Checks if the value stored is a 64bit Integer. More...
 
virtual Int64 GetInt64 () const
 Returns the 64bit Integer value. More...
 
virtual Int64 GetInt64 (const int index) const
 Returns the 64bit Integer value. More...
 
virtual Int64 GetInt64 (const std::string &key) const
 Returns the 64bit Integer value. More...
 
virtual void SetInt64 (const std::string &key, Int64 value)
 Sets the Int64 value in the Object. More...
 
virtual bool IsUInt64 () const
 Checks if the value stored is a 64bit Unsigned Integer. More...
 
virtual bool IsUInt64 (const int index) const
 Checks if the value stored is a 64bit Unsigned Integer. More...
 
virtual bool IsUInt64 (const std::string &key) const
 Checks if the value stored is a 64bit Unsigned Integer. More...
 
virtual UInt64 GetUInt64 () const
 Returns the Unsigned 64bit Integer value. More...
 
virtual UInt64 GetUInt64 (const int index) const
 Returns the Unsigned 64bit Integer value. More...
 
virtual UInt64 GetUInt64 (const std::string &key) const
 Returns the Unsigned 64bit Integer value. More...
 
virtual void SetUInt64 (const std::string &key, UInt64 value)
 Sets the Unsigned Int64 value in the Object. More...
 
virtual bool IsFloat () const
 Checks if the value stored is a float. More...
 
virtual bool IsFloat (const int index) const
 Checks if the value stored is a float. More...
 
virtual bool IsFloat (const std::string &key) const
 Checks if the value stored is a float. More...
 
virtual float GetFloat () const
 Returns the float value stored. More...
 
virtual float GetFloat (const int index) const
 Returns the float value stored. More...
 
virtual float GetFloat (const std::string &key) const
 Returns the float value stored. More...
 
virtual void SetFloat (const std::string &key, float value)
 Sets the Float value in the Object. More...
 
virtual bool IsString () const
 Checks if the value stored is a String. More...
 
virtual bool IsString (const int index) const
 Checks if the value stored is a String. More...
 
virtual bool IsString (const std::string &key) const
 Checks if the value stored is a String. More...
 
virtual const std::string GetString () const
 Returns the String value stored. More...
 
virtual const std::string GetString (const int index) const
 Returns the String value stored. More...
 
virtual const std::string GetString (const std::string &key) const
 Returns the String value stored. More...
 
virtual void SetString (const std::string &key, const std::string &value)
 Sets the String value in the Object. More...
 
virtual bool IsArray () const
 Checks if the value stored is an Array. More...
 
virtual bool IsArray (const int index) const
 Checks if the value stored is an Array. More...
 
virtual bool IsArray (const std::string &key) const
 Checks if the value stored is an Array. More...
 
virtual const Array GetArray () const
 Returns the Array value stored. More...
 
virtual const Array GetArray (const int index) const
 Returns the Array value stored. More...
 
virtual const Array GetArray (const std::string &key) const
 Returns the Array value stored. More...
 
virtual void SetArray (const std::string &key, Array &value)
 Sets the Array value in the Object. More...
 
virtual bool IsObject () const
 Checks if the value stored is an Object. More...
 
virtual bool IsObject (const int index) const
 Checks if the value stored is an Object. More...
 
virtual bool IsObject (const std::string &key) const
 Checks if the value stored is an Object. More...
 
virtual const Object GetObject () const
 Returns the Object value stored. More...
 
virtual const Object GetObject (const int index) const
 Returns the Object value stored. More...
 
virtual const Object GetObject (const std::string &key) const
 Returns the Object value stored. More...
 
virtual void SetObject (const std::string &key, Object &value)
 Sets the Object value in the Object. More...
 
 operator Json::Value () const
 Implicit conversion operator to Json::Value. More...
 
 operator Json::Value & ()
 Implicit conversion operator to Json::Value. More...
 
 operator const Json::Value & () const
 Implicit conversion operator to Json::Value. More...
 
 operator Json::Value * ()
 Implicit conversion operator to Json::Value. More...
 
Valueoperator= (Value other)
 // Access an object value by name, returns null if there is no member with // that name. More...
 

Protected Attributes

bool clearInternalVal = true
 True to clear internal value. More...
 
Json::Value * mValuePtr = nullptr
 The value pointer. More...
 

Detailed Description

Represents a JSON value.

This class is a discriminated union wrapper that can represents a:

  • signed integer [range: Value::MinInt - Value::MaxInt]
  • unsigned integer (range: 0 - Value::MaxUInt)
  • double
  • UTF-8 string
  • boolean
  • 'null'
  • an ordered list of Value
  • collection of name/value pairs (javascript object)

The type of the held value is represented by a ValueType and can be obtained using Type().

Values of an ObjectValue or ArrayValue can be accessed using operator[]() methods. Non-const methods will automatically create the a NullValue element if it does not exist. The sequence of an ArrayValue will be automatically resized and initialized with #nNllValue. Resize() can be used to enlarge or truncate an ArrayValue.

The Get() methods can be used to obtain default value in the case the required element does not exist.

It is possible to iterate over the list of a ObjectValue values using the GetMemberNames() method.

Note
Value string-length fit in size_t, but keys must be < 2^30. (The reason is an implementation detail.) A #CharReader will raise an exception if a bound is exceeded to avoid security holes in your app, but the Value API does not check bounds. That is the responsibility of the caller.
Author
Maxim Serebrennik

Definition at line 139 of file Value.h.

Member Typedef Documentation

◆ Members

using trUtil::JSON::Value::Members = std::vector<std::string>

The members.

Definition at line 144 of file Value.h.

Constructor & Destructor Documentation

◆ Value() [1/12]

Value::Value ( Json::Value &  value)

ctor.

Parameters
[in,out]valueThe value.

Definition at line 119 of file Value.cpp.

References clearInternalVal, and mValuePtr.

Referenced by Index().

Here is the caller graph for this function:

◆ Value() [2/12]

Value::Value ( ValueType  type = NullValue)

ctor.

Parameters
type(Optional) The type.

Definition at line 126 of file Value.cpp.

References mValuePtr, and trUtil::JSON::ToValueType().

Here is the call graph for this function:

◆ Value() [3/12]

Value::Value ( Int  value)

ctor.

Parameters
valueThe value.

Definition at line 132 of file Value.cpp.

References mValuePtr.

◆ Value() [4/12]

Value::Value ( UInt  value)

ctor.

Parameters
valueThe value.

Definition at line 138 of file Value.cpp.

References mValuePtr.

◆ Value() [5/12]

Value::Value ( Int64  value)

ctor.

Parameters
valueThe value.

Definition at line 144 of file Value.cpp.

References mValuePtr.

◆ Value() [6/12]

Value::Value ( UInt64  value)

ctor.

Parameters
valueThe value.

Definition at line 150 of file Value.cpp.

References mValuePtr.

◆ Value() [7/12]

Value::Value ( double  value)

ctor.

Parameters
valueThe value.

Definition at line 156 of file Value.cpp.

References mValuePtr.

◆ Value() [8/12]

Value::Value ( const char *  value)

Copy til first 0. (NULL causes to seg-fault.)

ctor.

Parameters
valueThe value.

Definition at line 162 of file Value.cpp.

References mValuePtr.

◆ Value() [9/12]

Value::Value ( const char *  begin,
const char *  end 
)

Copy all, incl zeroes.

ctor.

Parameters
beginThe begining value.
endThe end.

Definition at line 168 of file Value.cpp.

References mValuePtr.

◆ Value() [10/12]

Value::Value ( const std::string &  value)

Copy data() til size(). Embedded zeroes too.

ctor.

Parameters
valueThe value.

Definition at line 174 of file Value.cpp.

References mValuePtr.

◆ Value() [11/12]

Value::Value ( bool  value)

ctor.

Parameters
valueTrue to value.

Definition at line 180 of file Value.cpp.

References mValuePtr.

◆ Value() [12/12]

Value::Value ( const Value other)

ctor.

Parameters
otherThe other.

Definition at line 186 of file Value.cpp.

References mValuePtr.

◆ ~Value()

Value::~Value ( )

dtor.

Definition at line 192 of file Value.cpp.

References clearInternalVal, and mValuePtr.

Member Function Documentation

◆ Append()

◆ Clear()

void Value::Clear ( )
virtual

Clears the internal JSON Root node.

Definition at line 240 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::Clear(), trUtil::JSON::Array::Clear(), trUtil::JSON::File::Clear(), and trUtil::JSON::File::ReadFromFile().

Here is the caller graph for this function:

◆ GetArray() [1/3]

const Array Value::GetArray ( ) const
virtual

Returns the Array value stored.

Returns
The array.

Definition at line 714 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetArray(), trUtil::JSON::Array::GetArray(), and trUtil::JSON::File::GetArray().

Here is the caller graph for this function:

◆ GetArray() [2/3]

const Array Value::GetArray ( const int  index) const
virtual

Returns the Array value stored.

Parameters
indexZero-based index of the values position.
Returns
The array.

Definition at line 721 of file Value.cpp.

References mValuePtr.

◆ GetArray() [3/3]

const Array Value::GetArray ( const std::string &  key) const
virtual

Returns the Array value stored.

Parameters
keyThe key.
Returns
The array.

Definition at line 728 of file Value.cpp.

References mValuePtr.

◆ GetBool() [1/3]

bool Value::GetBool ( ) const
virtual

Returns the Boolean value.

Returns
True if it succeeds, false if it fails.

Definition at line 360 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetBool(), trUtil::JSON::Array::GetBool(), and trUtil::JSON::File::GetBool().

Here is the caller graph for this function:

◆ GetBool() [2/3]

bool Value::GetBool ( const int  index) const
virtual

Returns the Boolean value.

Parameters
indexZero-based index of the values position.
Returns
True if it succeeds, false if it fails.

Definition at line 366 of file Value.cpp.

References mValuePtr.

◆ GetBool() [3/3]

bool Value::GetBool ( const std::string &  key) const
virtual

Returns the Boolean value.

Parameters
keyThe key.
Returns
True if it succeeds, false if it fails.

Definition at line 372 of file Value.cpp.

References mValuePtr.

◆ GetComment()

std::string Value::GetComment ( ) const

Returns the internal comment.

Returns
The comment.

Definition at line 226 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetComment(), and trUtil::JSON::Array::GetComment().

Here is the caller graph for this function:

◆ GetDouble() [1/3]

double Value::GetDouble ( ) const
virtual

Returns the Double value.

Returns
The double.

Definition at line 462 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetDouble(), trUtil::JSON::Array::GetDouble(), and trUtil::JSON::File::GetDouble().

Here is the caller graph for this function:

◆ GetDouble() [2/3]

double Value::GetDouble ( const int  index) const
virtual

Returns the Double value.

Parameters
indexZero-based index of the values position.
Returns
The double.

Definition at line 468 of file Value.cpp.

References mValuePtr.

◆ GetDouble() [3/3]

double Value::GetDouble ( const std::string &  key) const
virtual

Returns the Double value.

Parameters
keyThe key.
Returns
The double.

Definition at line 474 of file Value.cpp.

References mValuePtr.

◆ GetFloat() [1/3]

float Value::GetFloat ( ) const
virtual

Returns the float value stored.

Returns
The float.

Definition at line 630 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetFloat(), trUtil::JSON::Array::GetFloat(), and trUtil::JSON::File::GetFloat().

Here is the caller graph for this function:

◆ GetFloat() [2/3]

float Value::GetFloat ( const int  index) const
virtual

Returns the float value stored.

Parameters
indexZero-based index of the values position.
Returns
The float.

Definition at line 636 of file Value.cpp.

References mValuePtr.

◆ GetFloat() [3/3]

float Value::GetFloat ( const std::string &  key) const
virtual

Returns the float value stored.

Parameters
keyThe key.
Returns
The float.

Definition at line 642 of file Value.cpp.

References mValuePtr.

◆ GetInt() [1/3]

int Value::GetInt ( ) const
virtual

Returns the Integer value.

Returns
The int.

Definition at line 420 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetInt(), trUtil::JSON::Array::GetInt(), and trUtil::JSON::File::GetInt().

Here is the caller graph for this function:

◆ GetInt() [2/3]

int Value::GetInt ( const int  index) const
virtual

Returns the Integer value.

Parameters
indexZero-based index of the values position.
Returns
The int.

Definition at line 426 of file Value.cpp.

References mValuePtr.

◆ GetInt() [3/3]

int Value::GetInt ( const std::string &  key) const
virtual

Returns the Integer value.

Parameters
keyThe key.
Returns
The int.

Definition at line 432 of file Value.cpp.

References mValuePtr.

◆ GetInt64() [1/3]

Int64 Value::GetInt64 ( ) const
virtual

Returns the 64bit Integer value.

Returns
The int 64.

Definition at line 546 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetInt64(), trUtil::JSON::Array::GetInt64(), and trUtil::JSON::File::GetInt64().

Here is the caller graph for this function:

◆ GetInt64() [2/3]

Int64 Value::GetInt64 ( const int  index) const
virtual

Returns the 64bit Integer value.

Parameters
indexZero-based index of the values position.
Returns
The int 64.

Definition at line 552 of file Value.cpp.

References mValuePtr.

◆ GetInt64() [3/3]

Int64 Value::GetInt64 ( const std::string &  key) const
virtual

Returns the 64bit Integer value.

Parameters
keyThe key.
Returns
The int 64.

Definition at line 558 of file Value.cpp.

References mValuePtr.

◆ GetJsonValue() [1/2]

Json::Value & Value::GetJsonValue ( )

Returns a reference to the internal Json::Value.

Returns
The JSON value.

Definition at line 202 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::File::ReadFromFile(), and RemoveIndex().

Here is the caller graph for this function:

◆ GetJsonValue() [2/2]

const Json::Value & Value::GetJsonValue ( ) const

Returns a reference to the internal Json::Value.

Returns
The JSON value.

Definition at line 208 of file Value.cpp.

References mValuePtr.

◆ GetMemberNames()

const Value::Members Value::GetMemberNames ( ) const

Returns the value names contained in the object.

Returns
The member names.

Definition at line 276 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetMemberNames().

Here is the caller graph for this function:

◆ GetObject() [1/3]

const Object Value::GetObject ( ) const
virtual

Returns the Object value stored.

Returns
The object.

Definition at line 759 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetObject(), trUtil::JSON::Array::GetObject(), and trUtil::JSON::File::GetObject().

Here is the caller graph for this function:

◆ GetObject() [2/3]

const Object Value::GetObject ( const int  index) const
virtual

Returns the Object value stored.

Parameters
indexZero-based index of the values position.
Returns
The object.

Definition at line 766 of file Value.cpp.

References mValuePtr.

◆ GetObject() [3/3]

const Object Value::GetObject ( const std::string &  key) const
virtual

Returns the Object value stored.

Parameters
keyThe key.
Returns
The object.

Definition at line 773 of file Value.cpp.

References mValuePtr.

◆ GetString() [1/3]

const std::string Value::GetString ( ) const
virtual

Returns the String value stored.

Returns
The string.

Definition at line 672 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetString(), trUtil::JSON::Array::GetString(), and trUtil::JSON::File::GetString().

Here is the caller graph for this function:

◆ GetString() [2/3]

const std::string Value::GetString ( const int  index) const
virtual

Returns the String value stored.

Parameters
indexZero-based index of the values position.
Returns
The string.

Definition at line 678 of file Value.cpp.

References mValuePtr.

◆ GetString() [3/3]

const std::string Value::GetString ( const std::string &  key) const
virtual

Returns the String value stored.

Parameters
keyThe key.
Returns
The string.

Definition at line 684 of file Value.cpp.

References mValuePtr.

◆ GetUInt() [1/3]

unsigned int Value::GetUInt ( ) const
virtual

Returns the Unsigned Integer value.

Returns
The u int.

Definition at line 504 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetUInt(), trUtil::JSON::Array::GetUInt(), and trUtil::JSON::File::GetUInt().

Here is the caller graph for this function:

◆ GetUInt() [2/3]

unsigned int Value::GetUInt ( const int  index) const
virtual

Returns the Unsigned Integer value.

Parameters
indexZero-based index of the values position.
Returns
The u int.

Definition at line 510 of file Value.cpp.

References mValuePtr.

◆ GetUInt() [3/3]

unsigned int Value::GetUInt ( const std::string &  key) const
virtual

Returns the Unsigned Integer value.

Parameters
keyThe key.
Returns
The u int.

Definition at line 516 of file Value.cpp.

References mValuePtr.

◆ GetUInt64() [1/3]

UInt64 Value::GetUInt64 ( ) const
virtual

Returns the Unsigned 64bit Integer value.

Returns
The u int 64.

Definition at line 588 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::GetUInt64(), trUtil::JSON::Array::GetUInt64(), and trUtil::JSON::File::GetUInt64().

Here is the caller graph for this function:

◆ GetUInt64() [2/3]

UInt64 Value::GetUInt64 ( const int  index) const
virtual

Returns the Unsigned 64bit Integer value.

Parameters
indexZero-based index of the values position.
Returns
The u int 64.

Definition at line 594 of file Value.cpp.

References mValuePtr.

◆ GetUInt64() [3/3]

UInt64 Value::GetUInt64 ( const std::string &  key) const
virtual

Returns the Unsigned 64bit Integer value.

Parameters
keyThe key.
Returns
The u int 64.

Definition at line 600 of file Value.cpp.

References mValuePtr.

◆ HasComment()

bool Value::HasComment ( ) const

Checks if the internal value has a comment.

Returns
True if comment, false if not.

Definition at line 220 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::HasComment(), and trUtil::JSON::Array::HasComment().

Here is the caller graph for this function:

◆ HasMember()

bool Value::HasMember ( const std::string &  key) const

Returns true if a member with the passed in key is present.

Parameters
keyThe key.
Returns
True if member, false if not.

Definition at line 282 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::File::KeyPresent().

Here is the caller graph for this function:

◆ Index()

Value Value::Index ( int  index)

Returns the Value at the given index if this Value is an Array The return is by value, but the internal json object is stored by reference.

Parameters
indexZero-based index of the values position.
Returns
A Value.

Definition at line 270 of file Value.cpp.

References mValuePtr, and Value().

Referenced by trUtil::JSON::Array::operator[]().

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

◆ IsArray() [1/3]

bool Value::IsArray ( ) const
virtual

Checks if the value stored is an Array.

Returns
True if array, false if not.

Definition at line 696 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsArray(), trUtil::JSON::Array::IsArray(), and trUtil::JSON::File::IsArray().

Here is the caller graph for this function:

◆ IsArray() [2/3]

bool Value::IsArray ( const int  index) const
virtual

Checks if the value stored is an Array.

Parameters
indexZero-based index of the values position.
Returns
True if array, false if not.

Definition at line 702 of file Value.cpp.

References mValuePtr.

◆ IsArray() [3/3]

bool Value::IsArray ( const std::string &  key) const
virtual

Checks if the value stored is an Array.

Parameters
keyThe key.
Returns
True if array, false if not.

Definition at line 708 of file Value.cpp.

References mValuePtr.

◆ IsBool() [1/3]

bool Value::IsBool ( ) const
virtual

Checks if the value stored is a Boolean.

Returns
True if bool, false if not.

Definition at line 342 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsBool(), trUtil::JSON::Array::IsBool(), and trUtil::JSON::File::IsBool().

Here is the caller graph for this function:

◆ IsBool() [2/3]

bool Value::IsBool ( const int  index) const
virtual

Checks if the value stored is a Boolean.

Parameters
indexZero-based index of the values position.
Returns
True if bool, false if not.

Definition at line 348 of file Value.cpp.

References mValuePtr.

◆ IsBool() [3/3]

bool Value::IsBool ( const std::string &  key) const
virtual

Checks if the value stored is a Boolean.

Parameters
keyThe key.
Returns
True if bool, false if not.

Definition at line 354 of file Value.cpp.

References mValuePtr.

◆ IsDouble() [1/3]

bool Value::IsDouble ( ) const
virtual

Checks if the value stored is a Double.

Returns
True if double, false if not.

Definition at line 444 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsDouble(), trUtil::JSON::Array::IsDouble(), and trUtil::JSON::File::IsDouble().

Here is the caller graph for this function:

◆ IsDouble() [2/3]

bool Value::IsDouble ( const int  index) const
virtual

Checks if the value stored is a Double.

Parameters
indexZero-based index of the values position.
Returns
True if double, false if not.

Definition at line 450 of file Value.cpp.

References mValuePtr.

◆ IsDouble() [3/3]

bool Value::IsDouble ( const std::string &  key) const
virtual

Checks if the value stored is a Double.

Parameters
keyThe key.
Returns
True if double, false if not.

Definition at line 456 of file Value.cpp.

References mValuePtr.

◆ IsEmpty() [1/3]

bool Value::IsEmpty ( ) const
virtual

Return true if empty array, empty object, or null, otherwise, false.

Returns
True if empty, false if not.

Definition at line 318 of file Value.cpp.

References mValuePtr.

◆ IsEmpty() [2/3]

bool Value::IsEmpty ( const int  index) const
virtual

Return true if empty array, empty object, or null, otherwise, false.

Parameters
indexZero-based index of the values position.
Returns
True if empty, false if not.

Definition at line 324 of file Value.cpp.

References mValuePtr.

◆ IsEmpty() [3/3]

bool Value::IsEmpty ( const std::string &  key) const
virtual

Return true if empty array, empty object, or null, otherwise, false.

Parameters
keyThe key.
Returns
True if empty, false if not.

Definition at line 330 of file Value.cpp.

References mValuePtr.

◆ IsFloat() [1/3]

bool Value::IsFloat ( ) const
virtual

Checks if the value stored is a float.

Returns
True if float, false if not.

Definition at line 612 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsFloat(), trUtil::JSON::Array::IsFloat(), and trUtil::JSON::File::IsFloat().

Here is the caller graph for this function:

◆ IsFloat() [2/3]

bool Value::IsFloat ( const int  index) const
virtual

Checks if the value stored is a float.

Parameters
indexZero-based index of the values position.
Returns
True if float, false if not.

Definition at line 618 of file Value.cpp.

References mValuePtr.

◆ IsFloat() [3/3]

bool Value::IsFloat ( const std::string &  key) const
virtual

Checks if the value stored is a float.

Parameters
keyThe key.
Returns
True if float, false if not.

Definition at line 624 of file Value.cpp.

References mValuePtr.

◆ IsInt() [1/3]

bool Value::IsInt ( ) const
virtual

Checks if the value stored is an Integer.

Returns
True if int, false if not.

Definition at line 402 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsInt(), trUtil::JSON::Array::IsInt(), and trUtil::JSON::File::IsInt().

Here is the caller graph for this function:

◆ IsInt() [2/3]

bool Value::IsInt ( const int  index) const
virtual

Checks if the value stored is an Integer.

Parameters
indexZero-based index of the values position.
Returns
True if int, false if not.

Definition at line 408 of file Value.cpp.

References mValuePtr.

◆ IsInt() [3/3]

bool Value::IsInt ( const std::string &  key) const
virtual

Checks if the value stored is an Integer.

Parameters
keyThe key.
Returns
True if int, false if not.

Definition at line 414 of file Value.cpp.

References mValuePtr.

◆ IsInt64() [1/3]

bool Value::IsInt64 ( ) const
virtual

Checks if the value stored is a 64bit Integer.

Returns
True if int 64, false if not.

Definition at line 528 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsInt64(), trUtil::JSON::Array::IsInt64(), and trUtil::JSON::File::IsInt64().

Here is the caller graph for this function:

◆ IsInt64() [2/3]

bool Value::IsInt64 ( const int  index) const
virtual

Checks if the value stored is a 64bit Integer.

Parameters
indexZero-based index of the values position.
Returns
True if int 64, false if not.

Definition at line 534 of file Value.cpp.

References mValuePtr.

◆ IsInt64() [3/3]

bool Value::IsInt64 ( const std::string &  key) const
virtual

Checks if the value stored is a 64bit Integer.

Parameters
keyThe key.
Returns
True if int 64, false if not.

Definition at line 540 of file Value.cpp.

References mValuePtr.

◆ IsNull() [1/3]

bool Value::IsNull ( ) const
virtual

Checks if the value stored is a NULL.

Returns
True if null, false if not.

Definition at line 294 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsNull(), trUtil::JSON::Array::IsNull(), and trUtil::JSON::File::IsNull().

Here is the caller graph for this function:

◆ IsNull() [2/3]

bool Value::IsNull ( const int  index) const
virtual

Checks if the value stored is a NULL.

Parameters
indexZero-based index of the values position.
Returns
True if null, false if not.

Definition at line 300 of file Value.cpp.

References mValuePtr.

◆ IsNull() [3/3]

bool Value::IsNull ( const std::string &  key) const
virtual

Checks if the value stored is a NULL.

Parameters
keyThe key.
Returns
True if null, false if not.

Definition at line 306 of file Value.cpp.

References mValuePtr.

◆ IsNumber() [1/3]

bool Value::IsNumber ( ) const
virtual

Checks if the value stored is a Number.

Returns
True if number, false if not.

Definition at line 384 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsNumber(), trUtil::JSON::Array::IsNumber(), and trUtil::JSON::File::IsNumber().

Here is the caller graph for this function:

◆ IsNumber() [2/3]

bool Value::IsNumber ( const int  index) const
virtual

Checks if the value stored is a Number.

Parameters
indexZero-based index of the values position.
Returns
True if number, false if not.

Definition at line 390 of file Value.cpp.

References mValuePtr.

◆ IsNumber() [3/3]

bool Value::IsNumber ( const std::string &  key) const
virtual

Checks if the value stored is a Number.

Parameters
keyThe key.
Returns
True if number, false if not.

Definition at line 396 of file Value.cpp.

References mValuePtr.

◆ IsObject() [1/3]

bool Value::IsObject ( ) const
virtual

Checks if the value stored is an Object.

Returns
True if object, false if not.

Definition at line 741 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsObject(), trUtil::JSON::Array::IsObject(), and trUtil::JSON::File::IsObject().

Here is the caller graph for this function:

◆ IsObject() [2/3]

bool Value::IsObject ( const int  index) const
virtual

Checks if the value stored is an Object.

Parameters
indexZero-based index of the values position.
Returns
True if object, false if not.

Definition at line 747 of file Value.cpp.

References mValuePtr.

◆ IsObject() [3/3]

bool Value::IsObject ( const std::string &  key) const
virtual

Checks if the value stored is an Object.

Parameters
keyThe key.
Returns
True if object, false if not.

Definition at line 753 of file Value.cpp.

References mValuePtr.

◆ IsString() [1/3]

bool Value::IsString ( ) const
virtual

Checks if the value stored is a String.

Returns
True if string, false if not.

Definition at line 654 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsString(), trUtil::JSON::Array::IsString(), and trUtil::JSON::File::IsString().

Here is the caller graph for this function:

◆ IsString() [2/3]

bool Value::IsString ( const int  index) const
virtual

Checks if the value stored is a String.

Parameters
indexZero-based index of the values position.
Returns
True if string, false if not.

Definition at line 660 of file Value.cpp.

References mValuePtr.

◆ IsString() [3/3]

bool Value::IsString ( const std::string &  key) const
virtual

Checks if the value stored is a String.

Parameters
keyThe key.
Returns
True if string, false if not.

Definition at line 666 of file Value.cpp.

References mValuePtr.

◆ IsUInt() [1/3]

bool Value::IsUInt ( ) const
virtual

Checks if the value stored Unsigned Integer.

Returns
True if u int, false if not.

Definition at line 486 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsUInt(), trUtil::JSON::Array::IsUInt(), and trUtil::JSON::File::IsUInt().

Here is the caller graph for this function:

◆ IsUInt() [2/3]

bool Value::IsUInt ( const int  index) const
virtual

Checks if the value stored Unsigned Integer.

Parameters
indexZero-based index of the values position.
Returns
True if u int, false if not.

Definition at line 492 of file Value.cpp.

References mValuePtr.

◆ IsUInt() [3/3]

bool Value::IsUInt ( const std::string &  key) const
virtual

Checks if the value stored Unsigned Integer.

Parameters
keyThe key.
Returns
True if u int, false if not.

Definition at line 498 of file Value.cpp.

References mValuePtr.

◆ IsUInt64() [1/3]

bool Value::IsUInt64 ( ) const
virtual

Checks if the value stored is a 64bit Unsigned Integer.

Returns
True if u int 64, false if not.

Definition at line 570 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::IsUInt64(), trUtil::JSON::Array::IsUInt64(), and trUtil::JSON::File::IsUInt64().

Here is the caller graph for this function:

◆ IsUInt64() [2/3]

bool Value::IsUInt64 ( const int  index) const
virtual

Checks if the value stored is a 64bit Unsigned Integer.

Parameters
indexZero-based index of the values position.
Returns
True if u int 64, false if not.

Definition at line 576 of file Value.cpp.

References mValuePtr.

◆ IsUInt64() [3/3]

bool Value::IsUInt64 ( const std::string &  key) const
virtual

Checks if the value stored is a 64bit Unsigned Integer.

Parameters
keyThe key.
Returns
True if u int 64, false if not.

Definition at line 582 of file Value.cpp.

References mValuePtr.

◆ IsValidIndex()

bool Value::IsValidIndex ( int  index) const

Return true if index < Size()

Parameters
indexZero-based index of the values position.
Returns
True if valid index, false if not.

Definition at line 258 of file Value.cpp.

References mValuePtr.

◆ KeyPresent()

bool Value::KeyPresent ( const std::string &  key) const
virtual

Checks if the JSON Root Node has an entry with a given key present.

Parameters
keyThe key.
Returns
True if it succeeds, false if it fails.

Definition at line 288 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::KeyPresent().

Here is the caller graph for this function:

◆ operator const Json::Value &()

Value::operator const Json::Value & ( ) const

Implicit conversion operator to Json::Value.

Returns
A const.

Definition at line 798 of file Value.cpp.

References mValuePtr.

◆ operator Json::Value()

Value::operator Json::Value ( ) const

Implicit conversion operator to Json::Value.

Returns
The result of the operation.

Definition at line 786 of file Value.cpp.

References mValuePtr.

◆ operator Json::Value &()

Value::operator Json::Value & ( )

Implicit conversion operator to Json::Value.

Returns
The result of the operation.

Definition at line 792 of file Value.cpp.

References mValuePtr.

◆ operator Json::Value *()

Value::operator Json::Value * ( )

Implicit conversion operator to Json::Value.

Returns
The result of the operation.

Definition at line 804 of file Value.cpp.

References mValuePtr.

◆ operator=()

Value & Value::operator= ( Value  other)

// Access an object value by name, returns null if there is no member with // that name.

//

Parameters
keymay contain embedded nulls. //const Value operator[](const std::string& key) const;
otherThe other.
Returns
A shallow copy of this object.

Definition at line 849 of file Value.cpp.

References mValuePtr.

◆ RemoveIndex()

bool Value::RemoveIndex ( int  index,
Value removedVal 
)

Remove the given Index value.

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

Definition at line 264 of file Value.cpp.

References GetJsonValue(), and mValuePtr.

Referenced by trUtil::JSON::Array::RemoveIndex().

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

◆ Resize()

void Value::Resize ( int  newSize)

Change the size of the array.

Parameters
newSizeSize of the new.

Definition at line 252 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Array::Resize().

Here is the caller graph for this function:

◆ SetArray()

void Value::SetArray ( const std::string &  key,
Array value 
)
virtual

Sets the Array value in the Object.

Parameters
keyThe key.
[in,out]valueThe value.

Definition at line 735 of file Value.cpp.

References trUtil::JSON::Array::GetJSONRoot().

Referenced by trUtil::JSON::Object::SetArray(), and trUtil::JSON::File::SetArray().

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

◆ SetBool()

void Value::SetBool ( const std::string &  key,
bool  value 
)
virtual

Sets the Boolean value in the Object.

Parameters
keyThe key.
valueTrue to value.

Definition at line 378 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetBool(), and trUtil::JSON::File::SetBool().

Here is the caller graph for this function:

◆ SetComment()

void Value::SetComment ( const std::string &  comment)

Adds a comment to the internal value.

Parameters
commentThe comment.

Definition at line 214 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Object::SetComment(), and trUtil::JSON::Array::SetComment().

Here is the caller graph for this function:

◆ SetDouble()

void Value::SetDouble ( const std::string &  key,
double  value 
)
virtual

Sets the Double value in the Object.

Parameters
keyThe key.
valueThe value.

Definition at line 480 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetDouble(), and trUtil::JSON::File::SetDouble().

Here is the caller graph for this function:

◆ SetFloat()

void Value::SetFloat ( const std::string &  key,
float  value 
)
virtual

Sets the Float value in the Object.

Parameters
keyThe key.
valueThe value.

Definition at line 648 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetFloat(), and trUtil::JSON::File::SetFloat().

Here is the caller graph for this function:

◆ SetInt()

void Value::SetInt ( const std::string &  key,
int  value 
)
virtual

Sets the Integer value in the Object.

Parameters
keyThe key.
valueThe value.

Definition at line 438 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetInt(), and trUtil::JSON::File::SetInt().

Here is the caller graph for this function:

◆ SetInt64()

void Value::SetInt64 ( const std::string &  key,
Int64  value 
)
virtual

Sets the Int64 value in the Object.

Parameters
keyThe key.
valueThe value.

Definition at line 564 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetInt64(), and trUtil::JSON::File::SetInt64().

Here is the caller graph for this function:

◆ SetNull()

void Value::SetNull ( const std::string &  key) const
virtual

Sets the NULL value in the Object.

Parameters
keyThe key.

Definition at line 312 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetNull(), and trUtil::JSON::File::SetNull().

Here is the caller graph for this function:

◆ SetObject()

void Value::SetObject ( const std::string &  key,
Object value 
)
virtual

Sets the Object value in the Object.

Parameters
keyThe key.
[in,out]valueThe value.

Definition at line 780 of file Value.cpp.

References trUtil::JSON::Object::GetJSONRoot().

Referenced by trUtil::JSON::Object::SetObject(), and trUtil::JSON::File::SetObject().

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

◆ SetString()

void Value::SetString ( const std::string &  key,
const std::string &  value 
)
virtual

Sets the String value in the Object.

Parameters
keyThe key.
valueThe value.

Definition at line 690 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetString(), and trUtil::JSON::File::SetString().

Here is the caller graph for this function:

◆ SetUInt()

void Value::SetUInt ( const std::string &  key,
unsigned int  value 
)
virtual

Sets the Unsigned Int value in the Object.

Parameters
keyThe key.
valueThe value.

Definition at line 522 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetUInt(), and trUtil::JSON::File::SetUInt().

Here is the caller graph for this function:

◆ SetUInt64()

void Value::SetUInt64 ( const std::string &  key,
UInt64  value 
)
virtual

Sets the Unsigned Int64 value in the Object.

Parameters
keyThe key.
valueThe value.

Definition at line 606 of file Value.cpp.

Referenced by trUtil::JSON::Object::SetUInt64(), and trUtil::JSON::File::SetUInt64().

Here is the caller graph for this function:

◆ Size()

int Value::Size ( )

Returns the size of the array.

Returns
An int.

Definition at line 246 of file Value.cpp.

References mValuePtr.

Referenced by trUtil::JSON::Array::Size().

Here is the caller graph for this function:

Member Data Documentation

◆ clearInternalVal

bool trUtil::JSON::Value::clearInternalVal = true
protected

True to clear internal value.

Definition at line 1320 of file Value.h.

Referenced by Value(), and ~Value().

◆ mValuePtr


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