mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-18 04:52:22 +02:00
Added a few "const" to remove a few GCC warnings
This commit is contained in:
@ -18,7 +18,7 @@ JsonHashTable::JsonHashTable(char* json, jsmntok_t* tokens)
|
|||||||
/*
|
/*
|
||||||
* Returns the token for the value associated with the specified key
|
* Returns the token for the value associated with the specified key
|
||||||
*/
|
*/
|
||||||
jsmntok_t* JsonHashTable::getToken(char* desiredKey)
|
jsmntok_t* JsonHashTable::getToken(const char* desiredKey)
|
||||||
{
|
{
|
||||||
// sanity check
|
// sanity check
|
||||||
if (json == 0 || tokens == 0 || desiredKey == 0)
|
if (json == 0 || tokens == 0 || desiredKey == 0)
|
||||||
@ -48,37 +48,37 @@ jsmntok_t* JsonHashTable::getToken(char* desiredKey)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JsonHashTable::containsKey(char* key)
|
bool JsonHashTable::containsKey(const char* key)
|
||||||
{
|
{
|
||||||
return getToken(key) != 0;
|
return getToken(key) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonArray JsonHashTable::getArray(char* key)
|
JsonArray JsonHashTable::getArray(const char* key)
|
||||||
{
|
{
|
||||||
return JsonArray(json, getToken(key));
|
return JsonArray(json, getToken(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JsonHashTable::getBool(char* key)
|
bool JsonHashTable::getBool(const char* key)
|
||||||
{
|
{
|
||||||
return getBoolFromToken(getToken(key));
|
return getBoolFromToken(getToken(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
double JsonHashTable::getDouble(char* key)
|
double JsonHashTable::getDouble(const char* key)
|
||||||
{
|
{
|
||||||
return getDoubleFromToken(getToken(key));
|
return getDoubleFromToken(getToken(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonHashTable JsonHashTable::getHashTable(char* key)
|
JsonHashTable JsonHashTable::getHashTable(const char* key)
|
||||||
{
|
{
|
||||||
return JsonHashTable(json, getToken(key));
|
return JsonHashTable(json, getToken(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
long JsonHashTable::getLong(char* key)
|
long JsonHashTable::getLong(const char* key)
|
||||||
{
|
{
|
||||||
return getLongFromToken(getToken(key));
|
return getLongFromToken(getToken(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
char* JsonHashTable::getString(char* key)
|
char* JsonHashTable::getString(const char* key)
|
||||||
{
|
{
|
||||||
return getStringFromToken(getToken(key));
|
return getStringFromToken(getToken(key));
|
||||||
}
|
}
|
@ -21,19 +21,19 @@ public:
|
|||||||
|
|
||||||
JsonHashTable() {}
|
JsonHashTable() {}
|
||||||
|
|
||||||
bool containsKey(char* key);
|
bool containsKey(const char* key);
|
||||||
|
|
||||||
JsonArray getArray(char* key);
|
JsonArray getArray(const char* key);
|
||||||
bool getBool(char* key);
|
bool getBool(const char* key);
|
||||||
double getDouble(char* key);
|
double getDouble(const char* key);
|
||||||
JsonHashTable getHashTable(char* key);
|
JsonHashTable getHashTable(const char* key);
|
||||||
long getLong(char* key);
|
long getLong(const char* key);
|
||||||
char* getString(char* key);
|
char* getString(const char* key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
JsonHashTable(char* json, jsmntok_t* tokens);
|
JsonHashTable(char* json, jsmntok_t* tokens);
|
||||||
jsmntok_t* getToken(char* key);
|
jsmntok_t* getToken(const char* key);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Reference in New Issue
Block a user