0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / LDOM / LDOM_XmlReader.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
04232180 16//AGV 060302: Input from std::istream
7fd59977 17// AGV 130302: bug corr: was error if strlen(root_elem_name) < 7
18
19#ifndef LDOM_XmlReader_HeaderFile
20#define LDOM_XmlReader_HeaderFile
21
22//#define XML_BUFFER_SIZE 1000
23#define XML_BUFFER_SIZE 20480
24
25#include <LDOM_BasicElement.hxx>
8f34d47e 26#include <LDOM_OSStream.hxx>
7fd59977 27
28class TCollection_AsciiString;
7fd59977 29
30// Class LDOM_XmlReader
31//
32
33class LDOM_XmlReader
34{
35 public:
36 enum RecordType {
37 XML_UNKNOWN,
38 XML_HEADER,
39 XML_DOCTYPE,
40 XML_COMMENT,
41 XML_START_ELEMENT,
42 XML_END_ELEMENT,
43 XML_FULL_ELEMENT,
44 XML_TEXT,
45 XML_CDATA,
46 XML_EOF
47 };
48
49 // ---------- PUBLIC METHODS ----------
4ff92abe 50 LDOM_XmlReader (const Handle(LDOM_MemManager)& aDocument,
5fce1605 51 TCollection_AsciiString& anErrorString,
52 const Standard_Boolean theTagPerStep = Standard_False);
7fd59977 53 // Constructor - takes a file descriptor for input
04232180 54 // Constructor - takes an std::istream for input
7fd59977 55
7b3a032f 56 RecordType ReadRecord (Standard_IStream& theIStream,
57 LDOM_OSStream& theData,
58 Standard_Boolean& theDocStart);
7fd59977 59 // reading a markup or other element of XML format
60
7b3a032f 61 LDOM_BasicElement& GetElement() const { return * myElement; }
7fd59977 62 // get the last element retrieved from the stream
63
5fce1605 64 void CreateElement (const char *theName, const Standard_Integer theLen);
65
7b3a032f 66 static Standard_Boolean getInteger (LDOMBasicString& theValue,
67 const char * theStart,
68 const char * theEnd);
7fd59977 69 // try convert string theStart to LDOM_AsciiInteger, return False on success
70
8f34d47e 71 // Returns the byte order mask defined at the start of a stream
72 LDOM_OSStream::BOMType GetBOM() const { return myBOM; }
73
7fd59977 74 private:
75 // ---------- PRIVATE (PROHIBITED) METHODS ----------
76 LDOM_XmlReader (const LDOM_XmlReader& theOther);
77 // Copy constructor
78
79 LDOM_XmlReader& operator = (const LDOM_XmlReader& theOther);
80 // Assignment
81
82 private:
83 // ---------- PRIVATE FIELDS ----------
84
85 Standard_Boolean myEOF;
7fd59977 86 TCollection_AsciiString & myError;
87 Handle(LDOM_MemManager) myDocument;
88 LDOM_BasicElement * myElement;
89 const LDOM_BasicNode * myLastChild; // optim. reading attributes
90 const char * myPtr;
91 const char * myEndPtr;
92 char myBuffer [XML_BUFFER_SIZE+4];
5fce1605 93 Standard_Boolean myTagPerStep;
8f34d47e 94 LDOM_OSStream::BOMType myBOM;
7fd59977 95};
96
97#endif