|
|
@@ -194,19 +194,19 @@ static bool is_escapee(char c)
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
JSONElement::JSONElement()
|
|
|
- : m_begin(NULL), m_at(NULL)
|
|
|
+ : m_at(NULL)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
JSONElement::JSONElement(const char* at)
|
|
|
- : m_begin(at), m_at(at)
|
|
|
+ : m_at(at)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
JSONElement::JSONElement(const JSONElement& other)
|
|
|
- : m_begin(other.m_at), m_at(other.m_at)
|
|
|
+ : m_at(other.m_at)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
@@ -214,7 +214,6 @@ JSONElement::JSONElement(const JSONElement& other)
|
|
|
JSONElement& JSONElement::operator=(const JSONElement& other)
|
|
|
{
|
|
|
// Our begin is the other's at
|
|
|
- m_begin = other.m_at;
|
|
|
m_at = other.m_at;
|
|
|
|
|
|
return *this;
|
|
|
@@ -382,37 +381,28 @@ bool JSONElement::is_key_unique(const char* k) const
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-bool JSONElement::bool_value()
|
|
|
+bool JSONElement::bool_value() const
|
|
|
{
|
|
|
const bool value = JSONParser::parse_bool(m_at);
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
-
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-int32_t JSONElement::int_value()
|
|
|
+int32_t JSONElement::int_value() const
|
|
|
{
|
|
|
const int32_t value = JSONParser::parse_int(m_at);
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
-
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-float JSONElement::float_value()
|
|
|
+float JSONElement::float_value() const
|
|
|
{
|
|
|
const float value = JSONParser::parse_float(m_at);
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
-
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-const char* JSONElement::string_value()
|
|
|
+const char* JSONElement::string_value() const
|
|
|
{
|
|
|
static TempAllocator1024 alloc;
|
|
|
static List<char> string(alloc);
|
|
|
@@ -421,13 +411,11 @@ const char* JSONElement::string_value()
|
|
|
|
|
|
JSONParser::parse_string(m_at, string);
|
|
|
|
|
|
- m_at = m_begin;
|
|
|
-
|
|
|
return string.begin();
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-void JSONElement::array_value(List<bool>& array)
|
|
|
+void JSONElement::array_value(List<bool>& array) const
|
|
|
{
|
|
|
TempAllocator1024 alloc;
|
|
|
List<const char*> temp(alloc);
|
|
|
@@ -438,12 +426,10 @@ void JSONElement::array_value(List<bool>& array)
|
|
|
{
|
|
|
array.push_back(JSONParser::parse_bool(temp[i]));
|
|
|
}
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-void JSONElement::array_value(List<int16_t>& array)
|
|
|
+void JSONElement::array_value(List<int16_t>& array) const
|
|
|
{
|
|
|
TempAllocator1024 alloc;
|
|
|
List<const char*> temp(alloc);
|
|
|
@@ -454,12 +440,10 @@ void JSONElement::array_value(List<int16_t>& array)
|
|
|
{
|
|
|
array.push_back((int16_t)JSONParser::parse_int(temp[i]));
|
|
|
}
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-void JSONElement::array_value(List<uint16_t>& array)
|
|
|
+void JSONElement::array_value(List<uint16_t>& array) const
|
|
|
{
|
|
|
TempAllocator1024 alloc;
|
|
|
List<const char*> temp(alloc);
|
|
|
@@ -470,12 +454,10 @@ void JSONElement::array_value(List<uint16_t>& array)
|
|
|
{
|
|
|
array.push_back((uint16_t)JSONParser::parse_int(temp[i]));
|
|
|
}
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-void JSONElement::array_value(List<int32_t>& array)
|
|
|
+void JSONElement::array_value(List<int32_t>& array) const
|
|
|
{
|
|
|
TempAllocator1024 alloc;
|
|
|
List<const char*> temp(alloc);
|
|
|
@@ -486,12 +468,10 @@ void JSONElement::array_value(List<int32_t>& array)
|
|
|
{
|
|
|
array.push_back((int32_t)JSONParser::parse_int(temp[i]));
|
|
|
}
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-void JSONElement::array_value(List<uint32_t>& array)
|
|
|
+void JSONElement::array_value(List<uint32_t>& array) const
|
|
|
{
|
|
|
TempAllocator1024 alloc;
|
|
|
List<const char*> temp(alloc);
|
|
|
@@ -502,12 +482,10 @@ void JSONElement::array_value(List<uint32_t>& array)
|
|
|
{
|
|
|
array.push_back((uint32_t)JSONParser::parse_int(temp[i]));
|
|
|
}
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
-void JSONElement::array_value(List<float>& array)
|
|
|
+void JSONElement::array_value(List<float>& array) const
|
|
|
{
|
|
|
TempAllocator1024 alloc;
|
|
|
List<const char*> temp(alloc);
|
|
|
@@ -518,8 +496,6 @@ void JSONElement::array_value(List<float>& array)
|
|
|
{
|
|
|
array.push_back(JSONParser::parse_float(temp[i]));
|
|
|
}
|
|
|
-
|
|
|
- m_at = m_begin;
|
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|