Skip to content
Snippets Groups Projects
Commit be9a71c5 authored by Simon Ottenhaus's avatar Simon Ottenhaus
Browse files

added convenience functions

parent be557e47
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,30 @@ JsonValuePtr JsonValue::False()
return value;
}
JsonValuePtr JsonValue::Create(const std::string& value)
{
JsonValuePtr jsonValue(new JsonValue(value));
return jsonValue;
}
JsonValuePtr JsonValue::Create(int value)
{
JsonValuePtr jsonValue(new JsonValue(value));
return jsonValue;
}
JsonValuePtr JsonValue::Create(float value)
{
JsonValuePtr jsonValue(new JsonValue(value));
return jsonValue;
}
JsonValuePtr JsonValue::Create(double value)
{
JsonValuePtr jsonValue(new JsonValue(value));
return jsonValue;
}
JsonValuePtr JsonValue::CreateRaw(JsonValue::Type type, const std::string& value)
{
if (!CheckValue(type, value))
......
......@@ -46,6 +46,10 @@ namespace armarx
static JsonValuePtr Null();
static JsonValuePtr True();
static JsonValuePtr False();
static JsonValuePtr Create(const std::string& value);
static JsonValuePtr Create(int value);
static JsonValuePtr Create(float value);
static JsonValuePtr Create(double value);
static JsonValuePtr CreateRaw(Type type, const std::string& value);
static bool CheckValue(Type type, const std::string& value);
......@@ -55,6 +59,7 @@ namespace armarx
static bool CheckBool(const std::string& value);
static bool CheckNull(const std::string& value);
void writeJson(const JsonWriterPtr& writer);
JsonValuePtr toSharedPtr() const;
......
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