From 51684c7207a119600c1f818baa13abc64d609690 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Mon, 12 Jan 2015 00:50:17 +0100 Subject: Improved error messages of VariantConverter --- src/core/common/VariantWriter.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/core/common/VariantWriter.hpp') diff --git a/src/core/common/VariantWriter.hpp b/src/core/common/VariantWriter.hpp index 211da34..7fe32fb 100644 --- a/src/core/common/VariantWriter.hpp +++ b/src/core/common/VariantWriter.hpp @@ -28,6 +28,7 @@ #ifndef _OUSIA_VARIANT_WRITER_HPP_ #define _OUSIA_VARIANT_WRITER_HPP_ +#include #include namespace ousia { @@ -42,7 +43,8 @@ class Variant; class VariantWriter { public: /** - * Dumps the Variant as JSON data. + * Dumps the Variant as JSON data. Note that the resulting JSON data is + * invalid if the Variant consists of function or object references. * * @param var is the variant that should be serialized. * @param stream is the stream the result should be written to. @@ -50,6 +52,15 @@ public: */ static void writeJson(const Variant &var, std::ostream &stream, bool pretty = true); + + /** + * Dumps the Variant as JSON data to a string. + * + * @param var is the variant that should be serialized. + * @param pretty if true, the resulting value is properly indented. + */ + static std::string writeJsonToString(const Variant &var, bool pretty = true); + }; } -- cgit v1.2.3