1 // Created on: 2001-06-25
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef LDOMString_HeaderFile
17 #define LDOMString_HeaderFile
19 #include <LDOMBasicString.hxx>
20 #include <Handle_LDOM_MemManager.hxx>
23 // Represents various object types which can be mapped to XML strings
24 // LDOMString is not an independent type: you must be sure that the owner
25 // LDOM_Document is never lost during the lifetime of its LDOMStrings - for
26 // that it is necessary to keep at least one LDOM_Document or LDOM_Node alive
27 // before all LDOMString's (LDOM_AsciiDoc type) are destroyed.
29 class LDOMString : public LDOMBasicString
32 // ---------- PUBLIC METHODS ----------
34 LDOMString () : myPtrDoc (NULL) {}
37 LDOMString (const LDOMString& anOther)
38 : LDOMBasicString (anOther), myPtrDoc (anOther.myPtrDoc) {}
41 LDOMString (const Standard_Integer aValue)
42 : LDOMBasicString (aValue), myPtrDoc (NULL) {}
43 // Integer => LDOMString
45 // Standard_EXPORT LDOMString (const Standard_Real aValue);
47 LDOMString (const char * aValue)
48 : LDOMBasicString (aValue), myPtrDoc (NULL) {}
49 // Create LDOM_AsciiFree
51 const LDOM_MemManager& getOwnerDocument () const
52 { return * myPtrDoc; }
54 LDOMString& operator = (const LDOM_NullPtr * aNull)
55 { LDOMBasicString::operator= (aNull); return *this; }
57 LDOMString& operator = (const LDOMString& anOther)
59 myPtrDoc = anOther.myPtrDoc;
60 LDOMBasicString::operator= (anOther);
65 friend class LDOM_Document;
66 friend class LDOM_Node;
67 friend class LDOM_Element;
68 friend class LDOM_BasicElement;
69 friend class LDOM_BasicAttribute;
70 friend class LDOM_BasicText;
72 static LDOMString CreateDirectString
74 const LDOM_MemManager& aDoc);
76 LDOMString (const LDOMBasicString& anOther,
77 const LDOM_MemManager& aDoc)
78 : LDOMBasicString (anOther), myPtrDoc (&aDoc) {}
79 // Plain copy from LDOMBasicString
81 LDOMString (const LDOMBasicString& anOther,
82 const Handle(LDOM_MemManager)& aDoc);
83 // Copy from another string with allocation in the document space
86 // ---------- PRIVATE FIELDS -------------
87 const LDOM_MemManager * myPtrDoc;