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

// (DO NOT EDIT: machine generated header) 'QImport3XMLSax.pas' rev: 34.00 (Windows)

#ifndef Qimport3xmlsaxHPP
#define Qimport3xmlsaxHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member 
#pragma pack(push,8)
#include <System.hpp>
#include <SysInit.hpp>
#include <System.Classes.hpp>
#include <System.SysUtils.hpp>
#include <System.Variants.hpp>
#include <System.Types.hpp>
#include <QImport3StrTypes.hpp>
#include <QImport3Encoding.hpp>
#include <QImport3HashTable.hpp>
#include <QImport3BaseDocumentFile.hpp>
#include <QImport3Common.hpp>
#include <QImport3WideStrUtils.hpp>
#include <System.WideStrings.hpp>

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

namespace Qimport3xmlsax
{
//-- forward type declarations -----------------------------------------------
class DELPHICLASS TQIXMLObjectStack;
struct TQIXMLToken;
class DELPHICLASS TQIXMLTokenStack;
class DELPHICLASS TQIXMLBuffer;
class DELPHICLASS TQITokenizer;
class DELPHICLASS TQIXMLTokenizer;
class DELPHICLASS TQIXMLAttrList;
class DELPHICLASS TQIXPathAttrStack;
class DELPHICLASS TQIXMLTagsStack;
class DELPHICLASS TQIXMLStreamProcessor;
class DELPHICLASS TQISAXParser;
class DELPHICLASS TQIDirectReadParser;
struct TQIExpression;
struct TQIDataContainer;
struct TQIBufferNode;
struct TQIDataNode;
struct TQIQueryNode;
class DELPHICLASS TQIDataNodeStack;
class DELPHICLASS TQIMappingTable;
class DELPHICLASS TQIPredicateCalc;
class DELPHICLASS TQIAmbiguityCalc;
class DELPHICLASS TQINodeCalc;
class DELPHICLASS TQIAttributeCalc;
class DELPHICLASS TQINumericCalc;
class DELPHICLASS TQIFunctionCalc;
class DELPHICLASS TQIStringCalc;
class DELPHICLASS TQIXPathEvaluator;
struct TQIXPathToken;
class DELPHICLASS TQIXPathTokenStack;
class DELPHICLASS TQIXPathTokenizer;
class DELPHICLASS TQIXPathParser;
class DELPHICLASS TQIXMLCharsetDetector;
//-- type declarations -------------------------------------------------------
enum DECLSPEC_DENUM TQIXMLTokenKind : unsigned char { xtkOpenDoc, xtkDocType, xtkComment, xtkOpenXMLDecl, xtkXMLDeclAttr, xtkCloseXMLDecl, xtkOpenElem, xtkElemAttr, xtkFinishElem, xtkFinishCloseElem, xtkCloseElem, xtkInstruction, xtkText, xtkReference, xtkCData };

enum DECLSPEC_DENUM TQIXPathTokenKind : unsigned char { ptkUnknown, ptkString, ptkNode, ptkAttribute, ptkAxis, ptkNamespace, ptkNumber, ptkOpenPred, ptkClosePred, ptkOpenGroup, ptkCloseGroup, ptkFunction, ptkAnd, ptkOr, ptkDiv, ptkMod, ptkMult, ptkPlus, ptkMinus, ptkEqual, ptkNotEq, ptkLower, ptkLowEq, ptkGreater, ptkGreEq, ptkComma };

enum DECLSPEC_DENUM TQIXMLTextType : unsigned char { xttText, xttCData, xttReference, xttComment };

enum DECLSPEC_DENUM TQIXMLNodeAction : unsigned char { xnaOpen, xnaFinish, xnaClose };

class PASCALIMPLEMENTATION TQIXMLObjectStack : public System::TObject
{
	typedef System::TObject inherited;
	
public:
	void * operator[](const int Index) { return this->Items[Index]; }
	
private:
	System::Classes::TList* FList;
	int FCount;
	void * __fastcall GetItems(const int Index);
	
protected:
	void * __fastcall AddItem();
	virtual void __fastcall DisposeItem(const int Index);
	virtual void * __fastcall NewItem() = 0 ;
	
public:
	__fastcall TQIXMLObjectStack();
	__fastcall virtual ~TQIXMLObjectStack();
	void __fastcall Clear();
	void __fastcall Pop();
	int __fastcall IndexOf(const void * Value);
	void __fastcall Push();
	__property int Count = {read=FCount, nodefault};
	__property void * Items[const int Index] = {read=GetItems/*, default*/};
};


typedef TQIXMLToken *PQIXMLToken;

#pragma pack(push,1)
struct DECLSPEC_DRECORD TQIXMLToken
{
public:
	System::WideString Name;
	System::WideString Value;
	TQIXMLTokenKind Kind;
};
#pragma pack(pop)


class PASCALIMPLEMENTATION TQIXMLTokenStack : public TQIXMLObjectStack
{
	typedef TQIXMLObjectStack inherited;
	
public:
	PQIXMLToken operator[](const int Index) { return this->Items[Index]; }
	
private:
	HIDESBASE PQIXMLToken __fastcall GetItems(const int Index);
	
protected:
	virtual void * __fastcall NewItem();
	
public:
	PQIXMLToken __fastcall Add();
	PQIXMLToken __fastcall Top();
	__property PQIXMLToken Items[const int Index] = {read=GetItems/*, default*/};
public:
	/* TQIXMLObjectStack.Create */ inline __fastcall TQIXMLTokenStack() : TQIXMLObjectStack() { }
	/* TQIXMLObjectStack.Destroy */ inline __fastcall virtual ~TQIXMLTokenStack() { }
	
};


class PASCALIMPLEMENTATION TQIXMLBuffer : public System::TObject
{
	typedef System::TObject inherited;
	
	
private:
	typedef System::DynamicArray<System::WideChar> _TQIXMLBuffer__1;
	
	
private:
	_TQIXMLBuffer__1 FBuffer;
	int FIndex;
	int FSize;
	Qimport3encoding::TQIBufferIterator* FIterator;
	void __fastcall SetBufferLength();
	
public:
	__fastcall TQIXMLBuffer(int Size);
	__fastcall virtual ~TQIXMLBuffer();
	void __fastcall BuildString(System::WideString &Result, bool KillSpaces = false)/* overload */;
	void __fastcall BuildString(System::WideString &Result, int Offset, bool KillSpaces = false)/* overload */;
	void __fastcall Reset();
	void __fastcall StoreChar(const System::WideChar Char);
	void __fastcall StoreText(const System::WideString Text)/* overload */;
};


class PASCALIMPLEMENTATION TQITokenizer : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	TQIXMLBuffer* FBuffer;
	Qimport3encoding::TQIIterator* FIterator;
	
protected:
	virtual void __fastcall DoError();
	virtual void __fastcall ScanName(System::WideString &Name);
	virtual bool __fastcall StoreCurrentChar(Qimport3encoding::TQICharType CharType) = 0 ;
	
public:
	__fastcall TQITokenizer();
	__fastcall virtual ~TQITokenizer();
	virtual void __fastcall Reset();
};


class PASCALIMPLEMENTATION TQIXMLTokenizer : public TQITokenizer
{
	typedef TQITokenizer inherited;
	
private:
	TQIXMLTokenStack* FAttributes;
	TQIXMLToken *FCurrentToken;
	bool FDTDDetected;
	Qimport3hashtable::TQImportHashTable* FEntities;
	bool FKeepSpaces;
	TQIXMLTokenKind FPrevTokenKind;
	Qimport3encoding::TQICharType FPrevIteratorType;
	bool FEmptyValueDetected;
	TQIXMLTokenStack* FOpenElements;
	bool FPreserveSpaces;
	bool FRootOpened;
	bool FSpaceOnly;
	void __fastcall FillEntities();
	void __fastcall FillDefaultEntities();
	void __fastcall DisposeEntities();
	
protected:
	virtual bool __fastcall StoreCurrentChar(Qimport3encoding::TQICharType CharType);
	
public:
	__fastcall TQIXMLTokenizer(const System::UnicodeString FileName, Qimport3encoding::TQICharsetType Charset, TQIXMLTokenStack* Attributes);
	__fastcall virtual ~TQIXMLTokenizer();
	bool __fastcall GetNextToken(PQIXMLToken &Token);
	virtual void __fastcall Reset();
	__property bool KeepSpaces = {write=FKeepSpaces, nodefault};
};


class PASCALIMPLEMENTATION TQIXMLAttrList : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	int FIndex;
	TQIXMLTokenStack* FList;
	PQIXMLToken __fastcall GetCurrent();
	
public:
	__fastcall virtual TQIXMLAttrList();
	__fastcall virtual ~TQIXMLAttrList();
	bool __fastcall MoveNext();
	void __fastcall Reset();
	__property PQIXMLToken Current = {read=GetCurrent};
};


_DECLARE_METACLASS(System::TMetaClass, TQIXMLAttrListClass);

class PASCALIMPLEMENTATION TQIXPathAttrStack : public TQIXMLAttrList
{
	typedef TQIXMLAttrList inherited;
	
private:
	System::Classes::TList* FStack;
	
public:
	__fastcall virtual TQIXPathAttrStack();
	__fastcall virtual ~TQIXPathAttrStack();
	TQIXMLTokenStack* __fastcall Clone();
	void __fastcall Pop();
	void __fastcall Push(TQIXMLTokenStack* List);
};


class PASCALIMPLEMENTATION TQIXMLTagsStack : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	System::Widestrings::TWideStringList* FStack;
	
public:
	__fastcall TQIXMLTagsStack();
	__fastcall virtual ~TQIXMLTagsStack();
	System::WideString __fastcall Top();
	void __fastcall Push(System::WideString ATag);
	void __fastcall Pop();
};


typedef void __fastcall (__closure *TQIXMLNotifyEvent)(TQIXMLStreamProcessor* Sender);

typedef void __fastcall (__closure *TQIXMLTextEvent)(TQIXMLStreamProcessor* Sender, const System::WideString Text, TQIXMLTextType TextType);

typedef void __fastcall (__closure *TQIXMLElementEvent)(TQIXMLStreamProcessor* Sender, const System::WideString Name, TQIXMLNodeAction Action);

typedef void __fastcall (__closure *TQIXMLDocumentEvent)(TQIXMLStreamProcessor* Sender, TQIXMLNodeAction Action);

typedef void __fastcall (__closure *TQIXMLProcInstructionEvent)(TQIXMLStreamProcessor* Sender, const System::WideString Target, const System::WideString Content);

class PASCALIMPLEMENTATION TQIXMLStreamProcessor : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	bool FDocStarted;
	bool FKeepSpaces;
	TQIXMLTextEvent FOnGetText;
	TQIXMLDocumentEvent FOnLoadDocument;
	TQIXMLElementEvent FOnLoadElement;
	TQIXMLTagsStack* FTags;
	System::WideString FCurrentTag;
	void __fastcall DoLoadDocument(TQIXMLNodeAction Action);
	
protected:
	bool FHalt;
	TQIXMLAttrList* FAttributes;
	TQIXMLTokenizer* FTokenizer;
	virtual void __fastcall DoGetText(const System::WideString Text, TQIXMLTextType TextType);
	virtual void __fastcall DoLoadElement(const System::WideString Name, TQIXMLNodeAction Action);
	bool __fastcall ProcessDocument(const System::UnicodeString FileName);
	virtual void __fastcall DoProcessToken(PQIXMLToken Token);
	virtual TQIXMLAttrListClass __fastcall GetAttributeListClass() = 0 ;
	
public:
	__fastcall virtual TQIXMLStreamProcessor();
	__fastcall virtual ~TQIXMLStreamProcessor();
	bool __fastcall GetNextAttribute(/* out */ System::WideString &Name, /* out */ System::WideString &Value, bool Stop = false);
	void __fastcall Halt();
	__property bool KeepSpaces = {write=FKeepSpaces, nodefault};
	__property System::WideString CurrentTag = {read=FCurrentTag};
	__property TQIXMLTextEvent OnGetText = {read=FOnGetText, write=FOnGetText};
	__property TQIXMLDocumentEvent OnLoadDocument = {read=FOnLoadDocument, write=FOnLoadDocument};
	__property TQIXMLElementEvent OnLoadElement = {read=FOnLoadElement, write=FOnLoadElement};
};


_DECLARE_METACLASS(System::TMetaClass, TQIXMLStreamProcessorClass);

class PASCALIMPLEMENTATION TQISAXParser : public TQIXMLStreamProcessor
{
	typedef TQIXMLStreamProcessor inherited;
	
private:
	TQIXMLProcInstructionEvent FOnProcessingInstruction;
	TQIXMLNotifyEvent FOnLoadDeclaration;
	void __fastcall DoLoadDeclaration();
	void __fastcall DoProcessingInstruction(const System::WideString Target, const System::WideString Content);
	
protected:
	virtual void __fastcall DoGetText(const System::WideString Text, TQIXMLTextType TextType);
	virtual void __fastcall DoProcessToken(PQIXMLToken Token);
	virtual TQIXMLAttrListClass __fastcall GetAttributeListClass();
	
public:
	bool __fastcall Parse(const System::UnicodeString FileName);
	__property TQIXMLNotifyEvent OnLoadDeclaration = {read=FOnLoadDeclaration, write=FOnLoadDeclaration};
	__property TQIXMLProcInstructionEvent OnProcessingInstruction = {read=FOnProcessingInstruction, write=FOnProcessingInstruction};
public:
	/* TQIXMLStreamProcessor.Create */ inline __fastcall virtual TQISAXParser() : TQIXMLStreamProcessor() { }
	/* TQIXMLStreamProcessor.Destroy */ inline __fastcall virtual ~TQISAXParser() { }
	
};


class PASCALIMPLEMENTATION TQIDirectReadParser : public TQISAXParser
{
	typedef TQISAXParser inherited;
	
public:
	void __fastcall OpenDocument(const System::UnicodeString FileName);
	void __fastcall CloseDocument();
	bool __fastcall GetNextToken(PQIXMLToken &Token);
	virtual void __fastcall DoProcessToken(PQIXMLToken Token);
	__property bool Halted = {read=FHalt, nodefault};
public:
	/* TQIXMLStreamProcessor.Create */ inline __fastcall virtual TQIDirectReadParser() : TQISAXParser() { }
	/* TQIXMLStreamProcessor.Destroy */ inline __fastcall virtual ~TQIDirectReadParser() { }
	
};


enum DECLSPEC_DENUM TQIPredicateOperation : unsigned char { qpoUndefined, qpoMult, qpoDiv, qpoMod, qpoPlus, qpoMinus, qpoLower, qpoLowEq, qpoGreater, qpoGreEq, qpoEqual, qpoNotEq, qpoAnd, qpoOr };

typedef TQIExpression *PQIExpression;

struct DECLSPEC_DRECORD TQIExpression
{
public:
	TQIPredicateOperation Operation;
	TQIPredicateCalc* Calculator;
	TQIExpression *Left;
	TQIExpression *Right;
	System::Variant Result;
};


enum DECLSPEC_DENUM TQINodeAxis : unsigned char { qnaUnsupported, qnaChild, qnaDescendant };

enum DECLSPEC_DENUM TQINodeOption : unsigned char { qnoRoot, qnoResult, qnoAxis, qnoPredicate, qnoLeaf };

typedef System::Set<TQINodeOption, TQINodeOption::qnoRoot, TQINodeOption::qnoLeaf> TQINodeOptions;

typedef TQIDataContainer *PQIDataContainer;

struct DECLSPEC_DRECORD TQIDataContainer
{
public:
	void *Attributes;
	System::WideString Name;
	void *Text;
};


enum DECLSPEC_DENUM TQIBufferState : unsigned char { qbsWait, qbsFlush, qbsFree };

typedef TQIBufferNode *PQIBufferNode;

struct DECLSPEC_DRECORD TQIBufferNode
{
public:
	TQIBufferState State;
	TQIDataContainer *Data;
};


typedef System::DynamicArray<PQIBufferNode> TQIBufferNodeSet;

typedef TQIBufferNodeSet *PQIBufferNodeSet;

typedef TQIDataNode *PQIDataNode;

struct DECLSPEC_DRECORD TQIDataNode
{
public:
	TQIDataContainer *Data;
	int Depth;
	System::Classes::TBits* Flags;
	TQIBufferNodeSet *List;
};


typedef TQIQueryNode *PQIQueryNode;

typedef System::DynamicArray<PQIQueryNode> TQIQueryNodeSet;

typedef TQIQueryNodeSet *PQIQueryNodeSet;

struct DECLSPEC_DRECORD TQIQueryNode
{
public:
	TQINodeAxis Axis;
	System::WideString Nodetest;
	TQIExpression *Predicate;
	TQINodeOptions Options;
	TQIQueryNode *Parent;
	TQIQueryNode *Child;
	int ChildrenCount;
	int Counter;
	TQIQueryNodeSet *PredChildren;
	TQIQueryNode *SegmentHost;
	int Pos;
	TQIDataNodeStack* DataStack;
};


class PASCALIMPLEMENTATION TQIDataNodeStack : public TQIXMLObjectStack
{
	typedef TQIXMLObjectStack inherited;
	
public:
	PQIDataNode operator[](const int Index) { return this->Items[Index]; }
	
private:
	TQIQueryNode *FOwner;
	HIDESBASE PQIDataNode __fastcall GetItems(const int Index);
	PQIDataNode __fastcall GetTop();
	
protected:
	virtual void __fastcall DisposeItem(const int Index);
	virtual void * __fastcall NewItem();
	
public:
	__fastcall TQIDataNodeStack(PQIQueryNode Owner);
	HIDESBASE void __fastcall Push(const int Depth, PQIDataContainer Data = (PQIDataContainer)(0x0));
	__property PQIDataNode Items[const int Index] = {read=GetItems/*, default*/};
	__property PQIDataNode Top = {read=GetTop};
public:
	/* TQIXMLObjectStack.Destroy */ inline __fastcall virtual ~TQIDataNodeStack() { }
	
};


typedef void __fastcall (__closure *TQIQueryPostOrderCallback)(PQIQueryNode &Sender);

class PASCALIMPLEMENTATION TQIMappingTable : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	TQIQueryNodeSet *FAsteriskSequence;
	System::WideString FCurrentName;
	TQIQueryNodeSet *FCurrentSequence;
	TQIQueryNode *FRoot;
	Qimport3hashtable::TQImportHashTable* FSequences;
	bool FResultFound;
	void __fastcall DisposeNode(PQIQueryNode &Sender);
	void __fastcall AppendSequence(PQIQueryNode &Sender);
	void __fastcall NodePostOrderTraversal(PQIQueryNode Root, TQIQueryPostOrderCallback Callback);
	
public:
	__fastcall TQIMappingTable(PQIQueryNode Root);
	__fastcall virtual ~TQIMappingTable();
	PQIQueryNodeSet __fastcall Add(const System::WideString Name);
	PQIQueryNodeSet __fastcall Find(const System::WideString Name);
};


class PASCALIMPLEMENTATION TQIPredicateCalc : public System::TObject
{
	typedef System::TObject inherited;
	
protected:
	virtual System::Variant __fastcall DoCalculate(PQIDataNode Data) = 0 ;
	
public:
	System::Variant __fastcall Calculate(PQIDataNode Data);
public:
	/* TObject.Create */ inline __fastcall TQIPredicateCalc() : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TQIPredicateCalc() { }
	
};


_DECLARE_METACLASS(System::TMetaClass, TQIPredicateExpressionClass);

enum DECLSPEC_DENUM TQICalcMethod : unsigned char { qcmUndefined, qcmExistance, qcmValue };

class PASCALIMPLEMENTATION TQIAmbiguityCalc : public TQIPredicateCalc
{
	typedef TQIPredicateCalc inherited;
	
private:
	TQIDataNode *FData;
	TQIXPathEvaluator* FEvaluator;
	TQICalcMethod FMethod;
	
protected:
	virtual bool __fastcall CheckExistance() = 0 ;
	virtual System::Variant __fastcall DoCalculate(PQIDataNode Data);
	virtual System::Variant __fastcall GetValue() = 0 ;
	
public:
	__fastcall TQIAmbiguityCalc();
	__property TQIXPathEvaluator* Evaluator = {read=FEvaluator, write=FEvaluator};
	__property TQICalcMethod Method = {read=FMethod, write=FMethod, nodefault};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TQIAmbiguityCalc() { }
	
};


class PASCALIMPLEMENTATION TQINodeCalc : public TQIAmbiguityCalc
{
	typedef TQIAmbiguityCalc inherited;
	
private:
	TQIQueryNode *FNode;
	
protected:
	virtual bool __fastcall CheckExistance();
	virtual System::Variant __fastcall GetValue();
	
public:
	__property PQIQueryNode Node = {read=FNode, write=FNode};
public:
	/* TQIAmbiguityCalc.Create */ inline __fastcall TQINodeCalc() : TQIAmbiguityCalc() { }
	
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TQINodeCalc() { }
	
};


class PASCALIMPLEMENTATION TQIAttributeCalc : public TQIAmbiguityCalc
{
	typedef TQIAmbiguityCalc inherited;
	
private:
	System::WideString FName;
	
protected:
	virtual bool __fastcall CheckExistance();
	virtual System::Variant __fastcall GetValue();
	
public:
	__fastcall TQIAttributeCalc();
	__property System::WideString Name = {read=FName, write=FName};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TQIAttributeCalc() { }
	
};


class PASCALIMPLEMENTATION TQINumericCalc : public TQINodeCalc
{
	typedef TQINodeCalc inherited;
	
private:
	System::Variant FValue;
	
protected:
	virtual bool __fastcall CheckExistance();
	virtual System::Variant __fastcall GetValue();
	
public:
	__fastcall TQINumericCalc();
	__property System::Variant Value = {read=GetValue, write=FValue};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TQINumericCalc() { }
	
};


typedef System::DynamicArray<PQIExpression> TQIExpressionSet;

typedef TQIExpressionSet *PQIExpressionSet;

class PASCALIMPLEMENTATION TQIFunctionCalc : public TQINodeCalc
{
	typedef TQINodeCalc inherited;
	
private:
	TQIExpressionSet *FArguments;
	System::WideString FName;
	
protected:
	virtual bool __fastcall CheckExistance();
	virtual System::Variant __fastcall GetValue();
	
public:
	__fastcall TQIFunctionCalc();
	__fastcall virtual ~TQIFunctionCalc();
	__property PQIExpressionSet Arguments = {read=FArguments};
	__property System::WideString Name = {write=FName};
};


class PASCALIMPLEMENTATION TQIStringCalc : public TQIPredicateCalc
{
	typedef TQIPredicateCalc inherited;
	
private:
	System::Variant FValue;
	
protected:
	virtual System::Variant __fastcall DoCalculate(PQIDataNode Data);
	
public:
	__fastcall TQIStringCalc();
	__property System::Variant Value = {read=FValue, write=FValue};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TQIStringCalc() { }
	
};


typedef void __fastcall (__closure *TQIEvaluatorPostOrderCallback)(PQIExpression Sender, PQIDataNode Data);

class PASCALIMPLEMENTATION TQIXPathEvaluator : public TQIXMLStreamProcessor
{
	typedef TQIXMLStreamProcessor inherited;
	
private:
	System::Classes::TList* FBufferQueue;
	int FDepth;
	System::Classes::TList* FTableList;
	bool FResultNodeOpened;
	void __fastcall BuildQueries(const System::WideString XPath);
	void __fastcall AddBuffer(PQIDataNode Data, PQIBufferNode Buffer);
	bool __fastcall Calculate(PQIQueryNode Node, PQIDataNode Data);
	void __fastcall ClearQueries();
	void __fastcall ClearBufferQueue();
	bool __fastcall CloseNode(PQIQueryNode Node);
	void __fastcall CalcPredicate(PQIExpression Sender, PQIDataNode Data);
	void __fastcall PostOrderTraversal(PQIExpression Root, PQIDataNode Data, TQIEvaluatorPostOrderCallback Callback);
	void __fastcall FlushBufferQueue();
	void __fastcall FreeBuffer(PQIBufferNode Buffer);
	void __fastcall MaskDFlags(PQIQueryNode Node, PQIDataNode Data, PQIDataNode Mask);
	bool __fastcall OpenNode(PQIQueryNode Node, TQIXPathAttrStack* Attributes);
	void __fastcall SetFlags(PQIQueryNode Node, PQIDataNode Data);
	void __fastcall ProcessBufferList(PQIDataNode Data, TQIBufferState State);
	
protected:
	virtual void __fastcall DoGetText(const System::WideString Text, TQIXMLTextType TextType);
	virtual void __fastcall DoProcessToken(PQIXMLToken Token);
	virtual void __fastcall DoLoadElement(const System::WideString Name, TQIXMLNodeAction Action);
	virtual TQIXMLAttrListClass __fastcall GetAttributeListClass();
	
public:
	__fastcall virtual TQIXPathEvaluator();
	__fastcall virtual ~TQIXPathEvaluator();
	bool __fastcall Evaluate(const System::UnicodeString FileName, const System::WideString XPath = System::WideString());
};


typedef TQIXPathToken *PQIXPathToken;

#pragma pack(push,1)
struct DECLSPEC_DRECORD TQIXPathToken
{
public:
	System::Variant Value;
	TQIXPathTokenKind Kind;
};
#pragma pack(pop)


class PASCALIMPLEMENTATION TQIXPathTokenStack : public TQIXMLObjectStack
{
	typedef TQIXMLObjectStack inherited;
	
public:
	PQIXPathToken operator[](const int Index) { return this->Items[Index]; }
	
private:
	HIDESBASE PQIXPathToken __fastcall GetItems(const int Index);
	
protected:
	virtual void * __fastcall NewItem();
	
public:
	PQIXPathToken __fastcall Add();
	__property PQIXPathToken Items[const int Index] = {read=GetItems/*, default*/};
public:
	/* TQIXMLObjectStack.Create */ inline __fastcall TQIXPathTokenStack() : TQIXMLObjectStack() { }
	/* TQIXMLObjectStack.Destroy */ inline __fastcall virtual ~TQIXPathTokenStack() { }
	
};


class PASCALIMPLEMENTATION TQIXPathTokenizer : public TQITokenizer
{
	typedef TQITokenizer inherited;
	
private:
	TQIXPathToken *FCurrentToken;
	TQIXPathTokenKind FPrevTokenKind;
	TQIXPathTokenStack* FTokens;
	
protected:
	virtual void __fastcall DoError();
	virtual void __fastcall ScanName(System::WideString &Name);
	virtual bool __fastcall StoreCurrentChar(Qimport3encoding::TQICharType CharType);
	
public:
	__fastcall TQIXPathTokenizer(const System::WideString XPath);
	__fastcall virtual ~TQIXPathTokenizer();
	bool __fastcall GetNextToken(PQIXPathToken &Token);
	virtual void __fastcall Reset();
};


class PASCALIMPLEMENTATION TQIXPathParser : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	TQIFunctionCalc* FCalc;
	TQIExpressionSet FGroupLevel;
	TQIXPathTokenKind FPrevTokenKind;
	TQIQueryNode *FNode;
	TQIXPathEvaluator* FOwner;
	int FPredLevel;
	TQIXPathTokenizer* FTokenizer;
	bool __fastcall CheckPredicate();
	bool __fastcall CheckGroup();
	bool __fastcall CheckFunction();
	PQIExpression __fastcall GetCurrentPredicate();
	void __fastcall SetCurrentPredicate(const PQIExpression Value);
	
protected:
	__property PQIExpression CurrentPredicate = {read=GetCurrentPredicate, write=SetCurrentPredicate};
	
public:
	__fastcall TQIXPathParser(TQIXPathEvaluator* Owner);
	void __fastcall Parse(const System::WideString XPath, /* out */ TQIMappingTable* &Table);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TQIXPathParser() { }
	
};


class PASCALIMPLEMENTATION TQIXMLCharsetDetector : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	System::UnicodeString FFileName;
	Qimport3encoding::TQICharsetType FCharset;
	bool __fastcall DetectByBOM();
	bool __fastcall DetectByAttribute();
	
public:
	__classmethod Qimport3encoding::TQICharsetType __fastcall GetXMLCharset(const System::UnicodeString FileName);
	bool __fastcall Detect(const System::UnicodeString FileName, /* out */ Qimport3encoding::TQICharsetType &Charset);
public:
	/* TObject.Create */ inline __fastcall TQIXMLCharsetDetector() : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TQIXMLCharsetDetector() { }
	
};


//-- var, const, procedure ---------------------------------------------------
}	/* namespace Qimport3xmlsax */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_QIMPORT3XMLSAX)
using namespace Qimport3xmlsax;
#endif
#pragma pack(pop)
#pragma option pop

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