30#ifndef INCLUDE_OLA_WEB_JSON_H_
31#define INCLUDE_OLA_WEB_JSON_H_
51class JsonObjectPropertyVisitor;
52class JsonValueConstVisitorInterface;
53class 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;
341 return *
this == other || *
this < other;
348 return !(*
this <= other);
355 return !(*
this < other);
361 virtual int Compare(
const JsonUInt &value)
const = 0;
362 virtual int Compare(
const JsonInt &value)
const = 0;
363 virtual int Compare(
const JsonUInt64 &value)
const = 0;
364 virtual int Compare(
const JsonInt64 &value)
const = 0;
365 virtual int Compare(
const JsonDouble &value)
const = 0;
367 virtual bool FactorOf(
const JsonUInt &value)
const = 0;
368 virtual bool FactorOf(
const JsonInt &value)
const = 0;
369 virtual bool FactorOf(
const JsonUInt64 &value)
const = 0;
370 virtual bool FactorOf(
const JsonInt64 &value)
const = 0;
371 virtual bool FactorOf(
const JsonDouble &value)
const = 0;
386 explicit JsonUInt(
unsigned int value) : m_value(value) {}
391 return other.Compare(*
this) == 1;
395 return other.FactorOf(*
this);
400 visitor->Visit(*
this);
408 unsigned int Value()
const {
return m_value; }
413 bool Equals(
const JsonUInt &other)
const {
414 return m_value == other.m_value;
417 bool Equals(
const JsonInt &other)
const;
418 bool Equals(
const JsonUInt64 &other)
const;
419 bool Equals(
const JsonInt64 &other)
const;
421 int Compare(
const JsonUInt &value)
const;
422 int Compare(
const JsonInt &value)
const;
423 int Compare(
const JsonUInt64 &value)
const;
424 int Compare(
const JsonInt64 &value)
const;
425 int Compare(
const JsonDouble &value)
const;
427 bool FactorOf(
const JsonUInt &value)
const;
428 bool FactorOf(
const JsonInt &value)
const;
429 bool FactorOf(
const JsonUInt64 &value)
const;
430 bool FactorOf(
const JsonInt64 &value)
const;
431 bool FactorOf(
const JsonDouble &value)
const;
437 const unsigned int m_value;
453 explicit JsonInt(
int value) : m_value(value) {}
458 return other.Compare(*
this) == 1;
462 return other.FactorOf(*
this);
467 visitor->Visit(*
this);
475 int Value()
const {
return m_value; }
480 bool Equals(
const JsonInt &other)
const {
481 return m_value == other.m_value;
484 bool Equals(
const JsonUInt &other)
const;
485 bool Equals(
const JsonUInt64 &other)
const;
486 bool Equals(
const JsonInt64 &other)
const;
488 int Compare(
const JsonUInt &value)
const;
489 int Compare(
const JsonInt &value)
const;
490 int Compare(
const JsonUInt64 &value)
const;
491 int Compare(
const JsonInt64 &value)
const;
492 int Compare(
const JsonDouble &value)
const;
494 bool FactorOf(
const JsonUInt &value)
const;
495 bool FactorOf(
const JsonInt &value)
const;
496 bool FactorOf(
const JsonUInt64 &value)
const;
497 bool FactorOf(
const JsonInt64 &value)
const;
498 bool FactorOf(
const JsonDouble &value)
const;
522 return other.Equals(*
this);
526 return other.Compare(*
this) == 1;
530 return other.FactorOf(*
this);
535 visitor->Visit(*
this);
543 uint64_t
Value()
const {
return m_value; }
549 return m_value == other.m_value;
552 bool Equals(
const JsonUInt &other)
const;
553 bool Equals(
const JsonInt &other)
const;
554 bool Equals(
const JsonInt64 &other)
const;
556 int Compare(
const JsonUInt &value)
const;
557 int Compare(
const JsonInt &value)
const;
559 int Compare(
const JsonInt64 &value)
const;
560 int Compare(
const JsonDouble &value)
const;
562 bool FactorOf(
const JsonUInt &value)
const;
563 bool FactorOf(
const JsonInt &value)
const;
565 bool FactorOf(
const JsonInt64 &value)
const;
566 bool FactorOf(
const JsonDouble &value)
const;
571 const uint64_t m_value;
590 return other.Equals(*
this);
594 return other.Compare(*
this) == 1;
598 return other.FactorOf(*
this);
603 visitor->Visit(*
this);
611 int64_t
Value()
const {
return m_value; }
616 bool Equals(
const JsonInt64 &other)
const {
617 return m_value == other.m_value;
620 bool Equals(
const JsonUInt &other)
const;
621 bool Equals(
const JsonInt &other)
const;
622 bool Equals(
const JsonUInt64 &other)
const;
624 int Compare(
const JsonUInt &value)
const;
625 int Compare(
const JsonInt &value)
const;
626 int Compare(
const JsonUInt64 &value)
const;
627 int Compare(
const JsonInt64 &value)
const;
628 int Compare(
const JsonDouble &value)
const;
630 bool FactorOf(
const JsonUInt &value)
const;
631 bool FactorOf(
const JsonInt &value)
const;
632 bool FactorOf(
const JsonUInt64 &value)
const;
633 bool FactorOf(
const JsonInt64 &value)
const;
634 bool FactorOf(
const JsonDouble &value)
const;
639 const int64_t m_value;
691 return other.Equals(*
this);
695 return other.Compare(*
this) == 1;
699 return other.FactorOf(*
this);
704 visitor->Visit(*
this);
710 const std::string&
ToString()
const {
return m_as_string; }
717 double Value()
const {
return m_value; }
725 static bool AsDouble(
const DoubleRepresentation &rep,
double *out);
732 static std::string
AsString(
const DoubleRepresentation &rep);
745 return m_value == other.m_value;
748 int Compare(
const JsonUInt &value)
const;
749 int Compare(
const JsonInt &value)
const;
750 int Compare(
const JsonUInt64 &value)
const;
751 int Compare(
const JsonInt64 &value)
const;
754 bool FactorOf(
const JsonUInt &value)
const;
755 bool FactorOf(
const JsonInt &value)
const;
756 bool FactorOf(
const JsonUInt64 &value)
const;
757 bool FactorOf(
const JsonInt64 &value)
const;
764 std::string m_as_string;
783 return other.Equals(*
this);
788 visitor->Visit(*
this);
796 bool Value()
const {
return m_value; }
801 bool Equals(
const JsonBool &other)
const {
802 return m_value == other.m_value;
827 visitor->Visit(*
this);
837 bool Equals(
const JsonNull &)
const {
return true; }
862 visitor->Visit(*
this);
870 const std::string&
Value()
const {
return m_value; }
876 return m_value == other.m_value;
883 const std::string m_value;
910 return other.Equals(*
this);
920 void Add(
const std::string &key,
const std::string &value);
927 void Add(
const std::string &key,
const char *value);
934 void Add(
const std::string &key,
unsigned int i);
941 void Add(
const std::string &key,
int i);
948 void Add(
const std::string &key,
double d);
955 void Add(
const std::string &key,
bool value);
961 void Add(
const std::string &key);
989 void AddRaw(
const std::string &key,
const std::string &value);
996 bool Remove(
const std::string &key);
1010 visitor->Visit(*
this);
1019 bool IsEmpty()
const {
return m_members.empty(); }
1021 unsigned int Size()
const {
return m_members.size(); }
1031 typedef std::map<std::string, JsonValue*> MemberMap;
1032 MemberMap m_members;
1051 return other.Equals(*
this);
1077 m_values.push_back(
new JsonUInt(i));
1085 m_values.push_back(
new JsonInt(i));
1093 m_values.push_back(
new JsonBool(value));
1100 m_values.push_back(
new JsonNull());
1107 m_values.push_back(value);
1114 m_values.push_back(value);
1115 m_complex_type |= !value->
IsEmpty();
1125 m_values.push_back(obj);
1126 m_complex_type =
true;
1137 m_values.push_back(array);
1138 m_complex_type =
true;
1147 m_values.push_back(value);
1184 visitor->Visit(*
this);
1198 unsigned int Size()
const {
return m_values.size(); }
1212 typedef std::vector<JsonValue*> ValuesVector;
1213 ValuesVector m_values;
1216 bool m_complex_type;
1256std::ostream& operator<<(std::ostream &os,
const JsonString &value);
1257std::ostream& operator<<(std::ostream &os,
const JsonUInt &value);
1258std::ostream& operator<<(std::ostream &os,
const JsonInt &value);
1259std::ostream& operator<<(std::ostream &os,
const JsonUInt64 &value);
1260std::ostream& operator<<(std::ostream &os,
const JsonInt64 &value);
1261std::ostream& operator<<(std::ostream &os,
const JsonDouble &value);
1262std::ostream& operator<<(std::ostream &os,
const JsonBool &value);
1263std::ostream& operator<<(std::ostream &os,
const JsonNull &value);
1264std::ostream& operator<<(std::ostream &os,
const JsonRawValue &value);
1268inline JsonNumber* JsonValue::NewNumberValue<uint32_t>(
1269 const uint32_t &value) {
1274inline JsonNumber* JsonValue::NewNumberValue<int32_t>(
1275 const int32_t &value) {
1276 return new JsonInt(value);
1280inline JsonNumber* JsonValue::NewNumberValue<uint64_t>(
1281 const uint64_t &value) {
1282 return new JsonUInt64(value);
1286inline JsonNumber* JsonValue::NewNumberValue<int64_t>(
1287 const int64_t &value) {
1288 return new JsonInt64(value);
1292inline JsonNumber* JsonValue::NewNumberValue<double>(
1293 const double &value) {
1294 return new JsonDouble(value);
1298inline JsonNumber* JsonValue::NewNumberValue<
1299 JsonDouble::DoubleRepresentation>(
1300 const JsonDouble::DoubleRepresentation &value) {
1301 return new JsonDouble(value);
1306inline JsonValue* JsonValue::NewValue<std::string>(
const std::string &value) {
1307 return new JsonString(value);
1311inline JsonValue* JsonValue::NewValue<uint32_t>(
const uint32_t &value) {
1312 return NewNumberValue(value);
1316inline JsonValue* JsonValue::NewValue<int32_t>(
const int32_t &value) {
1317 return NewNumberValue(value);
1321inline JsonValue* JsonValue::NewValue<uint64_t>(
const uint64_t &value) {
1322 return NewNumberValue(value);
1326inline JsonValue* JsonValue::NewValue<int64_t>(
const int64_t &value) {
1327 return NewNumberValue(value);
1331inline JsonValue* JsonValue::NewValue<double>(
const double &value) {
1332 return NewNumberValue(value);
1336inline JsonValue* JsonValue::NewValue<JsonDouble::DoubleRepresentation>(
1337 const JsonDouble::DoubleRepresentation &value) {
1338 return NewNumberValue(value);
1342inline JsonValue* JsonValue::NewValue<bool>(
const bool &value) {
1343 return new JsonBool(value);
An implementation of Json Pointers (RFC 6901).
Various string utility functions.
An array of JSON values. Arrays in JSON can contain values of different types.
Definition Json.h:1043
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.cpp:763
bool IsEmpty() const
Check if there are elements within the array.
Definition Json.h:1193
void Append(const char *value)
Append a string value to the array.
Definition Json.h:1068
void Append(JsonObject *value)
Append a JsonValue. Takes ownership of the pointer.
Definition Json.h:1113
const JsonValue * ElementAt(unsigned int i) const
Return the element at index i.
Definition Json.cpp:772
bool Equals(const JsonArray &other) const
Check if this JsonValue equals a JsonArray.
Definition Json.cpp:714
void Append(JsonValue *value)
Append a JsonValue. Takes ownership of the pointer.
Definition Json.h:1106
void Append(const std::string &value)
Append a string value to the array.
Definition Json.h:1060
void AppendRaw(const std::string &value)
Append a raw value to the array.
Definition Json.h:1153
JsonArray * AppendArray()
Append a JsonArray to the array.
Definition Json.h:1135
void Append(unsigned int i)
Append an unsigned int value to the array.
Definition Json.h:1076
bool IsComplexType() const
Return true if this array contains nested arrays or objects.
Definition Json.h:1209
void AppendValue(JsonValue *value)
Append a JsonValue to the array.
Definition Json.h:1146
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:1183
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:1182
void Append(int i)
Append an int value to the array.
Definition Json.h:1084
bool RemoveElementAt(uint32_t index)
Remove the JsonValue at the specified index.
Definition Json.cpp:730
JsonObject * AppendObject()
Append a JsonObject to the array.
Definition Json.h:1123
unsigned int Size() const
Return the number of elements in the array.
Definition Json.h:1198
bool ReplaceElementAt(uint32_t index, JsonValue *value)
Replace the JsonValue at the specified index.
Definition Json.cpp:740
void Append()
Append a null value to the array.
Definition Json.h:1099
void Append(bool value)
Append a bool value to the array.
Definition Json.h:1092
JsonValue * LookupElementWithIter(JsonPointer::Iterator *iter)
Lookup the Value referred to by the Iterator.
Definition Json.cpp:691
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:1050
bool InsertElementAt(uint32_t index, JsonValue *value)
Inserts the JsonValue at the specified index.
Definition Json.cpp:752
A Bool value.
Definition Json.h:774
bool Value() const
Return the bool value.
Definition Json.h:796
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:782
JsonBool(bool value)
Create a new JsonBool.
Definition Json.h:780
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:786
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:791
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:787
A double value.
Definition Json.h:654
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:703
static bool AsDouble(const DoubleRepresentation &rep, double *out)
Convert a DoubleRepresentation to a double value.
Definition Json.cpp:524
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:734
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:690
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:702
const std::string & ToString() const
Return the double value as a string.
Definition Json.h:710
double Value() const
Returns the value as a double.
Definition Json.h:717
bool operator<(const JsonNumber &other) const
Less than operator.
Definition Json.h:694
static std::string AsString(const DoubleRepresentation &rep)
Convert the DoubleRepresentation to a string.
Definition Json.cpp:543
JsonDouble(double value)
Create a new JsonDouble.
Definition Json.cpp:512
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition Json.h:698
A signed 64bit int value.
Definition Json.h:581
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:589
JsonInt64(int64_t value)
Create a new JsonInt64.
Definition Json.h:587
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:601
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:602
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition Json.h:597
int64_t Value() const
Return the int64_t value.
Definition Json.h:611
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:606
bool operator<(const JsonNumber &other) const
Less than operator.
Definition Json.h:593
A signed 32bit int value.
Definition Json.h:447
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition Json.h:461
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:455
bool operator<(const JsonNumber &other) const
Less than operator.
Definition Json.h:457
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:470
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:465
JsonInt(int value)
Create a new JsonInt.
Definition Json.h:453
int Value() const
Return the int32_t value.
Definition Json.h:475
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:466
A base class used to describe values which are leafs of a JSON tree.
Definition Json.h:265
The null value.
Definition Json.h:818
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:832
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:825
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:830
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:826
JsonNull()
Create a new JsonNull.
Definition Json.h:823
JsonNumber is the base class for various integer / number classes.
Definition Json.h:325
bool operator<=(const JsonNumber &other) const
Less than or equals operator.
Definition Json.h:340
virtual bool MultipleOf(const JsonNumber &other) const =0
Checks if the remainder if non-0;.
bool operator>(const JsonNumber &other) const
Greater than operator.
Definition Json.h:347
virtual bool operator<(const JsonNumber &other) const =0
Less than operator.
bool operator>=(const JsonNumber &other) const
Greater than or equals operator.
Definition Json.h:354
A JSON object. JSON Objects are key : value mappings, similar to dictionaries in Python.
Definition Json.h:899
bool Remove(const std::string &key)
Remove the JsonValue with the specified key.
Definition Json.cpp:639
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:1008
JsonValue * LookupElementWithIter(JsonPointer::Iterator *iter)
Lookup the Value referred to by the Iterator.
Definition Json.cpp:571
void AddValue(const std::string &key, JsonValue *value)
Set the key to the supplied JsonValue.
Definition Json.cpp:667
bool ReplaceValue(const std::string &key, JsonValue *value)
Replace the key with the supplied JsonValue.
Definition Json.cpp:643
bool Equals(const JsonObject &other) const
Check if this JsonValue equals a JsonObject.
Definition Json.cpp:590
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:1009
bool IsEmpty() const
Check if there are properties within the object.
Definition Json.h:1019
void AddRaw(const std::string &key, const std::string &value)
Set the given key to a raw value.
Definition Json.cpp:635
void Add(const std::string &key, const std::string &value)
Add a key to string mapping.
Definition Json.cpp:607
void VisitProperties(JsonObjectPropertyVisitor *visitor) const
Visit each of the properties in this object.
Definition Json.cpp:680
JsonObject()
Create a new JsonObject.
Definition Json.h:904
JsonObject * AddObject(const std::string &key)
Set the given key to a JsonObject.
Definition Json.cpp:655
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:909
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.cpp:671
class JsonArray * AddArray(const std::string &key)
Set the given key to a JsonArray.
Definition Json.cpp:661
A class used to visit Json values within a JsonObject.
Definition Json.h:1226
virtual void VisitProperty(const std::string &property, const JsonValue &value)=0
Visit the value at the given property.
An iterator for traversing a JsonPointer.
Definition JsonPointer.h:74
A JSON pointer (RFC 6901) refers to a possible element in a JSON data structure.
Definition JsonPointer.h:66
A raw value, useful if you want to cheat.
Definition Json.h:850
const std::string & Value() const
Return the raw value as a string.
Definition Json.h:870
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:865
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:861
JsonRawValue(const std::string &value)
Create a new JsonRawValue.
Definition Json.h:856
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:858
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:860
A string value.
Definition Json.h:279
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:294
JsonString(const std::string &value)
Create a new JsonString.
Definition Json.h:285
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:299
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:287
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:295
const std::string & Value() const
Return the string value.
Definition Json.h:292
An unsigned 64bit int value.
Definition Json.h:513
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:534
JsonUInt64(uint64_t value)
Create a new JsonUInt64.
Definition Json.h:519
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:533
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition Json.h:529
uint64_t Value() const
Return the uint64_t value.
Definition Json.h:543
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:521
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:538
bool operator<(const JsonNumber &other) const
Less than operator.
Definition Json.h:525
An unsigned 32bit int value.
Definition Json.h:380
void Accept(JsonValueVisitorInterface *visitor)
The Accept method for the visitor pattern.
Definition Json.h:398
void Accept(JsonValueConstVisitorInterface *visitor) const
The Accept (const) method for the visitor pattern.
Definition Json.h:399
JsonValue * Clone() const
Make a copy of this JsonValue.
Definition Json.h:403
unsigned int Value() const
Return the uint32_t value.
Definition Json.h:408
JsonUInt(unsigned int value)
Create a new JsonUInt.
Definition Json.h:386
bool operator==(const JsonValue &other) const
Equality operator.
Definition Json.h:388
bool operator<(const JsonNumber &other) const
Less than operator.
Definition Json.h:390
bool MultipleOf(const JsonNumber &other) const
Checks if the remainder if non-0;.
Definition Json.h:394
The const interface for the JsonValueVisitor class.
Definition Json.h:99
The base class for JSON values.
Definition Json.h:119
virtual JsonValue * Clone() const =0
Make a copy of this JsonValue.
virtual bool operator==(const JsonValue &other) const =0
Equality operator.
virtual bool operator!=(const JsonValue &other) const
Not-equals operator.
Definition Json.h:139
virtual void Accept(JsonValueConstVisitorInterface *visitor) const =0
The Accept (const) method for the visitor pattern.
virtual void Accept(JsonValueVisitorInterface *visitor)=0
The Accept method for the visitor pattern.
virtual JsonValue * LookupElement(const JsonPointer &pointer)
Locate the JsonValue referred to by the JSON Pointer.
Definition Json.cpp:83
The interface for the JsonValueVisitor class.
Definition Json.h:75
JsonArray * ArrayCast(JsonValue *value)
Downcast a JsonValue to a JsonArray.
Definition Json.cpp:795
JsonObject * ObjectCast(JsonValue *value)
Downcast a JsonValue to a JsonObject.
Definition Json.cpp:780
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
Represents a JSON double value broken down as separate components.
Definition Json.h:666
bool is_negative
Definition Json.h:668
uint64_t full
Definition Json.h:670
int32_t exponent
Definition Json.h:676
uint32_t leading_fractional_zeros
Definition Json.h:672
uint64_t fractional
Definition Json.h:674