30 #ifndef INCLUDE_OLA_WEB_JSON_H_
31 #define INCLUDE_OLA_WEB_JSON_H_
51 class JsonObjectPropertyVisitor;
52 class JsonValueConstVisitorInterface;
53 class JsonValueVisitorInterface;
80 virtual void Visit(
JsonBool *value) = 0;
81 virtual void Visit(
JsonNull *value) = 0;
85 virtual void Visit(
JsonUInt *value) = 0;
87 virtual void Visit(
JsonInt *value) = 0;
103 virtual void Visit(
const JsonString &value) = 0;
104 virtual void Visit(
const JsonBool &value) = 0;
105 virtual void Visit(
const JsonNull &value) = 0;
107 virtual void Visit(
const JsonObject &value) = 0;
108 virtual void Visit(
const JsonArray &value) = 0;
109 virtual void Visit(
const JsonUInt &value) = 0;
110 virtual void Visit(
const JsonUInt64 &value) = 0;
111 virtual void Visit(
const JsonInt &value) = 0;
112 virtual void Visit(
const JsonInt64 &value) = 0;
113 virtual void Visit(
const JsonDouble &value) = 0;
140 return !(*
this == other);
178 virtual bool Equals(
const JsonString &)
const {
return false; }
184 virtual bool Equals(
const JsonUInt &)
const {
return false; }
190 virtual bool Equals(
const JsonInt &)
const {
return false; }
196 virtual bool Equals(
const JsonUInt64 &)
const {
return false; }
202 virtual bool Equals(
const JsonInt64 &)
const {
return false; }
208 virtual bool Equals(
const JsonBool &)
const {
return false; }
214 virtual bool Equals(
const JsonNull &)
const {
return false; }
220 virtual bool Equals(
const JsonDouble &)
const {
return false; }
226 virtual bool Equals(
const JsonRawValue &)
const {
return false; }
232 virtual bool Equals(
const JsonObject &)
const {
return false; }
238 virtual bool Equals(
const JsonArray &)
const {
return false; }
247 template <
typename T>
248 static JsonValue* NewValue(
const T &value);
254 template <
typename T>
255 static JsonNumber* NewNumberValue(
const T &value);
285 explicit JsonString(
const std::string &value) : m_value(value) {}
292 const std::string&
Value()
const {
return m_value; }
296 visitor->Visit(*
this);
305 return m_value == other.m_value;
312 const std::string m_value;
340 return *
this == other || *
this < other;
347 return !(*
this <= other);
354 return !(*
this < other);
360 virtual int Compare(
const JsonUInt &value)
const = 0;
361 virtual int Compare(
const JsonInt &value)
const = 0;
362 virtual int Compare(
const JsonUInt64 &value)
const = 0;
363 virtual int Compare(
const JsonInt64 &value)
const = 0;
364 virtual int Compare(
const JsonDouble &value)
const = 0;
366 virtual bool FactorOf(
const JsonUInt &value)
const = 0;
367 virtual bool FactorOf(
const JsonInt &value)
const = 0;
368 virtual bool FactorOf(
const JsonUInt64 &value)
const = 0;
369 virtual bool FactorOf(
const JsonInt64 &value)
const = 0;
370 virtual bool FactorOf(
const JsonDouble &value)
const = 0;
385 explicit JsonUInt(
unsigned int value) : m_value(value) {}
390 return other.Compare(*
this) == 1;
394 return other.FactorOf(*
this);
399 visitor->Visit(*
this);
407 unsigned int Value()
const {
return m_value; }
412 bool Equals(
const JsonUInt &other)
const {
413 return m_value == other.m_value;
416 bool Equals(
const JsonInt &other)
const;
417 bool Equals(
const JsonUInt64 &other)
const;
418 bool Equals(
const JsonInt64 &other)
const;
420 int Compare(
const JsonUInt &value)
const;
421 int Compare(
const JsonInt &value)
const;
422 int Compare(
const JsonUInt64 &value)
const;
423 int Compare(
const JsonInt64 &value)
const;
424 int Compare(
const JsonDouble &value)
const;
426 bool FactorOf(
const JsonUInt &value)
const;
427 bool FactorOf(
const JsonInt &value)
const;
428 bool FactorOf(
const JsonUInt64 &value)
const;
429 bool FactorOf(
const JsonInt64 &value)
const;
430 bool FactorOf(
const JsonDouble &value)
const;
436 const unsigned int m_value;
451 explicit JsonInt(
int value) : m_value(value) {}
456 return other.Compare(*
this) == 1;
460 return other.FactorOf(*
this);
465 visitor->Visit(*
this);
473 int Value()
const {
return m_value; }
478 bool Equals(
const JsonInt &other)
const {
479 return m_value == other.m_value;
482 bool Equals(
const JsonUInt &other)
const;
483 bool Equals(
const JsonUInt64 &other)
const;
484 bool Equals(
const JsonInt64 &other)
const;
486 int Compare(
const JsonUInt &value)
const;
487 int Compare(
const JsonInt &value)
const;
488 int Compare(
const JsonUInt64 &value)
const;
489 int Compare(
const JsonInt64 &value)
const;
490 int Compare(
const JsonDouble &value)
const;
492 bool FactorOf(
const JsonUInt &value)
const;
493 bool FactorOf(
const JsonInt &value)
const;
494 bool FactorOf(
const JsonUInt64 &value)
const;
495 bool FactorOf(
const JsonInt64 &value)
const;
496 bool FactorOf(
const JsonDouble &value)
const;
503 DISALLOW_COPY_AND_ASSIGN(
JsonInt);
519 return other.Equals(*
this);
523 return other.Compare(*
this) == 1;
527 return other.FactorOf(*
this);
532 visitor->Visit(*
this);
540 uint64_t
Value()
const {
return m_value; }
546 return m_value == other.m_value;
549 bool Equals(
const JsonUInt &other)
const;
550 bool Equals(
const JsonInt &other)
const;
551 bool Equals(
const JsonInt64 &other)
const;
553 int Compare(
const JsonUInt &value)
const;
554 int Compare(
const JsonInt &value)
const;
556 int Compare(
const JsonInt64 &value)
const;
557 int Compare(
const JsonDouble &value)
const;
559 bool FactorOf(
const JsonUInt &value)
const;
560 bool FactorOf(
const JsonInt &value)
const;
562 bool FactorOf(
const JsonInt64 &value)
const;
563 bool FactorOf(
const JsonDouble &value)
const;
568 const uint64_t m_value;
586 return other.Equals(*
this);
590 return other.Compare(*
this) == 1;
594 return other.FactorOf(*
this);
599 visitor->Visit(*
this);
607 int64_t
Value()
const {
return m_value; }
612 bool Equals(
const JsonInt64 &other)
const {
613 return m_value == other.m_value;
616 bool Equals(
const JsonUInt &other)
const;
617 bool Equals(
const JsonInt &other)
const;
618 bool Equals(
const JsonUInt64 &other)
const;
620 int Compare(
const JsonUInt &value)
const;
621 int Compare(
const JsonInt &value)
const;
622 int Compare(
const JsonUInt64 &value)
const;
623 int Compare(
const JsonInt64 &value)
const;
624 int Compare(
const JsonDouble &value)
const;
626 bool FactorOf(
const JsonUInt &value)
const;
627 bool FactorOf(
const JsonInt &value)
const;
628 bool FactorOf(
const JsonUInt64 &value)
const;
629 bool FactorOf(
const JsonInt64 &value)
const;
630 bool FactorOf(
const JsonDouble &value)
const;
635 const int64_t m_value;
686 return other.Equals(*
this);
690 return other.Compare(*
this) == 1;
694 return other.FactorOf(*
this);
699 visitor->Visit(*
this);
705 const std::string&
ToString()
const {
return m_as_string; }
712 double Value()
const {
return m_value; }
720 static bool AsDouble(
const DoubleRepresentation &rep,
double *out);
727 static std::string
AsString(
const DoubleRepresentation &rep);
740 return m_value == other.m_value;
743 int Compare(
const JsonUInt &value)
const;
744 int Compare(
const JsonInt &value)
const;
745 int Compare(
const JsonUInt64 &value)
const;
746 int Compare(
const JsonInt64 &value)
const;
749 bool FactorOf(
const JsonUInt &value)
const;
750 bool FactorOf(
const JsonInt &value)
const;
751 bool FactorOf(
const JsonUInt64 &value)
const;
752 bool FactorOf(
const JsonInt64 &value)
const;
759 std::string m_as_string;
777 return other.Equals(*
this);
782 visitor->Visit(*
this);
790 bool Value()
const {
return m_value; }
795 bool Equals(
const JsonBool &other)
const {
796 return m_value == other.m_value;
820 visitor->Visit(*
this);
830 bool Equals(
const JsonNull &)
const {
return true; }
854 visitor->Visit(*
this);
862 const std::string&
Value()
const {
return m_value; }
868 return m_value == other.m_value;
875 const std::string m_value;
901 return other.Equals(*
this);
911 void Add(
const std::string &key,
const std::string &value);
918 void Add(
const std::string &key,
const char *value);
925 void Add(
const std::string &key,
unsigned int i);
932 void Add(
const std::string &key,
int i);
939 void Add(
const std::string &key,
double d);
946 void Add(
const std::string &key,
bool value);
952 void Add(
const std::string &key);
980 void AddRaw(
const std::string &key,
const std::string &value);
987 bool Remove(
const std::string &key);
1001 visitor->Visit(*
this);
1010 bool IsEmpty()
const {
return m_members.empty(); }
1012 unsigned int Size()
const {
return m_members.size(); }
1022 typedef std::map<std::string, JsonValue*> MemberMap;
1023 MemberMap m_members;
1041 return other.Equals(*
this);
1067 m_values.push_back(
new JsonUInt(i));
1075 m_values.push_back(
new JsonInt(i));
1083 m_values.push_back(
new JsonBool(value));
1090 m_values.push_back(
new JsonNull());
1097 m_values.push_back(value);
1104 m_values.push_back(value);
1105 m_complex_type |= !value->
IsEmpty();
1115 m_values.push_back(obj);
1116 m_complex_type =
true;
1127 m_values.push_back(array);
1128 m_complex_type =
true;
1137 m_values.push_back(value);
1174 visitor->Visit(*
this);
1188 unsigned int Size()
const {
return m_values.size(); }
1202 typedef std::vector<JsonValue*> ValuesVector;
1203 ValuesVector m_values;
1206 bool m_complex_type;
1245 std::ostream& operator<<(std::ostream &os,
const JsonString &value);
1246 std::ostream& operator<<(std::ostream &os,
const JsonUInt &value);
1247 std::ostream& operator<<(std::ostream &os,
const JsonInt &value);
1248 std::ostream& operator<<(std::ostream &os,
const JsonUInt64 &value);
1249 std::ostream& operator<<(std::ostream &os,
const JsonInt64 &value);
1250 std::ostream& operator<<(std::ostream &os,
const JsonDouble &value);
1251 std::ostream& operator<<(std::ostream &os,
const JsonBool &value);
1252 std::ostream& operator<<(std::ostream &os,
const JsonNull &value);
1253 std::ostream& operator<<(std::ostream &os,
const JsonRawValue &value);
1257 inline JsonNumber* JsonValue::NewNumberValue<uint32_t>(
1258 const uint32_t &value) {
1263 inline JsonNumber* JsonValue::NewNumberValue<int32_t>(
1264 const int32_t &value) {
1265 return new JsonInt(value);
1269 inline JsonNumber* JsonValue::NewNumberValue<uint64_t>(
1270 const uint64_t &value) {
1271 return new JsonUInt64(value);
1275 inline JsonNumber* JsonValue::NewNumberValue<int64_t>(
1276 const int64_t &value) {
1277 return new JsonInt64(value);
1281 inline JsonNumber* JsonValue::NewNumberValue<double>(
1282 const double &value) {
1283 return new JsonDouble(value);
1287 inline JsonNumber* JsonValue::NewNumberValue<
1288 JsonDouble::DoubleRepresentation>(
1289 const JsonDouble::DoubleRepresentation &value) {
1290 return new JsonDouble(value);
1295 inline JsonValue* JsonValue::NewValue<std::string>(
const std::string &value) {
1296 return new JsonString(value);
1300 inline JsonValue* JsonValue::NewValue<uint32_t>(
const uint32_t &value) {
1301 return NewNumberValue(value);
1305 inline JsonValue* JsonValue::NewValue<int32_t>(
const int32_t &value) {
1306 return NewNumberValue(value);
1310 inline JsonValue* JsonValue::NewValue<uint64_t>(
const uint64_t &value) {
1311 return NewNumberValue(value);
1315 inline JsonValue* JsonValue::NewValue<int64_t>(
const int64_t &value) {
1316 return NewNumberValue(value);
1320 inline JsonValue* JsonValue::NewValue<double>(
const double &value) {
1321 return NewNumberValue(value);
1325 inline JsonValue* JsonValue::NewValue<JsonDouble::DoubleRepresentation>(
1326 const JsonDouble::DoubleRepresentation &value) {
1327 return NewNumberValue(value);
1331 inline JsonValue* JsonValue::NewValue<bool>(
const bool &value) {
1332 return new JsonBool(value);
1337 #endif // INCLUDE_OLA_WEB_JSON_H_
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:818
The base class for JSON values.
Definition: Json.h:119
A base class used to describe values which are leafs of a JSON tree.
Definition: Json.h:265
Represents a JSON double value broken down as separate components.
Definition: Json.h:661
void AddRaw(const std::string &key, const std::string &value)
Set the given key to a raw value.
Definition: Json.cpp:635
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition: Json.h:693
JsonArray * AppendArray()
Append a JsonArray to the array.
Definition: Json.h:1125
void Add(const std::string &key, const std::string &value)
Add a key to string mapping.
Definition: Json.cpp:607
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition: Json.h:393
void VisitProperties(JsonObjectPropertyVisitor *visitor) const
Visit each of the properties in this object.
Definition: Json.cpp:680
A signed 64bit int value.
Definition: Json.h:577
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:900
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:387
An unsigned 32bit int value.
Definition: Json.h:379
void AddValue(const std::string &key, JsonValue *value)
Set the key to the supplied JsonValue.
Definition: Json.cpp:667
bool operator>=(const JsonNumber &other) const
Greater than or equals operator.
Definition: Json.h:353
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
A raw value, useful if you want to cheat.
Definition: Json.h:842
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:819
The interface for the JsonValueVisitor class.
Definition: Json.h:75
JsonDouble(double value)
Create a new JsonDouble.
Definition: Json.cpp:512
uint64_t fractional
Definition: Json.h:669
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:463
virtual JsonValue * Clone() const =0
Make a copy of this JsonValue.
JsonRawValue(const std::string &value)
Create a new JsonRawValue.
Definition: Json.h:848
unsigned int Value() const
Return the uint32_t value.
Definition: Json.h:407
bool Equals(const JsonArray &other) const
Check if this JsonValue equals a JsonArray.
Definition: Json.cpp:714
bool IsEmpty() const
Check if there are elements within the array.
Definition: Json.h:1183
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:1000
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:598
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:685
void Append(JsonObject *value)
Append a JsonValue. Takes ownership of the pointer.
Definition: Json.h:1103
JsonUInt64(uint64_t value)
Create a new JsonUInt64.
Definition: Json.h:516
JsonObject * AddObject(const std::string &key)
Set the given key to a JsonObject.
Definition: Json.cpp:655
JsonInt64(int64_t value)
Create a new JsonInt64.
Definition: Json.h:583
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:530
JsonObject * AppendObject()
Append a JsonObject to the array.
Definition: Json.h:1113
bool ReplaceElementAt(uint32_t index, JsonValue *value)
Replace the JsonValue at the specified index.
Definition: Json.cpp:740
virtual bool MultipleOf(const JsonNumber &other) const =0
Checks if the remainder if non-0;.
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:518
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition: Json.h:593
bool RemoveElementAt(uint32_t index)
Remove the JsonValue at the specified index.
Definition: Json.cpp:730
A class used to visit Json values within a JsonObject.
Definition: Json.h:1215
virtual void Accept(JsonValueVisitorInterface *visitor)=0
The Accept method for the visitor pattern.
bool IsComplexType() const
Return true if this array contains nested arrays or objects.
Definition: Json.h:1199
const std::string & Value() const
Return the raw value as a string.
Definition: Json.h:862
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:464
bool Equals(const JsonObject &other) const
Check if this JsonValue equals a JsonObject.
Definition: Json.cpp:590
The null value.
Definition: Json.h:811
bool operator<(const JsonNumber &other) const
Less than operator.
Definition: Json.h:689
bool is_negative
Definition: Json.h:663
virtual bool operator<(const JsonNumber &other) const =0
Less than operator.
JsonValue * LookupElementWithIter(JsonPointer::Iterator *iter)
Lookup the Value referred to by the Iterator.
Definition: Json.cpp:691
JsonObject * ObjectCast(JsonValue *value)
Downcast a JsonValue to a JsonObject.
Definition: Json.cpp:780
A JSON object. JSON Objects are key : value mappings, similar to dictionaries in Python.
Definition: Json.h:890
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:299
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:597
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:468
An iterator for traversing a JsonPointer.
Definition: JsonPointer.h:74
A Bool value.
Definition: Json.h:768
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:398
unsigned int Size() const
Return the number of elements in the array.
Definition: Json.h:1188
void Append(const char *value)
Append a string value to the array.
Definition: Json.h:1058
An array of JSON values. Arrays in JSON can contain values of different types.
Definition: Json.h:1033
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:294
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:1040
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:397
JsonArray * ArrayCast(JsonValue *value)
Downcast a JsonValue to a JsonArray.
Definition: Json.cpp:795
int32_t exponent
Definition: Json.h:671
bool IsEmpty() const
Check if there are properties within the object.
Definition: Json.h:1010
virtual void VisitProperty(const std::string &property, const JsonValue &value)=0
Visit the value at the given property.
bool operator<(const JsonNumber &other) const
Less than operator.
Definition: Json.h:455
void Append(int i)
Append an int value to the array.
Definition: Json.h:1074
bool operator<(const JsonNumber &other) const
Less than operator.
Definition: Json.h:389
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:287
bool operator<=(const JsonNumber &other) const
Less than or equals operator.
Definition: Json.h:339
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:697
const std::string & Value() const
Return the string value.
Definition: Json.h:292
A string value.
Definition: Json.h:279
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:999
void Append(unsigned int i)
Append an unsigned int value to the array.
Definition: Json.h:1066
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:781
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:776
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:585
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:698
static bool AsDouble(const DoubleRepresentation &rep, double *out)
Convert a DoubleRepresentation to a double value.
Definition: Json.cpp:524
int Value() const
Return the int32_t value.
Definition: Json.h:473
virtual bool operator!=(const JsonValue &other) const
Not-equals operator.
Definition: Json.h:139
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:602
JsonInt(int value)
Create a new JsonInt.
Definition: Json.h:451
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:825
An unsigned 64bit int value.
Definition: Json.h:510
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:1172
class JsonArray * AddArray(const std::string &key)
Set the given key to a JsonArray.
Definition: Json.cpp:661
void Append(JsonValue *value)
Append a JsonValue. Takes ownership of the pointer.
Definition: Json.h:1096
const JsonValue * ElementAt(unsigned int i) const
Return the element at index i.
Definition: Json.cpp:772
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:402
Various string utility functions.
A signed 32bit int value.
Definition: Json.h:445
void AppendValue(JsonValue *value)
Append a JsonValue to the array.
Definition: Json.h:1136
uint64_t Value() const
Return the uint64_t value.
Definition: Json.h:540
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:853
double Value() const
Returns the value as a double.
Definition: Json.h:712
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:785
A JSON pointer (RFC 6901) refers to a possible element in a JSON data structure.
Definition: JsonPointer.h:66
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:850
const std::string & ToString() const
Return the double value as a string.
Definition: Json.h:705
void Append(bool value)
Append a bool value to the array.
Definition: Json.h:1082
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:823
bool operator<(const JsonNumber &other) const
Less than operator.
Definition: Json.h:589
A double value.
Definition: Json.h:649
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:852
void Append()
Append a null value to the array.
Definition: Json.h:1089
uint64_t full
Definition: Json.h:665
bool operator==(const JsonValue &other) const
Equality operator.
Definition: Json.h:453
void Append(const std::string &value)
Append a string value to the array.
Definition: Json.h:1050
JsonObject()
Create a new JsonObject.
Definition: Json.h:895
An implementation of Json Pointers (RFC 6901).
bool Remove(const std::string &key)
Remove the JsonValue with the specified key.
Definition: Json.cpp:639
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:531
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
void AppendRaw(const std::string &value)
Append a raw value to the array.
Definition: Json.h:1143
JsonBool(bool value)
Create a new JsonBool.
Definition: Json.h:774
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:857
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition: Json.h:459
JsonString(const std::string &value)
Create a new JsonString.
Definition: Json.h:285
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition: Json.h:526
virtual JsonValue * LookupElement(const JsonPointer &pointer)
Locate the JsonValue referred to by the JSON Pointer.
Definition: Json.cpp:83
uint32_t leading_fractional_zeros
Definition: Json.h:667
bool ReplaceValue(const std::string &key, JsonValue *value)
Replace the key with the supplied JsonValue.
Definition: Json.cpp:643
bool Value() const
Return the bool value.
Definition: Json.h:790
JsonNumber is the base class for various integer / number classes.
Definition: Json.h:324
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.cpp:763
The const interface for the JsonValueVisitor class.
Definition: Json.h:99
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.cpp:671
int64_t Value() const
Return the int64_t value.
Definition: Json.h:607
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:1173
JsonValue * LookupElementWithIter(JsonPointer::Iterator *iter)
Lookup the Value referred to by the Iterator.
Definition: Json.cpp:571
virtual bool operator==(const JsonValue &other) const =0
Equality operator.
bool operator>(const JsonNumber &other) const
Greater than operator.
Definition: Json.h:346
bool operator<(const JsonNumber &other) const
Less than operator.
Definition: Json.h:522
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition: Json.h:295
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:535
JsonUInt(unsigned int value)
Create a new JsonUInt.
Definition: Json.h:385
JsonNull()
Create a new JsonNull.
Definition: Json.h:816
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition: Json.h:729
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition: Json.h:780
bool InsertElementAt(uint32_t index, JsonValue *value)
Inserts the JsonValue at the specified index.
Definition: Json.cpp:752
static std::string AsString(const DoubleRepresentation &rep)
Convert the DoubleRepresentation to a string.
Definition: Json.cpp:543