GDAL
|
The JSONArray class JSON array from JSONDocument. More...
#include <cpl_json.h>
Public Types | |
enum class | Type { Unknown , Null , Object , Array , Boolean , String , Integer , Long , Double } |
Json object types. | |
enum class | PrettyFormat { Plain , Spaced , Pretty } |
Json object format to string options. More... | |
Public Member Functions | |
int | Size () const |
Get array size. More... | |
void | AddNull () |
Add null object to array. More... | |
void | Add (const CPLJSONObject &oValue) |
Add json object to array. More... | |
void | Add (const std::string &osValue) |
Add value to array. More... | |
void | Add (const char *pszValue) |
Add value to array. More... | |
void | Add (double dfValue) |
Add value to array. More... | |
void | Add (int nValue) |
Add value to array. More... | |
void | Add (GInt64 nValue) |
Add value to array. More... | |
void | Add (uint64_t nValue) |
Add value to array. More... | |
void | Add (bool bValue) |
Add value to array. More... | |
CPLJSONObject | operator[] (int nIndex) |
Get array item by index. More... | |
const CPLJSONObject | operator[] (int nIndex) const |
Get array const item by index. More... | |
ConstIterator | begin () const |
Iterator to first element. | |
ConstIterator | end () const |
Iterator to after last element. | |
void | Add (const std::string &osName, const std::string &osValue) |
Add new key - value pair to json object. More... | |
void | Add (const std::string &osName, const char *pszValue) |
Add new key - value pair to json object. More... | |
void | Add (const std::string &osName, double dfValue) |
Add new key - value pair to json object. More... | |
void | Add (const std::string &osName, int nValue) |
Add new key - value pair to json object. More... | |
void | Add (const std::string &osName, GInt64 nValue) |
Add new key - value pair to json object. More... | |
void | Add (const std::string &osName, uint64_t nValue) |
Add new key - value pair to json object. More... | |
void | Add (const std::string &osName, const CPLJSONArray &oValue) |
Add new key - value pair to json object. More... | |
void | Add (const std::string &osName, const CPLJSONObject &oValue) |
Add new key - value pair to json object. More... | |
void | Add (const std::string &osName, bool bValue) |
Add new key - value pair to json object. More... | |
void | AddNoSplitName (const std::string &osName, const CPLJSONObject &oValue) |
Add new key - value pair to json object. More... | |
void | AddNull (const std::string &osName) |
Add new key - null pair to json object. More... | |
void | Set (const std::string &osName, const std::string &osValue) |
Change value by key. More... | |
void | Set (const std::string &osName, const char *pszValue) |
Change value by key. More... | |
void | Set (const std::string &osName, double dfValue) |
Change value by key. More... | |
void | Set (const std::string &osName, int nValue) |
Change value by key. More... | |
void | Set (const std::string &osName, GInt64 nValue) |
Change value by key. More... | |
void | Set (const std::string &osName, uint64_t nValue) |
Change value by key. More... | |
void | Set (const std::string &osName, bool bValue) |
Change value by key. More... | |
void | SetNull (const std::string &osName) |
Change value by key. More... | |
std::string | GetString (const std::string &osName, const std::string &osDefault="") const |
Get value by key. More... | |
double | GetDouble (const std::string &osName, double dfDefault=0.0) const |
Get value by key. More... | |
int | GetInteger (const std::string &osName, int nDefault=0) const |
Get value by key. More... | |
GInt64 | GetLong (const std::string &osName, GInt64 nDefault=0) const |
Get value by key. More... | |
bool | GetBool (const std::string &osName, bool bDefault=false) const |
Get value by key. More... | |
std::string | ToString (const std::string &osDefault="") const |
Get value. More... | |
double | ToDouble (double dfDefault=0.0) const |
Get value. More... | |
int | ToInteger (int nDefault=0) const |
Get value. More... | |
GInt64 | ToLong (GInt64 nDefault=0) const |
Get value. More... | |
bool | ToBool (bool bDefault=false) const |
Get value. More... | |
CPLJSONArray | ToArray () const |
Get value. More... | |
std::string | Format (PrettyFormat eFormat) const |
Stringify object to json format. More... | |
void | Delete (const std::string &osName) |
Delete json object by key. More... | |
void | DeleteNoSplitName (const std::string &osName) |
Delete json object by key (without splitting on /) More... | |
CPLJSONArray | GetArray (const std::string &osName) const |
Get value by key. More... | |
CPLJSONObject | GetObj (const std::string &osName) const |
Get value by key. More... | |
CPLJSONObject | operator[] (const std::string &osName) const |
Get value by key. More... | |
Type | GetType () const |
Get json object type. More... | |
std::vector< CPLJSONObject > | GetChildren () const |
Get json object children. More... | |
bool | IsValid () const |
Check if json object valid. More... | |
void | Deinit () |
Decrement reference counter and make pointer NULL. More... | |
Friends | |
class | CPLJSONObject |
class | CPLJSONDocument |
The JSONArray class JSON array from JSONDocument.
|
stronginherited |
void CPLJSONArray::Add | ( | bool | bValue | ) |
Add value to array.
bValue | Value to add. |
void CPLJSONArray::Add | ( | const char * | pszValue | ) |
Add value to array.
pszValue | Value to add. |
void CPLJSONArray::Add | ( | const CPLJSONObject & | oValue | ) |
Add json object to array.
oValue | Json array. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
bValue | Boolean value. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
pszValue | String value. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
oValue | Array value. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
oValue | Json object value. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
osValue | String value. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
dfValue | Double value. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
nValue | Long value. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
nValue | Integer value. |
|
inherited |
Add new key - value pair to json object.
osName | Key name. |
nValue | uint64_t value. |
void CPLJSONArray::Add | ( | const std::string & | osValue | ) |
Add value to array.
osValue | Value to add. |
void CPLJSONArray::Add | ( | double | dfValue | ) |
Add value to array.
dfValue | Value to add. |
void CPLJSONArray::Add | ( | GInt64 | nValue | ) |
Add value to array.
nValue | Value to add. |
void CPLJSONArray::Add | ( | int | nValue | ) |
Add value to array.
nValue | Value to add. |
void CPLJSONArray::Add | ( | uint64_t | nValue | ) |
Add value to array.
nValue | Value to add. |
|
inherited |
Add new key - value pair to json object.
osName | Key name (do not split it on '/') |
oValue | Json object value. |
void CPLJSONArray::AddNull | ( | ) |
Add null object to array.
|
inherited |
Add new key - null pair to json object.
osName | Key name. |
|
inherited |
Decrement reference counter and make pointer NULL.
A json object will become invalid.
|
inherited |
Delete json object by key.
osName | Key name. |
|
inherited |
Delete json object by key (without splitting on /)
osName | Key name. |
|
inherited |
Stringify object to json format.
eFormat | Format type, |
|
inherited |
Get value by key.
osName | Key name. |
|
inherited |
Get value by key.
osName | Key name. |
bDefault | Default value. |
|
inherited |
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.
|
inherited |
Get value by key.
osName | Key name. |
dfDefault | Default value. |
|
inherited |
Get value by key.
osName | Key name. |
nDefault | Default value. |
Get value by key.
osName | Key name. |
nDefault | Default value. |
|
inherited |
Get value by key.
osName | Key name. |
|
inherited |
Get value by key.
osName | Key name. |
osDefault | Default value. |
|
inherited |
Get json object type.
|
inherited |
Check if json object valid.
|
inherited |
Get value by key.
osName | Key name. |
CPLJSONObject CPLJSONArray::operator[] | ( | int | nIndex | ) |
Get array item by index.
nIndex | Item index. |
const CPLJSONObject CPLJSONArray::operator[] | ( | int | nIndex | ) | const |
Get array const item by index.
nIndex | Item index. |
|
inherited |
Change value by key.
osName | Key name. |
bValue | Boolean value. |
|
inherited |
Change value by key.
osName | Key name. |
pszValue | String value. |
|
inherited |
Change value by key.
osName | Key name. |
osValue | String value. |
|
inherited |
Change value by key.
osName | Key name. |
dfValue | Double value. |
|
inherited |
Change value by key.
osName | Key name. |
nValue | Long value. |
|
inherited |
Change value by key.
osName | Key name. |
nValue | Integer value. |
|
inherited |
Change value by key.
osName | Key name. |
nValue | uint64_t value. |
|
inherited |
Change value by key.
osName | Key name. |
int CPLJSONArray::Size | ( | ) | const |
Get array size.
|
inherited |
Get value.
|
inherited |
Get value.
bDefault | Default value. |
|
inherited |
Get value.
dfDefault | Default value. |
|
inherited |
Get value.
nDefault | Default value. |
Get value.
nDefault | Default value. |
|
inherited |
Get value.
osDefault | Default value. |