0024512: clang++ compiler complains about extra semicolon
[occt.git] / src / LDOM / LDOMString.hxx
CommitLineData
b311480e 1// Created on: 2001-06-25
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//
973c2be1 7// This library is free software; you can redistribute it and / or modify it
8// under the terms of the GNU Lesser General Public 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
16#ifndef LDOMString_HeaderFile
17#define LDOMString_HeaderFile
18
19#include <LDOMBasicString.hxx>
20#include <Handle_LDOM_MemManager.hxx>
21
22// Class LDOMString
23// Represents various object types which can be mapped to XML strings
7fd59977 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.
28
29class LDOMString : public LDOMBasicString
30{
31 public:
32 // ---------- PUBLIC METHODS ----------
33
34 LDOMString () : myPtrDoc (NULL) {}
35 // Empty constructor
36
37 LDOMString (const LDOMString& anOther)
38 : LDOMBasicString (anOther), myPtrDoc (anOther.myPtrDoc) {}
39 // Copy constructor
40
41 LDOMString (const Standard_Integer aValue)
42 : LDOMBasicString (aValue), myPtrDoc (NULL) {}
43 // Integer => LDOMString
44
45// Standard_EXPORT LDOMString (const Standard_Real aValue);
46
47 LDOMString (const char * aValue)
48 : LDOMBasicString (aValue), myPtrDoc (NULL) {}
49 // Create LDOM_AsciiFree
50
51 const LDOM_MemManager& getOwnerDocument () const
52 { return * myPtrDoc; }
53
54 LDOMString& operator = (const LDOM_NullPtr * aNull)
55 { LDOMBasicString::operator= (aNull); return *this; }
56
57 LDOMString& operator = (const LDOMString& anOther)
58 {
59 myPtrDoc = anOther.myPtrDoc;
60 LDOMBasicString::operator= (anOther);
61 return * this;
62 }
63
64 private:
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;
71
72 static LDOMString CreateDirectString
73 (const char * aValue,
74 const LDOM_MemManager& aDoc);
75
76 LDOMString (const LDOMBasicString& anOther,
77 const LDOM_MemManager& aDoc)
78 : LDOMBasicString (anOther), myPtrDoc (&aDoc) {}
79 // Plain copy from LDOMBasicString
80
81 LDOMString (const LDOMBasicString& anOther,
82 const Handle(LDOM_MemManager)& aDoc);
83 // Copy from another string with allocation in the document space
84
85 private:
86 // ---------- PRIVATE FIELDS -------------
87 const LDOM_MemManager * myPtrDoc;
88};
89
90#endif