GDAL
Public Member Functions | Friends | List of all members
CPLJSONArray Class Reference

The JSONArray class JSON array from JSONDocument. More...

#include <cpl_json.h>

Inheritance diagram for CPLJSONArray:
CPLJSONObject

Public Member Functions

int Size () const
 Get array size. 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 (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...
 
- Public Member Functions inherited from CPLJSONObject
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, 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 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, 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 (enum PrettyFormat eFormat) const
 Stringify object to json format. More...
 
void Delete (const std::string &osName)
 Delete json object by key. 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...
 
enum Type GetType () const
 Get json object type. More...
 
std::vector< CPLJSONObjectGetChildren () 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
 

Additional Inherited Members

- Public Types inherited from CPLJSONObject
enum  Type {
  Unknown, Null, Object, Array,
  Boolean, String, Integer, Long,
  Double
}
 Json object types.
 
enum  PrettyFormat { Plain, Spaced, Pretty }
 Json object format to string options. More...
 

Detailed Description

The JSONArray class JSON array from JSONDocument.

Member Function Documentation

◆ Add() [1/7]

void CPLJSONArray::Add ( const CPLJSONObject oValue)

Add json object to array.

Parameters
oValueJson array.
Since
GDAL 2.3

◆ Add() [2/7]

void CPLJSONArray::Add ( const std::string &  osValue)

Add value to array.

Parameters
osValueValue to add.
Since
GDAL 2.3

◆ Add() [3/7]

void CPLJSONArray::Add ( const char *  pszValue)

Add value to array.

Parameters
pszValueValue to add.
Since
GDAL 2.3

◆ Add() [4/7]

void CPLJSONArray::Add ( double  dfValue)

Add value to array.

Parameters
dfValueValue to add.
Since
GDAL 2.3

◆ Add() [5/7]

void CPLJSONArray::Add ( int  nValue)

Add value to array.

Parameters
nValueValue to add.
Since
GDAL 2.3

◆ Add() [6/7]

void CPLJSONArray::Add ( GInt64  nValue)

Add value to array.

Parameters
nValueValue to add.
Since
GDAL 2.3

◆ Add() [7/7]

void CPLJSONArray::Add ( bool  bValue)

Add value to array.

Parameters
bValueValue to add.
Since
GDAL 2.3

◆ operator[]() [1/2]

CPLJSONObject CPLJSONArray::operator[] ( int  nIndex)

Get array item by index.

Parameters
nIndexItem index.
Returns
Json object.
Since
GDAL 2.3

◆ operator[]() [2/2]

const CPLJSONObject CPLJSONArray::operator[] ( int  nIndex) const

Get array const item by index.

Parameters
nIndexItem index.
Returns
Json object.
Since
GDAL 2.3

◆ Size()

int CPLJSONArray::Size ( ) const

Get array size.

Returns
Array size.
Since
GDAL 2.3

The documentation for this class was generated from the following files:

Generated for GDAL by doxygen 1.8.13.