/** @file basetypexmlwriter.cpp
 *  Functionality for writing EABaseTypes as XML
 * 	@headerfile basetypexmlwriter.h "EABaseTypesXml/basetypexmlwriter.h"
 *	@author Chris Burns (cburns@ea.com)
 *
 *	CTUI
 *	(c) 2013 Electronic Arts Inc. 
 */

#include "EABaseTypesXml/basetypexmlwriter.h"

#include "EABaseTypes/basetypeencoder.h"

#include "EABaseTypesXml/xmlencoder.h"

#include "UTFXml/XmlWriter.h"

namespace EA
{
	namespace Types
	{
		void BaseTypeXmlWriter::Write(BaseTypeIn base, EA::IO::IStream* writeStream)
		{
			EA::XML::XmlWriter writer;
			writer.SetOutputStream(writeStream);

			writer.WriteXmlHeader();
			
			XmlEncoder encoder(base->GetFactory()->GetAllocator(), &writer);

			BaseTypeDecoder<XmlEncoder>::Decode(&encoder, base.GetUnsafePointer());
		}
	}
}
