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 
32 namespace XALAN_CPP_NAMESPACE {
33 
34 
35 
37 {
38 public:
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  */
55  const XalanDOMString& thePrefix,
56  const XalanDOMString& theURI,
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
92  setPrefix(const XalanDOMString& thePrefix)
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
114  setURI(const XalanDOMString& theURI)
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
125  setURI(const XalanDOMChar* theURI)
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
168  operator==(const XalanNamespace& theRHS) const
169  {
170  return equals(m_prefix, theRHS.m_prefix) &&
171  equals(m_uri, theRHS.m_uri);
172  }
173 
174 private:
175  //Not implemented
176  XalanNamespace();
178 
179  XalanDOMString m_prefix;
180 
181  XalanDOMString m_uri;
182 };
183 
184 XALAN_USES_MEMORY_MANAGER(XalanNamespace)
185 
186 }
187 
188 
189 
190 #endif // ALANNAMESPACE_HEADER_GUARD_1357924680
xalanc::XalanNamespace::getPrefix
const XalanDOMString & getPrefix() const
Retrieve the thePrefix for namespace.
Definition: XalanNamespace.hpp:81
xalanc::XalanNamespace::XalanNamespace
XalanNamespace(const XalanNamespace &other, MemoryManager &theManager)
Definition: XalanNamespace.hpp:63
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanNamespace::XalanNamespace
XalanNamespace(MemoryManager &theManager)
Definition: XalanNamespace.hpp:41
xalanc::XalanNamespace::getURI
const XalanDOMString & getURI() const
Retrieve the URI for namespace.
Definition: XalanNamespace.hpp:103
XALAN_USES_MEMORY_MANAGER
#define XALAN_USES_MEMORY_MANAGER(Type)
Definition: XalanMemoryManagement.hpp:589
xalanc::XalanNamespace::clear
void clear()
Definition: XalanNamespace.hpp:155
xalanc::equals
equals(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, XalanDOMString::size_type theLength)
Compare the contents of two arrays for equality.
DOMStringHelper.hpp
PlatformSupportDefinitions.hpp
xalanc::XalanNamespace::setURI
void setURI(const XalanDOMChar *theURI)
Set the URI for namespace.
Definition: XalanNamespace.hpp:125
xalanc::XalanNamespace::empty
bool empty() const
Definition: XalanNamespace.hpp:149
xalanc::XalanNamespace
Definition: XalanNamespace.hpp:36
xalanc::XalanNamespace::XalanNamespace
XalanNamespace(const XalanDOMString &thePrefix, const XalanDOMString &theURI, MemoryManager &theManager)
Construct a namespace for placement on the result tree namespace stack.
Definition: XalanNamespace.hpp:54
xalanc::XalanNamespace::~XalanNamespace
~XalanNamespace()
Definition: XalanNamespace.hpp:71
xalanc::XalanNamespace::operator==
bool operator==(const XalanNamespace &theRHS) const
Equality operator.
Definition: XalanNamespace.hpp:168
xalanc::XalanNamespace::setPrefix
void setPrefix(const XalanDOMString &thePrefix)
Set the thePrefix for namespace.
Definition: XalanNamespace.hpp:92
xalanc::XalanDOMString::size_type
XalanSize_t size_type
Definition: XalanDOMString.hpp:57
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
xalanc::XalanNamespace::setURI
void setURI(const XalanDOMString &theURI)
Set the URI for namespace.
Definition: XalanNamespace.hpp:114
xalanc::XalanNamespace::setURI
void setURI(const XalanDOMChar *theURI, XalanDOMString::size_type len)
Set the URI for namespace.
Definition: XalanNamespace.hpp:139