27 #include <json/value.h> 28 #include <json/writer.h> 46 return Json::ValueType::nullValue;
49 return Json::ValueType::intValue;
52 return Json::ValueType::uintValue;
55 return Json::ValueType::realValue;
58 return Json::ValueType::stringValue;
61 return Json::ValueType::booleanValue;
64 return Json::ValueType::arrayValue;
67 return Json::ValueType::objectValue;
70 return Json::ValueType::nullValue;
88 case Json::ValueType::nullValue:
91 case Json::ValueType::intValue:
94 case Json::ValueType::uintValue:
97 case Json::ValueType::realValue:
100 case Json::ValueType::stringValue:
103 case Json::ValueType::booleanValue:
106 case Json::ValueType::arrayValue:
109 case Json::ValueType::objectValue:
216 mValuePtr->setComment(
"//" + comment, Json::CommentPlacement::commentAfterOnSameLine);
222 return mValuePtr->hasComment(Json::CommentPlacement::commentAfterOnSameLine);
229 std::string comment =
mValuePtr->getComment(Json::CommentPlacement::commentAfterOnSameLine);
231 if (comment.size() > 1)
314 (*mValuePtr)[key] = Json::Value();
338 mValuePtr->append(*
new Json::Value(val));
380 (*mValuePtr)[key] = value;
440 (*mValuePtr)[key] = value;
482 (*mValuePtr)[key] = value;
524 (*mValuePtr)[key] = value;
566 (*mValuePtr)[key] = value;
608 (*mValuePtr)[key] = value;
650 (*mValuePtr)[key] = value;
692 (*mValuePtr)[key] = value;
786 Value::operator Json::Value()
const 792 Value::operator Json::Value&()
798 Value::operator
const Json::Value&()
const 804 Value::operator Json::Value*()
virtual bool IsArray() const
Checks if the value stored is an Array.
virtual bool IsUInt64() const
Checks if the value stored is a 64bit Unsigned Integer.
virtual bool IsBool() const
Checks if the value stored is a Boolean.
virtual void SetInt64(const std::string &key, Int64 value)
Sets the Int64 value in the Object.
std::string GetComment() const
Returns the internal comment.
int Size()
Returns the size of the array.
virtual bool IsInt() const
Checks if the value stored is an Integer.
virtual bool KeyPresent(const std::string &key) const
Checks if the JSON Root Node has an entry with a given key present.
void Resize(int newSize)
Change the size of the array.
array value (ordered list)
virtual bool IsUInt() const
Checks if the value stored Unsigned Integer.
bool IsValidIndex(int index) const
Return true if index < Size()
virtual bool IsFloat() const
Checks if the value stored is a float.
virtual unsigned int GetUInt() const
Returns the Unsigned Integer value.
bool clearInternalVal
True to clear internal value.
TR_BASE_EXPORT std::ostream & operator<<(std::ostream &ios, const Matrixd &q)
Stream insertion operator.
ValueType
Type of the value held by a Value object.
virtual void SetUInt(const std::string &key, unsigned int value)
Sets the Unsigned Int value in the Object.
virtual int GetInt() const
Returns the Integer value.
bool RemoveIndex(int index, Value *removedVal)
Remove the given Index value.
virtual void SetString(const std::string &key, const std::string &value)
Sets the String value in the Object.
virtual bool IsString() const
Checks if the value stored is a String.
virtual void Clear()
Clears the internal JSON Root node.
virtual Value & GetJSONRoot() override
Returns a reference to the internal JSON Root node.
int64_t Int64
The fourth int 6.
virtual double GetDouble() const
Returns the Double value.
virtual bool IsEmpty() const
Return true if empty array, empty object, or null, otherwise, false.
virtual bool IsNull() const
Checks if the value stored is a NULL.
virtual void SetNull(const std::string &key) const
Sets the NULL value in the Object.
virtual bool GetBool() const
Returns the Boolean value.
Value & operator=(Value other)
// Access an object value by name, returns null if there is no member with // that name...
virtual Value & GetJSONRoot() override
Returns a reference to the internal JSON Root node.
virtual void SetUInt64(const std::string &key, UInt64 value)
Sets the Unsigned Int64 value in the Object.
virtual bool IsDouble() const
Checks if the value stored is a Double.
unsigned int UInt
The int.
virtual float GetFloat() const
Returns the float value stored.
virtual UInt64 GetUInt64() const
Returns the Unsigned 64bit Integer value.
virtual void Append(const Value &val)
Add a value at the end of the array.
virtual void SetInt(const std::string &key, int value)
Sets the Integer value in the Object.
Json::ValueType ToValueType(ValueType val)
Converts JSON::ValueType to Json::ValueType.
Value(Json::Value &value)
ctor.
virtual void SetObject(const std::string &key, Object &value)
Sets the Object value in the Object.
virtual const Array GetArray() const
Returns the Array value stored.
void SetComment(const std::string &comment)
Adds a comment to the internal value.
const Value::Members GetMemberNames() const
Returns the value names contained in the object.
virtual void SetFloat(const std::string &key, float value)
Sets the Float value in the Object.
virtual void SetBool(const std::string &key, bool value)
Sets the Boolean value in the Object.
virtual bool IsInt64() const
Checks if the value stored is a 64bit Integer.
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.
virtual const Object GetObject() const
Returns the Object value stored.
virtual void SetArray(const std::string &key, Array &value)
Sets the Array value in the Object.
virtual void SetDouble(const std::string &key, double value)
Sets the Double value in the Object.
bool HasMember(const std::string &key) const
Returns true if a member with the passed in key is present.
Json::Value * mValuePtr
The value pointer.
TR_UTIL_EXPORT std::ostream & operator<<(std::ostream &, const Value &root)
OStream operator.
virtual bool IsObject() const
Checks if the value stored is an Object.
virtual const std::string GetString() const
Returns the String value stored.
uint64_t UInt64
The fourth u int 6.
std::vector< std::string > Members
The members.
virtual Int64 GetInt64() const
Returns the 64bit Integer value.
bool HasComment() const
Checks if the internal value has a comment.
Json::Value & GetJsonValue()
Returns a reference to the internal Json::Value.
virtual bool IsNumber() const
Checks if the value stored is a Number.