// Borland C++ Builder
// Copyright (c) 1995, 2005 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Idbuffer.pas' rev: 10.00

#ifndef IdbufferHPP
#define IdbufferHPP

#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 <Idexception.hpp>	// Pascal unit
#include <Idglobal.hpp>	// Pascal unit
#include <Idobjs.hpp>	// Pascal unit
#include <Idsys.hpp>	// Pascal unit

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

namespace Idbuffer
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS EIdNotEnoughDataInBuffer;
class PASCALIMPLEMENTATION EIdNotEnoughDataInBuffer : public Idexception::EIdException 
{
	typedef Idexception::EIdException inherited;
	
public:
	#pragma option push -w-inl
	/* EIdException.Create */ inline __fastcall virtual EIdNotEnoughDataInBuffer(AnsiString AMsg)/* overload */ : Idexception::EIdException(AMsg) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* Exception.CreateFmt */ inline __fastcall EIdNotEnoughDataInBuffer(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size) : Idexception::EIdException(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall EIdNotEnoughDataInBuffer(int Ident)/* overload */ : Idexception::EIdException(Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall EIdNotEnoughDataInBuffer(int Ident, System::TVarRec const * Args, const int Args_Size)/* overload */ : Idexception::EIdException(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall EIdNotEnoughDataInBuffer(const AnsiString Msg, int AHelpContext) : Idexception::EIdException(Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall EIdNotEnoughDataInBuffer(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size, int AHelpContext) : Idexception::EIdException(Msg, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall EIdNotEnoughDataInBuffer(int Ident, int AHelpContext)/* overload */ : Idexception::EIdException(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall EIdNotEnoughDataInBuffer(System::PResStringRec ResStringRec, System::TVarRec const * Args, const int Args_Size, int AHelpContext)/* overload */ : Idexception::EIdException(ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~EIdNotEnoughDataInBuffer(void) { }
	#pragma option pop
	
};


class DELPHICLASS EIdTooMuchDataInBuffer;
class PASCALIMPLEMENTATION EIdTooMuchDataInBuffer : public Idexception::EIdException 
{
	typedef Idexception::EIdException inherited;
	
public:
	#pragma option push -w-inl
	/* EIdException.Create */ inline __fastcall virtual EIdTooMuchDataInBuffer(AnsiString AMsg)/* overload */ : Idexception::EIdException(AMsg) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* Exception.CreateFmt */ inline __fastcall EIdTooMuchDataInBuffer(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size) : Idexception::EIdException(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall EIdTooMuchDataInBuffer(int Ident)/* overload */ : Idexception::EIdException(Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall EIdTooMuchDataInBuffer(int Ident, System::TVarRec const * Args, const int Args_Size)/* overload */ : Idexception::EIdException(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall EIdTooMuchDataInBuffer(const AnsiString Msg, int AHelpContext) : Idexception::EIdException(Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall EIdTooMuchDataInBuffer(const AnsiString Msg, System::TVarRec const * Args, const int Args_Size, int AHelpContext) : Idexception::EIdException(Msg, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall EIdTooMuchDataInBuffer(int Ident, int AHelpContext)/* overload */ : Idexception::EIdException(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall EIdTooMuchDataInBuffer(System::PResStringRec ResStringRec, System::TVarRec const * Args, const int Args_Size, int AHelpContext)/* overload */ : Idexception::EIdException(ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~EIdTooMuchDataInBuffer(void) { }
	#pragma option pop
	
};


typedef void __fastcall (__closure *TIdBufferBytesRemoved)(System::TObject* ASender, int ABytes);

class DELPHICLASS TIdBuffer;
class PASCALIMPLEMENTATION TIdBuffer : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	AnsiString __fastcall GetAsString();
	
protected:
	DynamicArray<Byte >  FBytes;
	Idglobal::TIdEncoding FEncoding;
	int FGrowthFactor;
	int FHeadIndex;
	TIdBufferBytesRemoved FOnBytesRemoved;
	int FSize;
	void __fastcall CheckAdd(int AByteCount, const int AIndex);
	void __fastcall CheckByteCount(int &VByteCount, const int AIndex);
	int __fastcall GetCapacity(void);
	void __fastcall SetCapacity(int AValue);
	
public:
	void __fastcall Clear(void);
	__fastcall TIdBuffer(void)/* overload */;
	__fastcall TIdBuffer(TIdBufferBytesRemoved AOnBytesRemoved)/* overload */;
	__fastcall TIdBuffer(int AGrowthFactor)/* overload */;
	__fastcall TIdBuffer(const Idglobal::TBytes ABytes, const int ALength)/* overload */;
	void __fastcall CompactHead(bool ACanShrink = true);
	__fastcall virtual ~TIdBuffer(void);
	AnsiString __fastcall Extract(int AByteCount = 0xffffffff);
	void __fastcall ExtractToStream(const Classes::TStream* AStream, int AByteCount = 0xffffffff, const int AIndex = 0xffffffff);
	void __fastcall ExtractToIdBuffer(TIdBuffer* ABuffer, int AByteCount = 0xffffffff, const int AIndex = 0xffffffff);
	void __fastcall ExtractToBytes(Idglobal::TBytes &VBytes, int AByteCount = 0xffffffff, bool AAppend = true, int AIndex = 0xffffffff);
	Byte __fastcall ExtractToByte(const int AIndex);
	Word __fastcall ExtractToWord(const int AIndex);
	unsigned __fastcall ExtractToCardinal(const int AIndex);
	__int64 __fastcall ExtractToInt64(const int AIndex);
	Word __fastcall ExtractToIPv6(const int AIndex);
	int __fastcall IndexOf(const Idglobal::TBytes ABytes, int AStartPos = 0x0)/* overload */;
	int __fastcall IndexOf(const AnsiString AString, int AStartPos = 0x0)/* overload */;
	Byte __fastcall PeekByte(int AIndex);
	void __fastcall Remove(int AByteCount);
	void __fastcall SaveToStream(const Classes::TStream* AStream);
	void __fastcall WriteLen(Idglobal::TBytes ABytes, const int ALength, const int ADestIndex = 0xffffffff);
	void __fastcall Write(const AnsiString AString, Idglobal::TIdEncoding AEncoding = (Idglobal::TIdEncoding)(0x0), const int ADestIndex = 0xffffffff)/* overload */;
	void __fastcall Write(Idglobal::TBytes ABytes, const int ADestIndex = 0xffffffff)/* overload */;
	void __fastcall Write(Classes::TStream* AStream, int AByteCount = 0x0)/* overload */;
	void __fastcall Write(const __int64 AValue, const int ADestIndex = 0xffffffff)/* overload */;
	void __fastcall Write(const unsigned AValue, const int ADestIndex = 0xffffffff)/* overload */;
	void __fastcall Write(const Word AValue, const int ADestIndex = 0xffffffff)/* overload */;
	void __fastcall Write(const Byte AValue, const int ADestIndex = 0xffffffff)/* overload */;
	void __fastcall Write(Word const * AValue, const int ADestIndex = 0xffffffff)/* overload */;
	__property int Capacity = {read=GetCapacity, write=SetCapacity, nodefault};
	__property Idglobal::TIdEncoding Encoding = {read=FEncoding, write=FEncoding, nodefault};
	__property int GrowthFactor = {read=FGrowthFactor, write=FGrowthFactor, nodefault};
	__property int Size = {read=FSize, nodefault};
	__property AnsiString AsString = {read=GetAsString};
};


//-- var, const, procedure ---------------------------------------------------

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

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