/** @file basetypeXmlparser.h
 *  Functionality for parsing Xml into generic EA::Types classes
 *	@author Chris Burns (cburns@ea.com)
 *
 *	CTUI
 *	(c) 2013 Electronic Arts Inc. 
 */

#ifndef EABASETYPESXML_BASETYPEXMLPARSER_H_
#define EABASETYPESXML_BASETYPEXMLPARSER_H_

#include "EABaseTypes/autoref.h"

namespace EA
{
	class RawString;

	namespace Types
	{
		class Factory;

		EABASETYPES_FORWARD_DECLARATION(class, BaseType)

		namespace BaseTypeXmlParser
		{
			/*!
			*	Function for parsing a buffer full of XML into a Types::BaseType
			*	@param[in]	factory	The factory to use to create the Types::BaseType
			*	@param[in]	buffer	A pointer to the buffer full of XML
			*	@param[in]	size	The size of the buffer full of XML
			*	@return Types::BaseType* A Types::BaseType representing the XML in the buffer
			*	@note if the XML has a syntax error, this function asserts
			*/
			BaseTypeReturn Parse(Factory* factory,
								 void* buffer, 
								 unsigned int size);
								 
			/*!
			*	Function for parsing a buffer full of XML into a Types::BaseType
			*	@param[in]	factory	The factory to use to create the Types::BaseType
			*	@param[in]	buffer	A pointer to the buffer full of XML
			*	@param[in]	size	The size of the buffer full of XML
			*	@param[out]	error	An error message
			*	@return Types::BaseType* A Types::BaseType representing the XML in the buffer
			*/
			BaseTypeReturn Parse(Factory* factory,
								 void* buffer, 
								 unsigned int size,
								 EA::RawString& error);
		}
	}
}

#endif /* EABASETYPESXML_BASETYPEXMLPARSER_H_ */
