EasyManua.ls Logo

Espressif ESP8266 - Page 44

Espressif ESP8266
51 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
the last key was I had seen and then I store the value in the appropriate variable. For the
example from before I would do
1
void ExampleListener::key(String key) {
2 currentKey_ = key;
3 }
4
5
void ExampleListener::value(String key) {
6
if (currentKey_ == "name") {
7
name_ = value;
8
} else if (currentKey_ == "city") {
9
city_ = value;
10 }
11 }
In the stream of the object {“name”: “Eichhorn”} we will first get a call to the method key() with
the value “name” which we store in currentKey_. Next the parser will detect a value and call
our value() method with the value “Eichhorn”. The parser can now make the connection (or
create a context) that after the key “name” the value “Eichhorn” should be stored in the
member variable name_.

Other manuals for Espressif ESP8266

Related product manuals