/** @file basetypejsonwriter.cpp
 *  Functionality for writing generic EA::Types classes as JSON
 * 	@headerfile basetypejsonwriter.h "EABaseTypesJson/basetypejsonwriter.h"
 *	@author Jeff Skelton (jeff@ea.com)
 *
 *	UX
 *	(c) 2012 Electronic Arts Inc. 
 */

#include "EABaseTypesJson/basetypejsonwriter.h"

#include "EABaseTypes/basetypeencoder.h"

#include "EABaseTypesJson/jsonencoder.h"

namespace EA
{
	namespace Types
	{
		void BaseTypeJsonWriter::Write(BaseTypeIn base, EA::Json::IWriteStream* writeStream)
		{
			EA::Json::JsonWriter writer;
			writer.SetStream(writeStream);

			writer.BeginDocument();
			
			JsonEncoder encoder(&writer);

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

			writer.EndDocument();
		}
	}
}
