The CPLJSONDocument class Wrapper class around json-c library.
More...
#include <cpl_json.h>
|
bool | Save (const std::string &osPath) |
| Save json document at specified path. More...
|
|
std::string | SaveAsString () |
| Return the json document as a serialized string. More...
|
|
CPLJSONObject | GetRoot () |
| Get json document root object. More...
|
|
bool | Load (const std::string &osPath) |
| Load json document from file by provided path. More...
|
|
bool | LoadMemory (const std::string &osStr) |
| Load json document from memory buffer. More...
|
|
bool | LoadMemory (const GByte *pabyData, int nLength=-1) |
| Load json document from memory buffer. More...
|
|
bool | LoadChunks (const std::string &osPath, size_t nChunkSize=16384, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr) |
| Load json document from file using small chunks of data. More...
|
|
bool | LoadUrl (const std::string &osUrl, char **papszOptions, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr) |
| Load json document from web. More...
|
|
The CPLJSONDocument class Wrapper class around json-c library.
◆ GetRoot()
Get json document root object.
- Returns
- CPLJSONObject class instance
- Since
- GDAL 2.3
◆ Load()
bool CPLJSONDocument::Load |
( |
const std::string & |
osPath | ) |
|
Load json document from file by provided path.
- Parameters
-
- Returns
- true on success. If error occurred it can be received using CPLGetLastErrorMsg method.
- Since
- GDAL 2.3
◆ LoadChunks()
bool CPLJSONDocument::LoadChunks |
( |
const std::string & |
osPath, |
|
|
size_t |
nChunkSize = 16384 , |
|
|
GDALProgressFunc |
pfnProgress = nullptr , |
|
|
void * |
pProgressArg = nullptr |
|
) |
| |
Load json document from file using small chunks of data.
- Parameters
-
osPath | Path to json document file. |
nChunkSize | Chunk size. |
pfnProgress | a function to report progress of the json data loading. |
pProgressArg | application data passed into progress function. |
- Returns
- true on success. If error occurred it can be received using CPLGetLastErrorMsg method.
- Since
- GDAL 2.3
◆ LoadMemory() [1/2]
bool CPLJSONDocument::LoadMemory |
( |
const std::string & |
osStr | ) |
|
Load json document from memory buffer.
- Parameters
-
- Returns
- true on success. If error occurred it can be received using CPLGetLastErrorMsg method.
- Since
- GDAL 2.3
◆ LoadMemory() [2/2]
bool CPLJSONDocument::LoadMemory |
( |
const GByte * |
pabyData, |
|
|
int |
nLength = -1 |
|
) |
| |
Load json document from memory buffer.
- Parameters
-
pabyData | Buffer.data. |
nLength | Buffer size. |
- Returns
- true on success. If error occurred it can be received using CPLGetLastErrorMsg method.
- Since
- GDAL 2.3
◆ LoadUrl()
bool CPLJSONDocument::LoadUrl |
( |
const std::string & |
osUrl, |
|
|
char ** |
papszOptions, |
|
|
GDALProgressFunc |
pfnProgress = nullptr , |
|
|
void * |
pProgressArg = nullptr |
|
) |
| |
Load json document from web.
- Parameters
-
osUrl | Url to json document. |
papszOptions | Option list as a NULL-terminated array of strings. May be NULL. The available keys are same for CPLHTTPFetch method. Additional key JSON_DEPTH define json parse depth. Default is 10. |
pfnProgress | a function to report progress of the json data loading. |
pProgressArg | application data passed into progress function. |
- Returns
- true on success. If error occurred it can be received using CPLGetLastErrorMsg method.
- Since
- GDAL 2.3
◆ Save()
bool CPLJSONDocument::Save |
( |
const std::string & |
osPath | ) |
|
Save json document at specified path.
- Parameters
-
osPath | Path to save json document |
- Returns
- true on success. If error occurred it can be received using CPLGetLastErrorMsg method.
- Since
- GDAL 2.3
◆ SaveAsString()
std::string CPLJSONDocument::SaveAsString |
( |
| ) |
|
Return the json document as a serialized string.
- Returns
- serialized document.
- Since
- GDAL 2.3
The documentation for this class was generated from the following files: