fix in SpaceParser when parsing json format: floating point values such as 1.123e+01 where not correctly parsed ('+' character was not correctly parsed)

added to Space: some methods for searching a field with ignoring case:
Space * get_object_field_nc(const wchar_t * field)
Space * get_object_field_nc(const std::wstring & field);
const Space * get_object_field_nc(const wchar_t * field) const;
const Space * get_object_field_nc(const std::wstring & field) const;
pull/4/head
Tomasz Sowa 2 years ago
parent 5d34db5fcf
commit 297940ff7c

@ -1602,6 +1602,61 @@ const Space::TableType * Space::get_table(const wchar_t * field) const
Space * Space::get_object_field_nc(const wchar_t * field)
{
if( is_object() )
{
ObjectType::iterator i = value.value_object.begin();
while( i != value.value_object.end() )
{
if( EqualNoCase(field, i->first.c_str()) )
{
return i->second;
}
}
}
return nullptr;
}
Space * Space::get_object_field_nc(const std::wstring & field)
{
return get_object_field_nc(field.c_str());
}
const Space * Space::get_object_field_nc(const wchar_t * field) const
{
if( is_object() )
{
ObjectType::const_iterator i = value.value_object.cbegin();
while( i != value.value_object.cend() )
{
if( EqualNoCase(field, i->first.c_str()) )
{
return i->second;
}
}
}
return nullptr;
}
const Space * Space::get_object_field_nc(const std::wstring & field) const
{
return get_object_field_nc(field.c_str());
}
void Space::remove(const wchar_t * field)
{
remove(std::wstring(field));

@ -470,6 +470,14 @@ public:
// add these getters with std::wstring
// no case, has O(n) complexity
Space * get_object_field_nc(const wchar_t * field);
Space * get_object_field_nc(const std::wstring & field);
const Space * get_object_field_nc(const wchar_t * field) const;
const Space * get_object_field_nc(const std::wstring & field) const;
// remove a field from an object
void remove(const wchar_t * field);
void remove(const std::wstring & field);

@ -737,7 +737,7 @@ bool SpaceParser::is_alfa_numeric_char(int c)
return (c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') ||
c == '.' || c=='-';
c == '.' || c=='-' || c=='+';
}

Loading…
Cancel
Save