/** @file jsonloader.h
*	Json file loading utility 
*	@author Nick Beatty (nbeatty@ea.com)
*
*	UX
*	(c) 2012 Electronic Arts Inc.
*/

#ifndef EABASETYPESJSON_JSONLOADER_H_
#define EABASETYPESJSON_JSONLOADER_H_

#include "EABaseTypes/autoref.h"
#include "EABaseTypes/string.h"

namespace EA
{
	namespace Allocator { class ICoreAllocator; }

	namespace Types
	{
		class Factory;

		EABASETYPES_FORWARD_DECLARATION(class, BaseType)
		EABASETYPES_FORWARD_DECLARATION(class, Object)
		EABASETYPES_FORWARD_DECLARATION(class, Function)

		EABASETYPES_FORWARD_DECLARATION(class, IFileHandler)

		class JsonLoader
		{
		public:

			static const unsigned int CALLER_TYPE = 0x35712456;

			JsonLoader(Factory* factory, IFileHandlerIn filehandler);
			~JsonLoader();

			void Load(FunctionIn callback, const char* fileName);
			BaseTypeReturn Load(const char* fileName);

			BaseTypeReturn Parse(const EA::RawString& json);
			EA::RawString Write(BaseTypeIn data);

			ObjectReturn ToObject();
	
		private:
			Factory*		mFactory;
			IFileHandlerRef	mFileHandler;
		};
	}
}

#endif // EABASETYPESJSON_JSONLOADER_H_
