Skip to content
Snippets Groups Projects
Commit 20765bb0 authored by Moritz Weber's avatar Moritz Weber
Browse files

added missing functions

parent be9a71c5
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,10 @@ JsonValue::JsonValue(int value)
: type(eNumber), value(ToString(value))
{ }
JsonValue::JsonValue(long value)
: type(eNumber), value(ToString(value))
{ }
JsonValue::JsonValue(float value)
: type(eNumber), value(ToString(value))
{ }
......@@ -71,6 +75,12 @@ JsonValuePtr JsonValue::Create(int value)
return jsonValue;
}
JsonValuePtr JsonValue::Create(long value)
{
JsonValuePtr jsonValue(new JsonValue(value));
return jsonValue;
}
JsonValuePtr JsonValue::Create(float value)
{
JsonValuePtr jsonValue(new JsonValue(value));
......@@ -166,6 +176,14 @@ std::string JsonValue::ToString(int value)
return oss.str();
}
std::string JsonValue::ToString(long value)
{
std::ostringstream oss;
oss.imbue(std::locale::classic());
oss << value;
return oss.str();
}
std::string JsonValue::ToString(float value)
{
std::ostringstream oss;
......
......@@ -40,6 +40,7 @@ namespace armarx
JsonValue(const std::string& value);
JsonValue(int value);
JsonValue(long value);
JsonValue(float value);
JsonValue(double value);
......@@ -48,6 +49,7 @@ namespace armarx
static JsonValuePtr False();
static JsonValuePtr Create(const std::string& value);
static JsonValuePtr Create(int value);
static JsonValuePtr Create(long value);
static JsonValuePtr Create(float value);
static JsonValuePtr Create(double value);
......@@ -65,6 +67,7 @@ namespace armarx
JsonValuePtr toSharedPtr() const;
static std::string ToString(int value);
static std::string ToString(long value);
static std::string ToString(float value);
static std::string ToString(double value);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment