// CodeGear C++Builder
// Copyright (c) 1995, 2009 by Embarcadero Technologies, Inc.
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Mcjson.pas' rev: 21.00

#ifndef McjsonHPP
#define McjsonHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Sysutils.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Mcjson
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS EMcJsonException;
class PASCALIMPLEMENTATION EMcJsonException : public Sysutils::Exception
{
	typedef Sysutils::Exception inherited;
	
public:
	/* Exception.Create */ inline __fastcall EMcJsonException(const System::UnicodeString Msg) : Sysutils::Exception(Msg) { }
	/* Exception.CreateFmt */ inline __fastcall EMcJsonException(const System::UnicodeString Msg, System::TVarRec const *Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
	/* Exception.CreateRes */ inline __fastcall EMcJsonException(int Ident)/* overload */ : Sysutils::Exception(Ident) { }
	/* Exception.CreateResFmt */ inline __fastcall EMcJsonException(int Ident, System::TVarRec const *Args, const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
	/* Exception.CreateHelp */ inline __fastcall EMcJsonException(const System::UnicodeString Msg, int AHelpContext) : Sysutils::Exception(Msg, AHelpContext) { }
	/* Exception.CreateFmtHelp */ inline __fastcall EMcJsonException(const System::UnicodeString Msg, System::TVarRec const *Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext) { }
	/* Exception.CreateResHelp */ inline __fastcall EMcJsonException(int Ident, int AHelpContext)/* overload */ : Sysutils::Exception(Ident, AHelpContext) { }
	/* Exception.CreateResFmtHelp */ inline __fastcall EMcJsonException(System::PResStringRec ResStringRec, System::TVarRec const *Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(ResStringRec, Args, Args_Size, AHelpContext) { }
	/* Exception.Destroy */ inline __fastcall virtual ~EMcJsonException(void) { }
	
};


#pragma option push -b-
enum TJItemType { jitUnset, jitValue, jitObject, jitArray };
#pragma option pop

#pragma option push -b-
enum TJValueType { jvtString, jvtNumber, jvtBoolean, jvtNull };
#pragma option pop

class DELPHICLASS TMcJsonItem;
class DELPHICLASS TMcJsonItemEnumerator;
class PASCALIMPLEMENTATION TMcJsonItem : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	TMcJsonItem* operator[](const System::UnicodeString aKey) { return Values[aKey]; }
	
private:
	TJItemType fType;
	System::UnicodeString fKey;
	System::UnicodeString fValue;
	TJValueType fValType;
	Classes::TList* fChild;
	bool fSpeedUp;
	int __fastcall fGetCount(void);
	System::UnicodeString __fastcall fGetKey(int aIdx);
	TJItemType __fastcall fGetType(void);
	TMcJsonItem* __fastcall fGetItemByKey(const System::UnicodeString aKey);
	TMcJsonItem* __fastcall fGetItemByIdx(int aIdx);
	bool __fastcall fHasChild(void);
	bool __fastcall fIsNull(void);
	System::UnicodeString __fastcall fGetAsJSON(void);
	TMcJsonItem* __fastcall fGetAsObject(void);
	TMcJsonItem* __fastcall fGetAsArray(void);
	int __fastcall fGetAsInteger(void);
	double __fastcall fGetAsDouble(void);
	System::UnicodeString __fastcall fGetAsString(void);
	bool __fastcall fGetAsBoolean(void);
	System::UnicodeString __fastcall fGetAsNull(void);
	void __fastcall fSetType(TJItemType aType);
	void __fastcall fSetAsJSON(System::UnicodeString aValue);
	void __fastcall fSetAsObject(TMcJsonItem* aValue);
	void __fastcall fSetAsArray(TMcJsonItem* aValue);
	void __fastcall fSetAsInteger(int aValue);
	void __fastcall fSetAsDouble(double aValue);
	void __fastcall fSetAsString(System::UnicodeString aValue);
	void __fastcall fSetAsBoolean(bool aValue);
	void __fastcall fSetAsNull(System::UnicodeString aValue);
	int __fastcall parse(const System::UnicodeString aCode, int aPos, int aLen);
	int __fastcall readString(const System::UnicodeString aCode, /* out */ System::UnicodeString &aStr, int aPos, int aLen);
	int __fastcall readChar(const System::UnicodeString aCode, System::WideChar aChar, int aPos, int aLen);
	int __fastcall readKeyword(const System::UnicodeString aCode, const System::UnicodeString aKeyword, int aPos, int aLen);
	int __fastcall readValue(const System::UnicodeString aCode, int aPos, int aLen);
	int __fastcall readObject(const System::UnicodeString aCode, int aPos, int aLen);
	int __fastcall readArray(const System::UnicodeString aCode, int aPos, int aLen);
	int __fastcall readNumber(const System::UnicodeString aCode, int aPos, int aLen);
	int __fastcall readBoolean(const System::UnicodeString aCode, int aPos, int aLen);
	int __fastcall readNull(const System::UnicodeString aCode, int aPos, int aLen);
	System::UnicodeString __fastcall sFormat(bool aHuman);
	System::UnicodeString __fastcall sFormatItem(Classes::TStringStream* aStrS, const System::UnicodeString aIn, const System::UnicodeString aNL, const System::UnicodeString aSp);
	bool __fastcall isIndexValid(int aIdx);
	
public:
	__property int Count = {read=fGetCount, nodefault};
	__property System::UnicodeString Key = {read=fKey};
	__property System::UnicodeString Value = {read=fValue};
	__property TJItemType ItemType = {read=fGetType, write=fSetType, nodefault};
	__property System::UnicodeString Keys[int aIdx] = {read=fGetKey};
	__property TMcJsonItem* Items[int aIdx] = {read=fGetItemByIdx};
	__property TMcJsonItem* Values[const System::UnicodeString aKey] = {read=fGetItemByKey/*, default*/};
	__property bool HasChild = {read=fHasChild, nodefault};
	__property bool IsNull = {read=fIsNull, nodefault};
	__property bool SpeedUp = {read=fSpeedUp, write=fSpeedUp, nodefault};
	__property System::UnicodeString AsJSON = {read=fGetAsJSON, write=fSetAsJSON};
	__property TMcJsonItem* AsObject = {read=fGetAsObject, write=fSetAsObject};
	__property TMcJsonItem* AsArray = {read=fGetAsArray, write=fSetAsArray};
	__property int AsInteger = {read=fGetAsInteger, write=fSetAsInteger, nodefault};
	__property double AsNumber = {read=fGetAsDouble, write=fSetAsDouble};
	__property System::UnicodeString AsString = {read=fGetAsString, write=fSetAsString};
	__property bool AsBoolean = {read=fGetAsBoolean, write=fSetAsBoolean, nodefault};
	__property System::UnicodeString AsNull = {read=fGetAsNull, write=fSetAsNull};
	__fastcall TMcJsonItem(void)/* overload */;
	__fastcall TMcJsonItem(TJItemType aJItemType)/* overload */;
	__fastcall TMcJsonItem(const TMcJsonItem* aItem)/* overload */;
	__fastcall TMcJsonItem(const System::UnicodeString aCode)/* overload */;
	__fastcall virtual ~TMcJsonItem(void);
	void __fastcall Clear(void);
	int __fastcall IndexOf(const System::UnicodeString aKey)/* overload */;
	TMcJsonItem* __fastcall Path(const System::UnicodeString aPath)/* overload */;
	TMcJsonItem* __fastcall Add(const System::UnicodeString aKey = L"")/* overload */;
	TMcJsonItem* __fastcall Add(const System::UnicodeString aKey, TJItemType aItemType)/* overload */;
	TMcJsonItem* __fastcall Add(TJItemType aItemType)/* overload */;
	TMcJsonItem* __fastcall Add(const TMcJsonItem* aItem)/* overload */;
	TMcJsonItem* __fastcall Copy(const TMcJsonItem* aItem)/* overload */;
	TMcJsonItem* __fastcall Clone(void)/* overload */;
	TMcJsonItem* __fastcall Insert(const System::UnicodeString aKey, int aIdx)/* overload */;
	TMcJsonItem* __fastcall Insert(const TMcJsonItem* aItem, int aIdx)/* overload */;
	bool __fastcall Delete(int aIdx)/* overload */;
	bool __fastcall Delete(const System::UnicodeString aKey)/* overload */;
	bool __fastcall HasKey(const System::UnicodeString aKey);
	bool __fastcall IsEqual(const TMcJsonItem* aItem);
	bool __fastcall Check(const System::UnicodeString aStr, bool aSpeedUp = false);
	int __fastcall CountItems(void);
	TMcJsonItem* __fastcall At(int aIdx, const System::UnicodeString aKey = L"")/* overload */;
	TMcJsonItem* __fastcall At(const System::UnicodeString aKey, int aIdx = 0xffffffff)/* overload */;
	HIDESBASE System::UnicodeString __fastcall ToString(void)/* overload */;
	HIDESBASE System::UnicodeString __fastcall ToString(bool aHuman = false)/* overload */;
	System::UnicodeString __fastcall Minify(const System::UnicodeString aCode);
	void __fastcall LoadFromStream(Classes::TStream* Stream, bool aUTF8 = true);
	void __fastcall SaveToStream(Classes::TStream* Stream, bool aHuman = true);
	void __fastcall LoadFromFile(const System::UnicodeString aFileName, bool aUTF8 = true);
	void __fastcall SaveToFile(const System::UnicodeString aFileName, bool aHuman = true);
	TMcJsonItemEnumerator* __fastcall GetEnumerator(void);
	System::UnicodeString __fastcall GetTypeStr(void);
	System::UnicodeString __fastcall GetValueStr(void);
	System::UnicodeString __fastcall Qot(const System::UnicodeString aMsg);
	System::UnicodeString __fastcall QotKey(const System::UnicodeString aKey);
	void __fastcall Error(const System::UnicodeString Msg, const System::UnicodeString S1 = L"", const System::UnicodeString S2 = L"", const System::UnicodeString S3 = L"");
};


class PASCALIMPLEMENTATION TMcJsonItemEnumerator : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	TMcJsonItem* fItem;
	int fIndex;
	
public:
	__fastcall TMcJsonItemEnumerator(TMcJsonItem* aItem);
	TMcJsonItem* __fastcall GetCurrent(void);
	bool __fastcall MoveNext(void);
	__property TMcJsonItem* Current = {read=GetCurrent};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TMcJsonItemEnumerator(void) { }
	
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE System::UnicodeString __fastcall GetItemTypeStr(TJItemType aType);
extern PACKAGE System::UnicodeString __fastcall GetValueTypeStr(TJValueType aType);
extern PACKAGE System::UnicodeString __fastcall UnEscapeUnicode(const System::UnicodeString aStr);
extern PACKAGE bool __fastcall CheckIsUtf8(const System::AnsiString aStr, /* out */ System::AnsiString &aAux);

}	/* namespace Mcjson */
using namespace Mcjson;
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// McjsonHPP
