Changed naming convention to avoid shadowing (issue #25)

This commit is contained in:
Benoit Blanchon
2014-09-28 13:36:41 +02:00
parent cc19266470
commit ce788d96c4
19 changed files with 147 additions and 148 deletions

View File

@ -18,13 +18,13 @@ namespace ArduinoJson
// Create a "null" pointer
JsonToken()
: token(0)
: _token(0)
{
}
// Create a pointer to the specified JSON token
JsonToken(char* json, jsmntok_t* token)
: json(json), token(token)
: _json(json), _token(token)
{
}
@ -34,13 +34,13 @@ namespace ArduinoJson
// Get the number of children tokens
int childrenCount()
{
return token->size;
return _token->size;
}
// Get a pointer to the first child of the current token
JsonToken firstChild() const
{
return JsonToken(json, token + 1);
return JsonToken(_json, _token + 1);
}
// Get a pointer to the next sibling token (ie skiping the children tokens)
@ -49,37 +49,37 @@ namespace ArduinoJson
// Test equality
bool operator!=(const JsonToken& other) const
{
return token != other.token;
return _token != other._token;
}
// Tell if the pointer is "null"
bool isValid()
{
return token != 0;
return _token != 0;
}
// Tell if the JSON token is a JSON object
bool isObject()
{
return token != 0 && token->type == JSMN_OBJECT;
return _token != 0 && _token->type == JSMN_OBJECT;
}
// Tell if the JSON token is a JSON array
bool isArray()
{
return token != 0 && token->type == JSMN_ARRAY;
return _token != 0 && _token->type == JSMN_ARRAY;
}
// Tell if the JSON token is a primitive
bool isPrimitive()
{
return token != 0 && token->type == JSMN_PRIMITIVE;
return _token != 0 && _token->type == JSMN_PRIMITIVE;
}
// Tell if the JSON token is a string
bool isString()
{
return token != 0 && token->type == JSMN_STRING;
return _token != 0 && _token->type == JSMN_STRING;
}
// Explicit wait to create a "null" JsonToken
@ -89,8 +89,8 @@ namespace ArduinoJson
}
private:
char* json;
jsmntok_t* token;
char* _json;
jsmntok_t* _token;
static char unescapeChar(char c);
static void unescapeString(char* s);