0024428: Implementation of LGPL license
[occt.git] / src / LDOM / LDOMParser.hxx
CommitLineData
b311480e 1// Created on: 2001-07-20
2// Created by: Alexander GRIGORIEV
973c2be1 3// Copyright (c) 2001-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
973c2be1 7// This library is free software; you can redistribute it and / or modify it
8// under the terms of the GNU Lesser General Public version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//AGV 060302: Input from istream
7fd59977 17
18#ifndef LDOMParser_HeaderFile
19#define LDOMParser_HeaderFile
20
21#include <LDOM_Document.hxx>
22#include <LDOM_OSStream.hxx>
23
24class LDOM_XmlReader;
25//class istream;
26
27// Class LDOMParser
28//
29
30class LDOMParser
31{
32 public:
33 // ---------- PUBLIC METHODS ----------
34
35 LDOMParser () : myReader (NULL), myCurrentData (16384) {}
36 // Empty constructor
37
38 virtual Standard_EXPORT ~LDOMParser ();
39 // Destructor
40
41 Standard_EXPORT LDOM_Document
42 getDocument ();
43 // Get the LDOM_Document
44
45 Standard_EXPORT Standard_Boolean
46 parse (const char * const aFileName);
47 // Parse a file
48 // Returns True if error occurred, then GetError() can be called
49
50 Standard_EXPORT Standard_Boolean
51 parse (istream& anInput);
52 // Parse a C++ stream
53 // Returns True if error occurred, then GetError() can be called
54
55 Standard_EXPORT const TCollection_AsciiString&
56 GetError (TCollection_AsciiString& aData) const;
57 // Return text describing a parsing error, or Empty if no error occurred
58
59 protected:
60 // ---------- PROTECTED METHODS ----------
61
62 Standard_EXPORT virtual Standard_Boolean
63 startElement ();
64 // virtual hook on 'StartElement' event for descendant classes
65
66 Standard_EXPORT virtual Standard_Boolean
67 endElement ();
68 // virtual hook on 'EndElement' event for descendant classes
69
70 Standard_EXPORT LDOM_Element
71 getCurrentElement () const;
72 // to be called from startElement() and endElement()
73
74 private:
75 // ---------- PRIVATE METHODS ----------
76 Standard_Boolean ParseDocument ();
77
78 Standard_Boolean ParseElement ();
79
80 // ---------- PRIVATE (PROHIBITED) METHODS ----------
81
82 LDOMParser (const LDOMParser& theOther);
83 // Copy constructor
84
85 LDOMParser& operator = (const LDOMParser& theOther);
86 // Assignment
87
88 private:
89 // ---------- PRIVATE FIELDS ----------
90
91 LDOM_XmlReader * myReader;
92 Handle(LDOM_MemManager) myDocument;
93 LDOM_OSStream myCurrentData;
94 TCollection_AsciiString myError;
95};
96
97#endif