Initial commit
This commit is contained in:
64
Include/ZUtil/ZJSONWriter.hpp
Normal file
64
Include/ZUtil/ZJSONWriter.hpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
ZJSONWriter.hpp
|
||||
Author: Chris Ertel <crertel@762studios.com>
|
||||
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 <ZUtil/ZSmartPointer.hpp>
|
||||
#include <ZUtil/ZKVTree.hpp>
|
||||
|
||||
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<ZKVTree> Registry;
|
||||
|
||||
const ZString NoError;
|
||||
|
||||
public:
|
||||
/*
|
||||
Parameterized Constructor.
|
||||
|
||||
@param _registry - the registry to generate XML data from
|
||||
*/
|
||||
ZJSONWriter(ZPtr<ZKVTree> _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
|
||||
Reference in New Issue
Block a user