Freeman Oldman / NUCLEO_STM32F401RE_CC3000_ILI9341
Embed: (wiki syntax)

« Back to documentation index

MVJSONValue Class Reference

JSON Value. More...

#include <JsonParser.h>

Inherits JSON::MVJSONUtils.

Public Member Functions

double getFieldDouble (string name)
 get value of double field of VALUE OBJECT (objValue)
int getFieldInt (string name)
 get value of int field of VALUE OBJECT (objValue)
string getFieldString (string name)
 get value of string field of VALUE OBJECT (objValue)
bool getFieldBool (string name)
 get value of bool field of VALUE OBJECT (objValue)

Data Fields

string name
 value name [optional]
MVJSON_TYPE valueType
 type of node
string stringValue
 value if data has string type
bool boolValue
 value if data has bool type
int intValue
 value if data has int type
double doubleValue
 value if data has double type
MVJSONNodeobjValue
 value if data has object type
vector< MVJSONValue * > arrayValue
 array of values

Static Protected Member Functions

static int stringToInt (const string &s)
 convert string to int
static double stringToDouble (const string &s)
 convert string to float
static bool symbolToBeTrimmed (const char &c)
 check if symbol is space, tab or new line break
static string trim (const string &text)
 trim spaces, tabs and line break
static void replace (string &target, const string &oldStr, const string &newStr)
 replace all occurrences of substring
static void splitInHalf (const string &s, const string &separator, string &begin, string &end)
 second half (output)
static void splitList (const string &s, vector< string > &parts)
 split string by "," - ignore content inside of "{", "}", "[", "]" and quotations "...." also take " into account (Code should be cleared of comments beforehand)

Detailed Description

JSON Value.

Definition at line 76 of file JsonParser.h.


Member Function Documentation

bool getFieldBool ( string  name )

get value of bool field of VALUE OBJECT (objValue)

Definition at line 289 of file JsonParser.cpp.

double getFieldDouble ( string  name )

get value of double field of VALUE OBJECT (objValue)

Definition at line 271 of file JsonParser.cpp.

int getFieldInt ( string  name )

get value of int field of VALUE OBJECT (objValue)

Definition at line 277 of file JsonParser.cpp.

string getFieldString ( string  name )

get value of string field of VALUE OBJECT (objValue)

Definition at line 283 of file JsonParser.cpp.

void replace ( string &  target,
const string &  oldStr,
const string &  newStr 
) [static, protected, inherited]

replace all occurrences of substring

Parameters:
targettext to be modified
oldStrold string
newStrnew string

Definition at line 240 of file JsonParser.h.

void splitInHalf ( const string &  s,
const string &  separator,
string &  begin,
string &  end 
) [static, protected, inherited]

second half (output)

Parameters:
ssource string to split up
separatorseparator string)
beginfirst part (output)
endsecond half (output)

Definition at line 181 of file JsonParser.h.

void splitList ( const string &  s,
vector< string > &  parts 
) [static, protected, inherited]

split string by "," - ignore content inside of "{", "}", "[", "]" and quotations "...." also take " into account (Code should be cleared of comments beforehand)

Parameters:
sstring to be splitted
partsresult parts

Definition at line 197 of file JsonParser.h.

double stringToDouble ( const string &  s ) [static, protected, inherited]

convert string to float

Definition at line 151 of file JsonParser.h.

int stringToInt ( const string &  s ) [static, protected, inherited]

convert string to int

Definition at line 145 of file JsonParser.h.

bool symbolToBeTrimmed ( const char &  c ) [static, protected, inherited]

check if symbol is space, tab or new line break

Parameters:
cthe char to test

Definition at line 157 of file JsonParser.h.

string trim ( const string &  text ) [static, protected, inherited]

trim spaces, tabs and line break

Parameters:
textthe text to trim

Definition at line 168 of file JsonParser.h.


Field Documentation

array of values

Definition at line 95 of file JsonParser.h.

bool boolValue

value if data has bool type

Definition at line 90 of file JsonParser.h.

double doubleValue

value if data has double type

Definition at line 92 of file JsonParser.h.

int intValue

value if data has int type

Definition at line 91 of file JsonParser.h.

string name

value name [optional]

Definition at line 86 of file JsonParser.h.

value if data has object type

Definition at line 93 of file JsonParser.h.

string stringValue

value if data has string type

Definition at line 89 of file JsonParser.h.

MVJSON_TYPE valueType

type of node

Definition at line 87 of file JsonParser.h.