/*
	ZIniWriter.hpp
	Author: James Russell <jcrussell@762studios.com>
	Created: 5/6/2012

	Purpose: 

	The 'inverse' of ZIniReader, this will take a kvtree of values (like the one given by
	ZIniReader) and write to an output string in the .ini format specified in ZIniReader.hpp.

	License:

	TODO

*/

#pragma once

#ifndef _ZINIWRITER_HPP
#define _ZINIWRITER_HPP

#include <ZUtil/ZKVTree.hpp>
#include <ZUtil/ZSmartPointer.hpp>

/*
IniWriter class.
*/
class ZIniWriter
{
public:
	/*
	Default Constructor.
	*/
	ZIniWriter() { }

	/*
	Destructor.
	*/
	~ZIniWriter() { }

	/*
	public ZIniWriter::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&)
	*/
	const ZString& GetErrorString();

	/*
	public ZIniWriter::Write
	
	Writes the data from the provided kvtree into the provided output string in the 'ini' format.
	
	@param _input - the tree to read values from
	@param _output - the string to write the data into (the data is appended)
	@return (bool) - true if successful, false otherwise
	*/
	bool Write(const ZKVTree& _input, ZString& _output);

private:
	DISABLE_COPY_AND_ASSIGN(ZIniWriter);

	//Error message (if an error has happened)
	ZString ErrorMessage;
};

#endif 
