Xalan-C++ API Reference 1.12.0
XalanNamespace.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(XALANNAMESPACE_HEADER_GUARD_1357924680)
19#define XALANNAMESPACE_HEADER_GUARD_1357924680
20
21
22
23// Base header file. Must be first.
25
26
27
29
30
31
32namespace XALAN_CPP_NAMESPACE {
33
34
35
37{
38public:
39
40 explicit
41 XalanNamespace(MemoryManager& theManager) :
42 m_prefix(theManager),
43 m_uri(theManager)
44 {
45 }
46
47 /**
48 * Construct a namespace for placement on the
49 * result tree namespace stack.
50 *
51 * @param thePrefix namespace thePrefix
52 * @param theURI URI of namespace
53 */
57 MemoryManager& theManager) :
58 m_prefix(thePrefix,theManager),
59 m_uri(theURI, theManager)
60 {
61 }
62
64 const XalanNamespace& other,
65 MemoryManager& theManager) :
66 m_prefix(other.m_prefix,theManager),
67 m_uri(other.m_uri, theManager)
68 {
69 }
70
72 {
73 }
74
75 /**
76 * Retrieve the thePrefix for namespace
77 *
78 * @return thePrefix string
79 */
80 const XalanDOMString&
81 getPrefix() const
82 {
83 return m_prefix;
84 }
85
86 /**
87 * Set the thePrefix for namespace
88 *
89 * @param thePrefix The new thePrefix value
90 */
91 void
93 {
94 m_prefix = thePrefix;
95 }
96
97 /**
98 * Retrieve the URI for namespace
99 *
100 * @return URI string
101 */
102 const XalanDOMString&
103 getURI() const
104 {
105 return m_uri;
106 }
107
108 /**
109 * Set the URI for namespace
110 *
111 * @param theURI The new theURI value
112 */
113 void
115 {
116 m_uri = theURI;
117 }
118
119 /**
120 * Set the URI for namespace
121 *
122 * @param theURI The new theURI value
123 */
124 void
126 {
127 assert(theURI != 0);
128
129 m_uri = theURI;
130 }
131
132 /**
133 * Set the URI for namespace
134 *
135 * @param theURI The new theURI value
136 * @param len The length of the theURI
137 */
138 void
140 const XalanDOMChar* theURI,
142 {
143 assert(theURI != 0);
144
145 m_uri.assign(theURI, len);
146 }
147
148 bool
149 empty() const
150 {
151 return m_prefix.empty() && m_uri.empty();
152 }
153
154 void
156 {
157 m_prefix.clear();
158
159 m_uri.clear();
160 }
161
162 /**
163 * Equality operator
164 *
165 * @param theRHS namespace to compare
166 */
167 bool
169 {
170 return equals(m_prefix, theRHS.m_prefix) &&
171 equals(m_uri, theRHS.m_uri);
172 }
173
174private:
175 //Not implemented
178
179 XalanDOMString m_prefix;
180
181 XalanDOMString m_uri;
182};
183
184XALAN_USES_MEMORY_MANAGER(XalanNamespace)
185
186}
187
188
189
190#endif // ALANNAMESPACE_HEADER_GUARD_1357924680
#define XALAN_USES_MEMORY_MANAGER(Type)
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
void setPrefix(const XalanDOMString &thePrefix)
Set the thePrefix for namespace.
void setURI(const XalanDOMChar *theURI, XalanDOMString::size_type len)
Set the URI for namespace.
XalanNamespace(MemoryManager &theManager)
const XalanDOMString & getURI() const
Retrieve the URI for namespace.
XalanNamespace(const XalanDOMString &thePrefix, const XalanDOMString &theURI, MemoryManager &theManager)
Construct a namespace for placement on the result tree namespace stack.
void setURI(const XalanDOMChar *theURI)
Set the URI for namespace.
bool operator==(const XalanNamespace &theRHS) const
Equality operator.
void setURI(const XalanDOMString &theURI)
Set the URI for namespace.
XalanNamespace(const XalanNamespace &other, MemoryManager &theManager)
const XalanDOMString & getPrefix() const
Retrieve the thePrefix for namespace.
equals(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, XalanDOMString::size_type theLength)
Compare the contents of two arrays for equality.