0024095: Eliminate compiler warning C4512 in MSVC++ with warning level 4
[occt.git] / src / LDOM / LDOMString.hxx
CommitLineData
b311480e 1// Created on: 2001-06-25
2// Created by: Alexander GRIGORIEV
3// Copyright (c) 2001-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20
21
22#ifndef LDOMString_HeaderFile
23#define LDOMString_HeaderFile
24
25#include <LDOMBasicString.hxx>
26#include <Handle_LDOM_MemManager.hxx>
27
28// Class LDOMString
29// Represents various object types which can be mapped to XML strings
7fd59977 30// LDOMString is not an independent type: you must be sure that the owner
31// LDOM_Document is never lost during the lifetime of its LDOMStrings - for
32// that it is necessary to keep at least one LDOM_Document or LDOM_Node alive
33// before all LDOMString's (LDOM_AsciiDoc type) are destroyed.
34
35class LDOMString : public LDOMBasicString
36{
37 public:
38 // ---------- PUBLIC METHODS ----------
39
40 LDOMString () : myPtrDoc (NULL) {}
41 // Empty constructor
42
43 LDOMString (const LDOMString& anOther)
44 : LDOMBasicString (anOther), myPtrDoc (anOther.myPtrDoc) {}
45 // Copy constructor
46
47 LDOMString (const Standard_Integer aValue)
48 : LDOMBasicString (aValue), myPtrDoc (NULL) {}
49 // Integer => LDOMString
50
51// Standard_EXPORT LDOMString (const Standard_Real aValue);
52
53 LDOMString (const char * aValue)
54 : LDOMBasicString (aValue), myPtrDoc (NULL) {}
55 // Create LDOM_AsciiFree
56
57 const LDOM_MemManager& getOwnerDocument () const
58 { return * myPtrDoc; }
59
60 LDOMString& operator = (const LDOM_NullPtr * aNull)
61 { LDOMBasicString::operator= (aNull); return *this; }
62
63 LDOMString& operator = (const LDOMString& anOther)
64 {
65 myPtrDoc = anOther.myPtrDoc;
66 LDOMBasicString::operator= (anOther);
67 return * this;
68 }
69
70 private:
71 friend class LDOM_Document;
72 friend class LDOM_Node;
73 friend class LDOM_Element;
74 friend class LDOM_BasicElement;
75 friend class LDOM_BasicAttribute;
76 friend class LDOM_BasicText;
77
78 static LDOMString CreateDirectString
79 (const char * aValue,
80 const LDOM_MemManager& aDoc);
81
82 LDOMString (const LDOMBasicString& anOther,
83 const LDOM_MemManager& aDoc)
84 : LDOMBasicString (anOther), myPtrDoc (&aDoc) {}
85 // Plain copy from LDOMBasicString
86
87 LDOMString (const LDOMBasicString& anOther,
88 const Handle(LDOM_MemManager)& aDoc);
89 // Copy from another string with allocation in the document space
90
91 private:
92 // ---------- PRIVATE FIELDS -------------
93 const LDOM_MemManager * myPtrDoc;
94};
95
96#endif