Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:12

0001 // Created on: 2001-07-20
0002 // Created by: Alexander GRIGORIEV
0003 // Copyright (c) 2001-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 //AGV 060302: Input from std::istream
0017 //            AGV 130302: bug corr: was error if strlen(root_elem_name) < 7
0018 
0019 #ifndef LDOM_XmlReader_HeaderFile
0020 #define LDOM_XmlReader_HeaderFile
0021 
0022 //#define XML_BUFFER_SIZE 1000
0023 #define XML_BUFFER_SIZE 20480
0024 
0025 #include <LDOM_BasicElement.hxx>
0026 #include <LDOM_OSStream.hxx>
0027 
0028 class TCollection_AsciiString;
0029 
0030 //  Class LDOM_XmlReader
0031 //
0032 
0033 class LDOM_XmlReader 
0034 {
0035  public:
0036   enum RecordType {
0037     XML_UNKNOWN,
0038     XML_HEADER,
0039     XML_DOCTYPE,
0040     XML_COMMENT,
0041     XML_START_ELEMENT,
0042     XML_END_ELEMENT,
0043     XML_FULL_ELEMENT,
0044     XML_TEXT,
0045     XML_CDATA,
0046     XML_EOF
0047   };
0048 
0049   // ---------- PUBLIC METHODS ----------
0050   LDOM_XmlReader (const Handle(LDOM_MemManager)& aDocument,
0051                   TCollection_AsciiString& anErrorString,
0052                   const Standard_Boolean theTagPerStep = Standard_False);
0053   // Constructor - takes a file descriptor for input
0054   // Constructor - takes an std::istream for input
0055 
0056   RecordType ReadRecord (Standard_IStream& theIStream,
0057                          LDOM_OSStream& theData,
0058                          Standard_Boolean& theDocStart);
0059   // reading a markup or other element of XML format
0060 
0061   LDOM_BasicElement& GetElement() const { return * myElement; }
0062   // get the last element retrieved from the stream
0063 
0064   void CreateElement (const char *theName, const Standard_Integer theLen);
0065 
0066   static Standard_Boolean getInteger (LDOMBasicString&       theValue,
0067                                       const char             * theStart,
0068                                       const char             * theEnd);
0069   // try convert string theStart to LDOM_AsciiInteger, return False on success
0070 
0071   // Returns the byte order mask defined at the start of a stream
0072   LDOM_OSStream::BOMType GetBOM() const { return myBOM; }
0073 
0074  private:
0075   // ---------- PRIVATE (PROHIBITED) METHODS ----------
0076   LDOM_XmlReader (const LDOM_XmlReader& theOther);
0077   // Copy constructor
0078 
0079   LDOM_XmlReader& operator = (const LDOM_XmlReader& theOther);
0080   // Assignment
0081 
0082  private:
0083   // ---------- PRIVATE FIELDS ----------
0084 
0085   Standard_Boolean              myEOF;
0086   TCollection_AsciiString       & myError;
0087   Handle(LDOM_MemManager)       myDocument;
0088   LDOM_BasicElement             * myElement;
0089   const LDOM_BasicNode          * myLastChild;  // optim. reading attributes
0090   const char                    * myPtr;
0091   const char                    * myEndPtr;
0092   char                          myBuffer [XML_BUFFER_SIZE+4];
0093   Standard_Boolean              myTagPerStep;
0094   LDOM_OSStream::BOMType        myBOM;
0095 };
0096 
0097 #endif