Skip to content
JsonData

Operator overloads

JsonData& operator[](const std::string label);
JsonData& operator[](const char label[]);
const JsonData& operator[](const std::string label) const;
const JsonData& operator[](const char label[]) const;

Will call jsonData.GetJsonData().Set(label)



JsonData& operator[](const std::size_t idx);
const JsonData& operator[](const std::size_t idx) const;
JsonData& operator[](const int idx);
const JsonData& operator[](const int idx) const;

Will call jsonData.GetArrayData().At(idx)



JsonData& operator+=(const JsonElement ele);

Will call jsonData.GetJsonData().Add(ele)
and return a reference to the new JsonData object sitting in the JsonBlock.



bool operator==(const JsonData& other) const;
bool operator!=(const JsonData& other) const;

Will call jsonData.IsIdentical(other)



void operator=(const JsonData other) const;

Will call jsonData.CloneFrom(other)



JsonData& operator=(const bool data);

Will call jsonData.SetBoolData(data)
and return itself.



JsonData& operator=(const int data);
JsonData& operator=(const long long int data);

Will call jsonData.SetIntData(data)
and return itself.



JsonData& operator=(const double data);
JsonData& operator=(const long double data);

Will call jsonData.SetFloatData(data)
and return itself.



JsonData& operator=(const std::string data);
JsonData& operator=(const const char data[]);

Will call jsonData.SetStringData(data)
and return itself.



JsonData& operator=(const JsonBlock data);

Will call jsonData.SetJsonData(data)
and return itself.



JsonData& operator=(const JsonArray data);
JsonData& operator=(const std::vector<JsonData> data);

Will call jsonData.SetArrayData(data)
and return itself.



operator bool() const;

Will call jsonData.GetBoolData()



operator int() const;
operator long long int() const;

Will call jsonData.GetIntData()



operator float() const;
operator double() const;
operator long double() const;

Will call jsonData.GetFloatData()



operator std::string() const;
std::ostream& operator<<(std::ostream &os, const JsonData& jd) const;

If this JsonData is of type STRING:
Will call jsonData.GetStringData()
else:
Will call jsonData.Render();