Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cJSONWriter Class Reference

#include <cJSONWriter.h>

Inheritance diagram for GrayLib::cJSONWriter:
GrayLib::cJSON

Static Public Member Functions

static HRESULT GRAYCALL WriteVar (cStreamOutput *pOut, const cVariant &rVar, int iIndent=0)
 
static HRESULT GRAYCALL WriteVarToStr (OUT cJSONString &rsOut, const cVariant &rVar)
 
- Static Public Member Functions inherited from GrayLib::cJSON
static bool GRAYCALL IsJSON (const char *pszStr, StrLen_t iLenMax=StrT::k_LEN_MAX)
 
static cVariant GRAYCALL Parse (const char *pszVal)
 
static cJSONString GRAYCALL Encode (const cVariant &v)
 

Static Protected Member Functions

static HRESULT GRAYCALL WriteIndent (cStreamOutput *pOut, int iIndent)
 
static HRESULT GRAYCALL WriteStr (cStreamOutput *pOut, cStringA s)
 
static HRESULT GRAYCALL WriteArray (cStreamOutput *pOut, const cVariantArray &rArray, int iIndent)
 
static HRESULT GRAYCALL WriteMap (cStreamOutput *pOut, const cVariantMap *pMap, int iIndent)
 

Additional Inherited Members

- Public Types inherited from GrayLib::cJSON
enum  TYPE_TYPE { TYPE_Null , TYPE_Bool , TYPE_Double , TYPE_String }
 
- Public Member Functions inherited from GrayLib::cJSON
 UNITTEST_FRIEND (cJSON)
 
- Static Public Attributes inherited from GrayLib::cJSON
static const char k_null [5] = "null"
 "null" is valid syntax. More...
 
static const char k_true [5] = "true"
 "true" More...
 
static const char k_false [6] = "false"
 "false" More...
 
static const int k_DEPTH_MAX = 50
 Arbitrary max depth of read recursion. More...
 

Detailed Description

Write any given data type stored as cVariant to the string/stream/file in JSON format. cJSON::Encode() to Deal with encoding escape sequences.

Member Function Documentation

◆ WriteArray()

HRESULT GRAYCALL GrayLib::cJSONWriter::WriteArray ( cStreamOutput pOut,
const cVariantArray rArray,
int  iIndent 
)
staticprotected

◆ WriteIndent()

HRESULT GRAYCALL GrayLib::cJSONWriter::WriteIndent ( cStreamOutput pOut,
int  iIndent 
)
staticprotected

proper tabs for indent.

◆ WriteMap()

HRESULT GRAYCALL GrayLib::cJSONWriter::WriteMap ( cStreamOutput pOut,
const cVariantMap pMap,
int  iIndent 
)
staticprotected

iterate through the map and write it.

◆ WriteStr()

HRESULT GRAYCALL GrayLib::cJSONWriter::WriteStr ( cStreamOutput pOut,
cStringA  s 
)
staticprotected

just use ESC encoded and quoted string. VARTYPE_TimeInt, VARTYPE_TimeDouble just use ESC encoded and quoted string.

◆ WriteVar()

HRESULT GRAYCALL GrayLib::cJSONWriter::WriteVar ( cStreamOutput pOut,
const cVariant rVar,
int  iIndent = 0 
)
static

Write JSON text directly out to a cStreamOutput pOut.

◆ WriteVarToStr()

HRESULT GRAYCALL GrayLib::cJSONWriter::WriteVarToStr ( OUT cJSONString rsOut,
const cVariant rVar 
)
static

Put the contents of rVar into rsOut as a JSON string.


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