Xalan-C++ API Reference  1.12.0
XalanQNameByValue.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(XALANQNAMEBYVALUE_HEADER_GUARD_1357924680)
19 #define XALANQNAMEBYVALUE_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base header file. Must be first.
25 
26 
27 
28 // Base class header file...
30 
31 
32 
33 namespace XERCES_CPP_NAMESPACE
34 {
35  class Locator;
36 }
37 
38 
39 
40 namespace XALAN_CPP_NAMESPACE {
41 
42 
43 
44 class DOMSupport;
45 class ProblemListenerBase;
46 
47 
48 
50 {
51 public:
52 
53  typedef xercesc::Locator LocatorType;
54 
55  /**
56  * Construct an empty XalanQNameByValue.
57  */
58  explicit
59  XalanQNameByValue(MemoryManager& theManager);
60 
61  MemoryManager&
63  {
64  return m_namespace.getMemoryManager();
65  }
66 
67  /**
68  * Copy constructor.
69  *
70  * @param theSource The source of the copy.
71  */
73  const XalanQNameByValue& theSource,
74  MemoryManager& theManager);
75 
76  /**
77  * Construct an instance from another XalanQName.
78  *
79  * @param theSource The source of the copy.
80  */
81  explicit
83  const XalanQName& theSource,
84  MemoryManager& theManager);
85 
86  /**
87  * Construct a XalanQNameByValue, with the supplied namespace and local part.
88  *
89  * @param theNamespace namespace string
90  * @param theLocalPart local part string
91  */
93  const XalanDOMString& theNamespace,
94  const XalanDOMString& theLocalPart,
95  MemoryManager& theManager);
96 
97  static XalanQNameByValue*
98  create(
99  const XalanDOMString& theNamespace,
100  const XalanDOMString& theLocalPart,
101  MemoryManager& theManager);
102 
103  /**
104  * Construct a XalanQNameByValue from a string, resolving the prefix using the given
105  * namespace vector stack.
106  *
107  * @param qname QName string
108  * @param namespaces namespace vector stack to use
109  * @param locator The Locator instance for error reporting, if any
110  * @param fUseDefault If true, then elements with no prefix will have the default namespace URI, if there is one.
111  */
113  const XalanDOMString& qname,
114  const NamespacesStackType& namespaces,
115  MemoryManager& theManager,
116  const Locator* locator = 0,
117  bool fUseDefault = false);
118 
119  /**
120  * Construct a XalanQNameByValue from a string, resolving the prefix using the given
121  * namespace vector stack.
122  *
123  * @param qname QName string
124  * @param namespaces namespace vector stack to use
125  * @param locator The Locator instance for error reporting, if any
126  * @param fUseDefault If true, then elements with no prefix will have the default namespace URI, if there is one.
127  */
129  const XalanDOMChar* qname,
130  const NamespacesStackType& namespaces,
131  MemoryManager& theManager,
132  const Locator* locator = 0,
133  bool fUseDefault = false);
134 
135  /**
136  * Construct a XalanQNameByValue from a string, resolving the prefix using the given
137  * prefix resolver. The default namespace is not resolved.
138  *
139  * @param qname QName string
140  * @param theResolver prefix resolver to use
141  * @param locator The Locator instance for error reporting, if any
142  */
144  const XalanDOMString& qname,
145  MemoryManager& theManager,
146  const PrefixResolver* theResolver = 0,
147  const Locator* locator = 0);
148 
149  virtual
151 
152  /**
153  * Retrieve the local part of qualified name.
154  *
155  * @return local part string
156  */
157  virtual const XalanDOMString&
158  getLocalPart() const;
159 
160  /**
161  * Set the local part of qualified name.
162  *
163  * @param theLocalPart local part string
164  */
165  void
166  setLocalPart(const XalanDOMString& theLocalPart)
167  {
168  m_localpart = theLocalPart;
169  }
170 
171  /**
172  * Retrieve the namespace of qualified name.
173  *
174  * @return namespace string
175  */
176  virtual const XalanDOMString&
177  getNamespace() const;
178 
179  /**
180  * Set the Namespace URI of qualified name.
181  *
182  * @param theLocalPart local part string
183  */
184  void
185  setNamespace(const XalanDOMString& theNamespace)
186  {
187  m_namespace = theNamespace;
188  }
189 
190  /**
191  * Set the local part and namespace URI of a XalanQNameByValue from
192  * a string, resolving the prefix using the given namespace vector
193  * stack.
194  *
195  * @param qname QName string
196  * @param namespaces namespace vector stack to use
197  * @param locator The Locator instance for error reporting, if any
198  * @param fUseDefault If true, then elements with no prefix will have the default namespace URI, if there is one.
199  */
200  void
201  set(
202  const XalanDOMString& qname,
203  const NamespacesStackType& namespaces,
204  const Locator* locator = 0,
205  bool fUseDefault = false);
206 
207  /**
208  * Set the local part and namespace URI of a XalanQNameByValue from
209  * a string, resolving the prefix using the given namespace vector
210  * stack.
211  *
212  * @param qname QName string
213  * @param namespaces namespace vector stack to use
214  * @param locator The Locator instance for error reporting, if any
215  * @param fUseDefault If true, then elements with no prefix will have the default namespace URI, if there is one.
216  */
217  void
218  set(
219  const XalanDOMChar* qname,
220  const NamespacesStackType& namespaces,
221  const Locator* locator = 0,
222  bool fUseDefault = false);
223 
224  /**
225  * Set the local part and namespace URI of a XalanQNameByValue from
226  * a string, resolving the prefix using the resolver provided. The
227  * default namespace is not resolved.
228  *
229  * @param qname QName string
230  * @param theResolver prefix resolver to use
231  * @param locator The Locator instance for error reporting, if any
232  */
233  void
234  set(
235  const XalanDOMString& qname,
236  const PrefixResolver* theResolver = 0,
237  const Locator* locator = 0);
238 
239  /**
240  * Set the local part and namespace URI of a XalanQNameByValue from
241  * a string, resolving the prefix using the resolver provided. The
242  * default namespace is not resolved.
243  *
244  * @param qname QName string
245  * @param theResolver prefix resolver to use
246  * @param locator The Locator instance for error reporting, if any
247  */
248  void
249  set(
250  const XalanDOMChar* qname,
251  const PrefixResolver* theResolver = 0,
252  const Locator* locator = 0);
253  /**
254  * Clear the instance.
255  */
256  void
258  {
259  m_namespace.clear();
260  m_localpart.clear();
261  }
262 
265  {
266  m_namespace = theRHS.m_namespace;
267  m_localpart = theRHS.m_localpart;
268 
269  return *this;
270  }
271 
273  operator=(const XalanQName& theRHS)
274  {
275  m_namespace = theRHS.getNamespace();
276  m_localpart = theRHS.getLocalPart();
277 
278  return *this;
279  }
280 
281 private:
282  // not implemented
283  XalanQNameByValue(const XalanQNameByValue& theSource);
284  void
285  initialize(
286  const XalanDOMChar* qname,
288  const NamespacesStackType& namespaces,
289  const Locator* locator,
290  bool fUseDefault);
291 
292  void
293  resolvePrefix(
294  const XalanDOMChar* qname,
295  XalanDOMString::size_type theLength,
296  const PrefixResolver* theResolver,
297  const Locator* locator);
298 
299  void
300  validate(
301  const XalanDOMChar* qname,
302  XalanDOMString::size_type theLength,
303  const Locator* locator);
304 
305  // Data members...
306  XalanDOMString m_namespace;
307 
308  XalanDOMString m_localpart;
309 };
310 
311 XALAN_USES_MEMORY_MANAGER(XalanQNameByValue)
312 
313 
314 template<>
316 {
317 };
318 
319 
320 
321 }
322 
323 
324 
325 #endif // XALANQNAMEBYVALUE_HEADER_GUARD_1357924680
xalanc::XalanQNameByValue::operator=
XalanQNameByValue & operator=(const XalanQNameByValue &theRHS)
Definition: XalanQNameByValue.hpp:264
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanQNameByValue::clear
void clear()
Clear the instance.
Definition: XalanQNameByValue.hpp:257
xalanc::XalanQNameByValue::LocatorType
xercesc::Locator LocatorType
Definition: XalanQNameByValue.hpp:53
xalanc::XalanQNameByValue::setNamespace
void setNamespace(const XalanDOMString &theNamespace)
Set the Namespace URI of qualified name.
Definition: XalanQNameByValue.hpp:185
XALAN_USES_MEMORY_MANAGER
#define XALAN_USES_MEMORY_MANAGER(Type)
Definition: XalanMemoryManagement.hpp:589
xalanc::XalanQName::getLocalPart
virtual const XalanDOMString & getLocalPart() const =0
Retrieve the local part of qualified name.
XALAN_XPATH_EXPORT
#define XALAN_XPATH_EXPORT
Definition: XPathDefinitions.hpp:35
XalanQName.hpp
xalanc::XalanQNameByValue::getMemoryManager
MemoryManager & getMemoryManager()
Definition: XalanQNameByValue.hpp:62
xalanc::XalanQNameByValue
Definition: XalanQNameByValue.hpp:49
xalanc::XalanQNameByValue::operator=
XalanQNameByValue & operator=(const XalanQName &theRHS)
Definition: XalanQNameByValue.hpp:273
xalanc::PrefixResolver
This class defines an interface for classes that resolve namespace prefixes to their URIs.
Definition: PrefixResolver.hpp:39
xalanc::XalanQName::getNamespace
virtual const XalanDOMString & getNamespace() const =0
Retrieve the namespace of qualified name.
xalanc::XalanMapKeyTraits
Definition: XalanMap.hpp:68
xalanc::XalanQNameByValue::setLocalPart
void setLocalPart(const XalanDOMString &theLocalPart)
Set the local part of qualified name.
Definition: XalanQNameByValue.hpp:166
xalanc::XalanQName
Class to represent a qualified name.
Definition: XalanQName.hpp:70
xalanc::XalanDOMString::size_type
XalanSize_t size_type
Definition: XalanDOMString.hpp:57
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
XPathDefinitions.hpp