0030286: Cover polygonal HLR algorithm by regression tests
[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//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 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
5fce1605 51 parse (istream& anInput,
52 const Standard_Boolean theTagPerStep = Standard_False,
53 const Standard_Boolean theWithoutRoot = Standard_False);
7fd59977 54 // Parse a C++ stream
5fce1605 55 // theTagPerStep - if true - extract characters from anInput until '>'
56 // extracted character and parse only these characters.
57 // if false - extract until eof
58 // theWithoutRoot - if true - create fictive "document" element before parsing
59 // and consider that document start element has been already read
60 // - if false - parse a document as usual (parse header, document tag and etc)
7fd59977 61 // Returns True if error occurred, then GetError() can be called
62
63 Standard_EXPORT const TCollection_AsciiString&
64 GetError (TCollection_AsciiString& aData) const;
65 // Return text describing a parsing error, or Empty if no error occurred
66
67 protected:
68 // ---------- PROTECTED METHODS ----------
69
70 Standard_EXPORT virtual Standard_Boolean
71 startElement ();
72 // virtual hook on 'StartElement' event for descendant classes
73
74 Standard_EXPORT virtual Standard_Boolean
75 endElement ();
76 // virtual hook on 'EndElement' event for descendant classes
77
78 Standard_EXPORT LDOM_Element
79 getCurrentElement () const;
80 // to be called from startElement() and endElement()
81
82 private:
83 // ---------- PRIVATE METHODS ----------
5fce1605 84 Standard_Boolean ParseDocument (Standard_IStream& theIStream, const Standard_Boolean theWithoutRoot = Standard_False);
7fd59977 85
4ff92abe 86 Standard_Boolean ParseElement (Standard_IStream& theIStream);
7fd59977 87
88 // ---------- PRIVATE (PROHIBITED) METHODS ----------
89
90 LDOMParser (const LDOMParser& theOther);
91 // Copy constructor
92
93 LDOMParser& operator = (const LDOMParser& theOther);
94 // Assignment
95
96 private:
97 // ---------- PRIVATE FIELDS ----------
98
99 LDOM_XmlReader * myReader;
100 Handle(LDOM_MemManager) myDocument;
101 LDOM_OSStream myCurrentData;
102 TCollection_AsciiString myError;
103};
104
105#endif