/* ZJSONWriter.hpp Author: Chris Ertel Created: 3/26/2013 Purpose: JSON writing support, to convert ZKVTrees into JSON strings. License: TODO */ #pragma once #ifndef _ZJSONWRITER_H #define _ZJSONWRITER_H #include #include class ZJSONWriter { private: DISABLE_COPY_AND_ASSIGN(ZJSONWriter); //Error message (if an error has happened) ZString ErrorMessage; //The registry we will be getting values from ZPtr Registry; const ZString NoError; public: /* Parameterized Constructor. @param _registry - the registry to generate XML data from */ ZJSONWriter(ZPtr _registry); /* public ZJSONWriter::GetErrorString Gets the error message generated while writing the data if writing failed. If writing the data was successful, this returns an empty string. @return (const ZString&) - a string describing an error that occurred */ const ZString& GetErrorString(); /* public ZJSONWriter::Write Writes the data from the registry into the provided output string in XML format. @param _output - the string to write the data into (the data is appended) @return (bool) - true if successful, false otherwise */ bool Write(ZString& _output); }; #endif