|
GDAL
|
The CPLJSONArray class holds JSON object from CPLJSONDocument. 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 | |
| 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 | AddNoSplitName (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 | 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 | CPLJSONArray |
| class | CPLJSONDocument |
The CPLJSONArray class holds JSON object from CPLJSONDocument.
|
strong |
| void CPLJSONObject::Add | ( | const std::string & | osName, |
| bool | bValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name. |
| bValue | Boolean value. |
| void CPLJSONObject::Add | ( | const std::string & | osName, |
| const char * | pszValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name. |
| pszValue | String value. |
| void CPLJSONObject::Add | ( | const std::string & | osName, |
| const CPLJSONArray & | oValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name. |
| oValue | Array value. |
| 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. |
| void CPLJSONObject::Add | ( | const std::string & | osName, |
| const std::string & | osValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name. |
| osValue | String value. |
| void CPLJSONObject::Add | ( | const std::string & | osName, |
| double | dfValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name. |
| dfValue | Double value. |
| void CPLJSONObject::Add | ( | const std::string & | osName, |
| GInt64 | nValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name. |
| nValue | Long value. |
| void CPLJSONObject::Add | ( | const std::string & | osName, |
| int | nValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name. |
| nValue | Integer value. |
| void CPLJSONObject::Add | ( | const std::string & | osName, |
| uint64_t | nValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name. |
| nValue | uint64_t value. |
| void CPLJSONObject::AddNoSplitName | ( | const std::string & | osName, |
| const CPLJSONObject & | oValue | ||
| ) |
Add new key - value pair to json object.
| osName | Key name (do not split it on '/') |
| oValue | Json object value. |
| void CPLJSONObject::AddNull | ( | const std::string & | osName | ) |
Add new key - null pair to json object.
| osName | Key name. |
| void CPLJSONObject::Deinit | ( | ) |
Decrement reference counter and make pointer NULL.
A json object will become invalid.
| void CPLJSONObject::Delete | ( | const std::string & | osName | ) |
Delete json object by key.
| osName | Key name. |
| void CPLJSONObject::DeleteNoSplitName | ( | const std::string & | osName | ) |
Delete json object by key (without splitting on /)
| osName | Key name. |
| std::string CPLJSONObject::Format | ( | PrettyFormat | eFormat | ) | const |
Stringify object to json format.
| eFormat | Format type, |
| CPLJSONArray CPLJSONObject::GetArray | ( | const std::string & | osName | ) | const |
Get value by key.
| osName | Key name. |
| bool CPLJSONObject::GetBool | ( | const std::string & | osName, |
| bool | bDefault = false |
||
| ) | const |
Get value by key.
| osName | Key name. |
| bDefault | Default value. |
| 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. |
| int CPLJSONObject::GetInteger | ( | const std::string & | osName, |
| int | nDefault = 0 |
||
| ) | const |
Get value by key.
| osName | Key name. |
| nDefault | Default value. |
Get value by key.
| osName | Key name. |
| nDefault | Default value. |
| CPLJSONObject CPLJSONObject::GetObj | ( | const std::string & | osName | ) | const |
Get value by key.
| osName | Key name. |
| std::string CPLJSONObject::GetString | ( | const std::string & | osName, |
| const std::string & | osDefault = "" |
||
| ) | const |
Get value by key.
| osName | Key name. |
| osDefault | Default value. |
| CPLJSONObject::Type CPLJSONObject::GetType | ( | ) | const |
Get json object type.
| bool CPLJSONObject::IsValid | ( | ) | const |
Check if json object valid.
| CPLJSONObject CPLJSONObject::operator[] | ( | const std::string & | osName | ) | const |
Get value by key.
| osName | Key name. |
| void CPLJSONObject::Set | ( | const std::string & | osName, |
| bool | bValue | ||
| ) |
Change value by key.
| osName | Key name. |
| bValue | Boolean value. |
| void CPLJSONObject::Set | ( | const std::string & | osName, |
| const char * | pszValue | ||
| ) |
Change value by key.
| osName | Key name. |
| pszValue | String value. |
| void CPLJSONObject::Set | ( | const std::string & | osName, |
| const std::string & | osValue | ||
| ) |
Change value by key.
| osName | Key name. |
| osValue | String value. |
| void CPLJSONObject::Set | ( | const std::string & | osName, |
| double | dfValue | ||
| ) |
Change value by key.
| osName | Key name. |
| dfValue | Double value. |
| void CPLJSONObject::Set | ( | const std::string & | osName, |
| GInt64 | nValue | ||
| ) |
Change value by key.
| osName | Key name. |
| nValue | Long value. |
| void CPLJSONObject::Set | ( | const std::string & | osName, |
| int | nValue | ||
| ) |
Change value by key.
| osName | Key name. |
| nValue | Integer value. |
| void CPLJSONObject::Set | ( | const std::string & | osName, |
| uint64_t | nValue | ||
| ) |
Change value by key.
| osName | Key name. |
| nValue | uint64_t value. |
| void CPLJSONObject::SetNull | ( | const std::string & | osName | ) |
Change value by key.
| osName | Key name. |
| 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. |