Freeman Oldman / NUCLEO_STM32F401RE_CC3000_ILI9341
Embed: (wiki syntax)

« Back to documentation index

MVJSONReader Class Reference

Compact JSON parser (based on specification: http://www.json.org/) More...

#include <JsonParser.h>

Inherits JSON::MVJSONUtils.

Public Member Functions

 MVJSONReader (const string &source)
 constructor from json source

Data Fields

MVJSONNoderoot
 root object (if its null - parsing was failed)

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

Compact JSON parser (based on specification: http://www.json.org/)

Definition at line 126 of file JsonParser.h.


Constructor & Destructor Documentation

MVJSONReader ( const string &  source )

constructor from json source

Definition at line 40 of file JsonParser.cpp.


Member Function Documentation

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

root object (if its null - parsing was failed)

Definition at line 131 of file JsonParser.h.