OGR
|
The CPLJSONDocument class Wrapper class around json-c library. More...
#include <cpl_json.h>
Public Member Functions | |
bool | Save (const std::string &osPath) |
std::string | SaveAsString () |
CPLJSONObject | GetRoot () |
bool | Load (const std::string &osPath) |
bool | LoadMemory (const std::string &osStr) |
bool | LoadMemory (const GByte *pabyData, int nLength=-1) |
bool | LoadChunks (const std::string &osPath, size_t nChunkSize=16384, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr) |
bool | LoadUrl (const std::string &osUrl, char **papszOptions, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr) |
The CPLJSONDocument class Wrapper class around json-c library.
CPLJSONObject CPLJSONDocument::GetRoot | ( | ) |
Get json document root object
Referenced by OGRGeometryFactory::createFromGeoJson().
bool CPLJSONDocument::Load | ( | const std::string & | osPath | ) |
Load json document from file by provided path
osPath | Path to json file. |
References CPLError(), and VSIIngestFile().
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.
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. |
References CPLError(), and VSIStatL().
bool CPLJSONDocument::LoadMemory | ( | const std::string & | osStr | ) |
Load json document from memory buffer.
osStr | String |
References LoadMemory().
Referenced by OGRGeometryFactory::createFromGeoJson(), and LoadMemory().
bool CPLJSONDocument::LoadMemory | ( | const GByte * | pabyData, |
int | nLength = -1 |
||
) |
Load json document from memory buffer.
pabyData | Buffer.data. |
nLength | Buffer size. |
References CPLError().
bool CPLJSONDocument::LoadUrl | ( | const std::string & | osUrl, |
char ** | papszOptions, | ||
GDALProgressFunc | pfnProgress = nullptr , |
||
void * | pProgressArg = nullptr |
||
) |
Load json document from web.
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. |
References CPLError(), CPLHTTPDestroyResult(), CPLHTTPFetchEx(), CSLFetchNameValueDef(), and CPLHTTPResult::nStatus.
bool CPLJSONDocument::Save | ( | const std::string & | osPath | ) |
Save json document at specified path
osPath | Path to save json document |
References CPLError(), and VSIFOpenL().
std::string CPLJSONDocument::SaveAsString | ( | ) |
Return the json document as a serialized string.