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>
21 class LDOM_MemManager;
24 // Represents various object types which can be mapped to XML strings
25 // LDOMString is not an independent type: you must be sure that the owner
26 // LDOM_Document is never lost during the lifetime of its LDOMStrings - for
27 // that it is necessary to keep at least one LDOM_Document or LDOM_Node alive
28 // before all LDOMString's (LDOM_AsciiDoc type) are destroyed.
30 class LDOMString : public LDOMBasicString
33 // ---------- PUBLIC METHODS ----------
35 LDOMString () : myPtrDoc (NULL) {}
38 LDOMString (const LDOMString& anOther)
39 : LDOMBasicString (anOther), myPtrDoc (anOther.myPtrDoc) {}
42 LDOMString (const Standard_Integer aValue)
43 : LDOMBasicString (aValue), myPtrDoc (NULL) {}
44 // Integer => LDOMString
46 // Standard_EXPORT LDOMString (const Standard_Real aValue);
48 LDOMString (const char * aValue)
49 : LDOMBasicString (aValue), myPtrDoc (NULL) {}
50 // Create LDOM_AsciiFree
52 const LDOM_MemManager& getOwnerDocument () const
53 { return * myPtrDoc; }
55 LDOMString& operator = (const LDOM_NullPtr * aNull)
56 { LDOMBasicString::operator= (aNull); return *this; }
58 LDOMString& operator = (const LDOMString& anOther)
60 myPtrDoc = anOther.myPtrDoc;
61 LDOMBasicString::operator= (anOther);
66 friend class LDOM_Document;
67 friend class LDOM_Node;
68 friend class LDOM_Element;
69 friend class LDOM_BasicElement;
70 friend class LDOM_BasicAttribute;
71 friend class LDOM_BasicText;
73 static LDOMString CreateDirectString
75 const LDOM_MemManager& aDoc);
77 LDOMString (const LDOMBasicString& anOther,
78 const LDOM_MemManager& aDoc)
79 : LDOMBasicString (anOther), myPtrDoc (&aDoc) {}
80 // Plain copy from LDOMBasicString
82 LDOMString (const LDOMBasicString& anOther,
83 const Handle(LDOM_MemManager)& aDoc);
84 // Copy from another string with allocation in the document space
87 // ---------- PRIVATE FIELDS -------------
88 const LDOM_MemManager * myPtrDoc;