| 1 | // Created on: 2001-07-17 |
| 2 | // Created by: Julia DOROVSKIKH <jfa@hotdox.nnov.matra-dtv.fr> |
| 3 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
| 4 | // |
| 5 | // This file is part of Open CASCADE Technology software library. |
| 6 | // |
| 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 |
| 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. |
| 12 | // |
| 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 14 | // commercial license or contractual agreement. |
| 15 | |
| 16 | #ifndef _XmlObjMgt_HeaderFile |
| 17 | #define _XmlObjMgt_HeaderFile |
| 18 | |
| 19 | #include <Standard.hxx> |
| 20 | #include <Standard_DefineAlloc.hxx> |
| 21 | #include <Standard_Handle.hxx> |
| 22 | |
| 23 | #include <XmlObjMgt_DOMString.hxx> |
| 24 | #include <Standard_Boolean.hxx> |
| 25 | #include <XmlObjMgt_Element.hxx> |
| 26 | #include <Standard_Integer.hxx> |
| 27 | #include <Standard_CString.hxx> |
| 28 | #include <Standard_Real.hxx> |
| 29 | class TCollection_ExtendedString; |
| 30 | class TCollection_AsciiString; |
| 31 | class XmlObjMgt_Persistent; |
| 32 | class XmlObjMgt_GP; |
| 33 | class XmlObjMgt_Array1; |
| 34 | |
| 35 | |
| 36 | //! This package defines services to manage the storage |
| 37 | //! grain of data produced by applications and those classes |
| 38 | //! to manage persistent extern reference. |
| 39 | class XmlObjMgt |
| 40 | { |
| 41 | public: |
| 42 | |
| 43 | DEFINE_STANDARD_ALLOC |
| 44 | |
| 45 | |
| 46 | //! Define the name of XMLattribute 'ID' (to be used everywhere) |
| 47 | Standard_EXPORT static const XmlObjMgt_DOMString& IdString(); |
| 48 | |
| 49 | //! Add attribute <theElement extstring="theString" ...> |
| 50 | Standard_EXPORT static Standard_Boolean SetExtendedString (XmlObjMgt_Element& theElement, const TCollection_ExtendedString& theString); |
| 51 | |
| 52 | //! Get attribute <theElement extstring="theString" ...> |
| 53 | Standard_EXPORT static Standard_Boolean GetExtendedString (const XmlObjMgt_Element& theElement, TCollection_ExtendedString& theString); |
| 54 | |
| 55 | //! Returns the first child text node |
| 56 | Standard_EXPORT static XmlObjMgt_DOMString GetStringValue (const XmlObjMgt_Element& theElement); |
| 57 | |
| 58 | //! Add theData as the last child text node to theElement |
| 59 | //! isClearText(True) avoids analysis of the string and replacement |
| 60 | //! of characters like '<' and '&' during XML file storage. |
| 61 | //! Do NEVER set isClearText unless you have a hell of a reason |
| 62 | Standard_EXPORT static void SetStringValue (XmlObjMgt_Element& theElement, const XmlObjMgt_DOMString& theData, const Standard_Boolean isClearText = Standard_False); |
| 63 | |
| 64 | //! Convert XPath expression (DOMString) into TagEntry string |
| 65 | //! returns False on Error |
| 66 | Standard_EXPORT static Standard_Boolean GetTagEntryString (const XmlObjMgt_DOMString& theTarget, TCollection_AsciiString& theTagEntry); |
| 67 | |
| 68 | //! Convert XPath expression (DOMString) into TagEntry string |
| 69 | //! returns False on Error |
| 70 | Standard_EXPORT static void SetTagEntryString (XmlObjMgt_DOMString& theSource, const TCollection_AsciiString& theTagEntry); |
| 71 | |
| 72 | Standard_EXPORT static XmlObjMgt_Element FindChildElement (const XmlObjMgt_Element& theSource, const Standard_Integer theObjId); |
| 73 | |
| 74 | Standard_EXPORT static XmlObjMgt_Element FindChildByRef (const XmlObjMgt_Element& theSource, const XmlObjMgt_DOMString& theRefName); |
| 75 | |
| 76 | Standard_EXPORT static XmlObjMgt_Element FindChildByName (const XmlObjMgt_Element& theSource, const XmlObjMgt_DOMString& theName); |
| 77 | |
| 78 | Standard_EXPORT static Standard_Boolean GetInteger (Standard_CString& theString, Standard_Integer& theValue); |
| 79 | |
| 80 | Standard_EXPORT static Standard_Boolean GetReal (Standard_CString& theString, Standard_Real& theValue); |
| 81 | |
| 82 | Standard_EXPORT static Standard_Boolean GetReal (const XmlObjMgt_DOMString& theString, Standard_Real& theValue); |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | protected: |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | private: |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | friend class XmlObjMgt_Persistent; |
| 99 | friend class XmlObjMgt_GP; |
| 100 | friend class XmlObjMgt_Array1; |
| 101 | |
| 102 | }; |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | #endif // _XmlObjMgt_HeaderFile |