69 lines
1.3 KiB
C++
69 lines
1.3 KiB
C++
/*
|
|
ZJSONReader.hpp
|
|
Author: Chris Ertel <crertel@762studios.com>
|
|
Created: 3/26/2013
|
|
|
|
Purpose:
|
|
|
|
JSON reading support, to convert JSON strings into ZKVTrees.
|
|
|
|
License:
|
|
|
|
TODO
|
|
|
|
*/
|
|
#pragma once
|
|
#ifndef _ZJSONREADER_H
|
|
#define _ZJSONREADER_H
|
|
|
|
#include <ZUtil/ZKVTree.hpp>
|
|
#include <ZUtil/ZSmartPointer.hpp>
|
|
|
|
/*
|
|
ZJSONReader class, which converts JSON data into a ZKVTree that can be used to access / iterate
|
|
the data.
|
|
*/
|
|
class ZJSONReader
|
|
{
|
|
private:
|
|
DISABLE_COPY_AND_ASSIGN(ZJSONReader);
|
|
|
|
//Error Message (if an error has happened)
|
|
ZString ErrorMessage;
|
|
const ZString JSONData;
|
|
|
|
//Registry of data
|
|
ZPtr<ZKVTree> Registry;
|
|
|
|
public:
|
|
/*
|
|
Parameterized Constructor.
|
|
|
|
@param _jsonData - string containing JSON data to parse
|
|
*/
|
|
ZJSONReader(const ZString& _jsonData);
|
|
|
|
/*
|
|
public ZJSONReader::GetErrorString
|
|
|
|
Gets the error message generated while loading the data if loading failed. If loading
|
|
the data was successful, this returns an empty string.
|
|
|
|
@return (const ZString&) - error message string
|
|
*/
|
|
const ZString& GetErrorString();
|
|
|
|
/*
|
|
public ZJSONReader::GetKVTree
|
|
|
|
Gets the registry that was constructed from the parsed JSON data. If the loading failed,
|
|
the pointer returned is NULL.
|
|
|
|
TODO - describe the format
|
|
|
|
@return (ZPtr<ZRegistry>) - registry containing the parsed JSON data
|
|
*/
|
|
ZPtr<ZKVTree> GetKVTree();
|
|
};
|
|
|
|
#endif |