OGR
|
The CPLJSONArray class holds JSON object from CPLJSONDocument. More...
#include <cpl_json.h>
Public Types | |
enum | Type |
enum | PrettyFormat { Plain, Spaced, Pretty } |
Public Member Functions | |
void | Add (const std::string &osName, const std::string &osValue) |
void | Add (const std::string &osName, const char *pszValue) |
void | Add (const std::string &osName, double dfValue) |
void | Add (const std::string &osName, int nValue) |
void | Add (const std::string &osName, GInt64 nValue) |
void | Add (const std::string &osName, const CPLJSONArray &oValue) |
void | Add (const std::string &osName, const CPLJSONObject &oValue) |
void | Add (const std::string &osName, bool bValue) |
void | AddNull (const std::string &osName) |
void | Set (const std::string &osName, const std::string &osValue) |
void | Set (const std::string &osName, const char *pszValue) |
void | Set (const std::string &osName, double dfValue) |
void | Set (const std::string &osName, int nValue) |
void | Set (const std::string &osName, GInt64 nValue) |
void | Set (const std::string &osName, bool bValue) |
void | SetNull (const std::string &osName) |
std::string | GetString (const std::string &osName, const std::string &osDefault="") const |
double | GetDouble (const std::string &osName, double dfDefault=0.0) const |
int | GetInteger (const std::string &osName, int nDefault=0) const |
GInt64 | GetLong (const std::string &osName, GInt64 nDefault=0) const |
bool | GetBool (const std::string &osName, bool bDefault=false) const |
std::string | ToString (const std::string &osDefault="") const |
double | ToDouble (double dfDefault=0.0) const |
int | ToInteger (int nDefault=0) const |
GInt64 | ToLong (GInt64 nDefault=0) const |
bool | ToBool (bool bDefault=false) const |
CPLJSONArray | ToArray () const |
std::string | Format (enum PrettyFormat eFormat) const |
void | Delete (const std::string &osName) |
CPLJSONArray | GetArray (const std::string &osName) const |
CPLJSONObject | GetObj (const std::string &osName) const |
CPLJSONObject | operator[] (const std::string &osName) const |
enum Type | GetType () const |
std::vector< CPLJSONObject > | GetChildren () const |
Get json object children. More... | |
bool | IsValid () const |
void | Deinit () |
Friends | |
class | CPLJSONArray |
class | CPLJSONDocument |
The CPLJSONArray class holds JSON object from CPLJSONDocument.
enum CPLJSONObject::Type |
Json object types
void CPLJSONObject::Add | ( | const std::string & | osName, |
const std::string & | osValue | ||
) |
void CPLJSONObject::Add | ( | const std::string & | osName, |
const char * | pszValue | ||
) |
Add new key - value pair to json object.
osName | Key name. |
pszValue | String value. |
References IsValid().
void CPLJSONObject::Add | ( | const std::string & | osName, |
double | dfValue | ||
) |
Add new key - value pair to json object.
osName | Key name. |
dfValue | Double value. |
References IsValid().
void CPLJSONObject::Add | ( | const std::string & | osName, |
int | nValue | ||
) |
Add new key - value pair to json object.
osName | Key name. |
nValue | Integer value. |
References IsValid().
void CPLJSONObject::Add | ( | const std::string & | osName, |
GInt64 | nValue | ||
) |
Add new key - value pair to json object.
osName | Key name. |
nValue | Long value. |
References IsValid().
void CPLJSONObject::Add | ( | const std::string & | osName, |
const CPLJSONArray & | oValue | ||
) |
Add new key - value pair to json object.
osName | Key name. |
oValue | Array value. |
References IsValid().
void CPLJSONObject::Add | ( | const std::string & | osName, |
const CPLJSONObject & | oValue | ||
) |
Add new key - value pair to json object.
osName | Key name. |
oValue | Json object value. |
References IsValid().
void CPLJSONObject::Add | ( | const std::string & | osName, |
bool | bValue | ||
) |
Add new key - value pair to json object.
osName | Key name. |
bValue | Boolean value. |
References IsValid().
void CPLJSONObject::AddNull | ( | const std::string & | osName | ) |
void CPLJSONObject::Deinit | ( | ) |
Decrement reference counter and make pointer NULL. A json object will become invalid.
void CPLJSONObject::Delete | ( | const std::string & | osName | ) |
std::string CPLJSONObject::Format | ( | enum PrettyFormat | eFormat | ) | const |
CPLJSONArray CPLJSONObject::GetArray | ( | const std::string & | osName | ) | const |
Get value by key.
osName | Key name. |
References IsValid().
bool CPLJSONObject::GetBool | ( | const std::string & | osName, |
bool | bDefault = false |
||
) | const |
Get value by key.
osName | Key name. |
bDefault | Default value. |
References GetObj().
std::vector< CPLJSONObject > CPLJSONObject::GetChildren | ( | ) | const |
Get json object children.
This function is useful when keys is not know and need to iterate over json object items and get keys and values.
double CPLJSONObject::GetDouble | ( | const std::string & | osName, |
double | dfDefault = 0.0 |
||
) | const |
Get value by key.
osName | Key name. |
dfDefault | Default value. |
References GetObj().
int CPLJSONObject::GetInteger | ( | const std::string & | osName, |
int | nDefault = 0 |
||
) | const |
Get value by key.
osName | Key name. |
nDefault | Default value. |
References GetObj().
Get value by key.
osName | Key name. |
nDefault | Default value. |
References GetObj().
CPLJSONObject CPLJSONObject::GetObj | ( | const std::string & | osName | ) | const |
Get value by key.
osName | Key name. |
References IsValid().
Referenced by GetBool(), GetDouble(), GetInteger(), GetLong(), GetString(), and operator[]().
std::string CPLJSONObject::GetString | ( | const std::string & | osName, |
const std::string & | osDefault = "" |
||
) | const |
Get value by key.
osName | Key name. |
osDefault | Default value. |
References GetObj().
CPLJSONObject::Type CPLJSONObject::GetType | ( | ) | const |
Get json object type.
bool CPLJSONObject::IsValid | ( | ) | const |
Check if json object valid.
Referenced by Add(), AddNull(), OGRGeometryFactory::createFromGeoJson(), Delete(), GetArray(), and GetObj().
CPLJSONObject CPLJSONObject::operator[] | ( | const std::string & | osName | ) | const |
void CPLJSONObject::Set | ( | const std::string & | osName, |
const std::string & | osValue | ||
) |
void CPLJSONObject::Set | ( | const std::string & | osName, |
const char * | pszValue | ||
) |
void CPLJSONObject::Set | ( | const std::string & | osName, |
double | dfValue | ||
) |
void CPLJSONObject::Set | ( | const std::string & | osName, |
int | nValue | ||
) |
void CPLJSONObject::Set | ( | const std::string & | osName, |
GInt64 | nValue | ||
) |
void CPLJSONObject::Set | ( | const std::string & | osName, |
bool | bValue | ||
) |
void CPLJSONObject::SetNull | ( | const std::string & | osName | ) |
CPLJSONArray CPLJSONObject::ToArray | ( | ) | const |
Get value.
bool CPLJSONObject::ToBool | ( | bool | bDefault = false | ) | const |
Get value.
bDefault | Default value. |
double CPLJSONObject::ToDouble | ( | double | dfDefault = 0.0 | ) | const |
Get value
dfDefault | Default value. |
int CPLJSONObject::ToInteger | ( | int | nDefault = 0 | ) | const |
Get value.
nDefault | Default value. |
Get value.
nDefault | Default value. |
std::string CPLJSONObject::ToString | ( | const std::string & | osDefault = "" | ) | const |
Get value.
osDefault | Default value. |