Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XalanQName.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(XALANQNAME_HEADER_GUARD_1357924680)
17 #define XALANQNAME_HEADER_GUARD_1357924680
18 
19 
20 
21 // Base header file. Must be first.
23 
24 
25 
29 
30 
31 
33 
34 
35 
39 
40 
41 
43 
44 
45 
46 XALAN_CPP_NAMESPACE_BEGIN
47 
48 
49 
50 class XalanElement;
51 class XPathEnvSupport;
52 
53 
54 
69 {
70 public:
71 
76 
81  explicit
83  {
84  }
85 
86  virtual
88  {
89  }
90 
96  virtual const XalanDOMString&
97  getLocalPart() const = 0;
98 
104  virtual const XalanDOMString&
105  getNamespace() const = 0;
106 
112  bool
113  isValid() const
114  {
115  return isValidNCName(getLocalPart());
116  }
117 
123  bool
124  isEmpty() const
125  {
126  return getNamespace().empty() && getLocalPart().empty();
127  }
128 
136  bool
137  equals(const XalanQName& theRHS) const
138  {
139  // Note that we do not use our member variables here. See
140  // class QNameReference for details...
141  return getLocalPart() == theRHS.getLocalPart() &&
142  getNamespace() == theRHS.getNamespace();
143  }
144 
146  hash() const
147  {
148  return getLocalPart().hash() % (getNamespace().hash() + 1);
149  }
150 
152  {
153  public:
154 
164  const NamespacesStackType& theStack,
165  const XalanDOMString& theURI);
166 
167  virtual
169 
170  virtual const XalanDOMString*
171  getNamespaceForPrefix(const XalanDOMString& prefix) const;
172 
173  virtual const XalanDOMString&
174  getURI() const;
175 
176  private:
177 
178  const NamespacesStackType& m_stack;
179 
180  const XalanDOMString& m_uri;
181  };
182 
190  static const XalanDOMString*
192  const NamespaceVectorType& namespaces,
193  const XalanDOMString& prefix);
194 
203  static const XalanDOMString*
205  const NamespacesStackType& nsStack,
206  const XalanDOMString& prefix);
207 
208  static const XalanDOMString*
210  const NamespacesStackType& nsStack,
211  const XalanDOMChar* prefix);
212 
223  static const XalanDOMString*
227  const XalanDOMString& prefix);
228 
237  static const XalanDOMString*
238  getPrefixForNamespace(
239  const NamespaceVectorType& namespaces,
240  const XalanDOMString& uri);
241 
242  static const XalanDOMString*
244  const NamespaceVectorType& namespaces,
245  const XalanDOMChar* prefix);
246 
255  static const XalanDOMString*
256  getPrefixForNamespace(
257  const NamespacesStackType& nsStack,
258  const XalanDOMString& uri);
259 
270  static const XalanDOMString*
271  getPrefixForNamespace(
274  const XalanDOMString& uri);
275 
276  static const XalanDOMString*
280  const XalanDOMChar* prefix);
288  static bool
289  isValidNCName(const XalanDOMString& theNCName);
290 
299  static bool
300  isValidNCName(
301  const XalanDOMChar* theNCName,
303 
312  static bool
313  isValidQName(const XalanDOMString& theQName);
314 
324  static bool
325  isValidQName(
326  const XalanDOMChar* theQName,
328 
330  {
331  public:
332 
344  const XalanDOMChar* theQName,
345  XalanDOMString::size_type theQNameLength,
346  const XalanDOMString& theURI,
347  int theLineNumber,
348  int theColumnNumber,
349  XalanDOMString& theResult);
350 
360  const LocatorType& theLocator,
361  const XalanDOMChar* theQName,
362  XalanDOMString::size_type theQNameLength,
363  XalanDOMString& theResult);
364 
373  const XalanDOMChar* theQName,
374  XalanDOMString::size_type theQNameLength,
375  XalanDOMString& theResult);
376 
377  virtual
379 
380  virtual const XalanDOMChar*
381  getType() const
382  {
383  return m_type;
384  }
385 
386  private:
387 
388  static const XalanDOMChar m_type[];
389 
390  static const XalanDOMString&
391  format(
392  const XalanDOMChar* theQName,
393  XalanDOMString::size_type theQNameLength,
394  XalanDOMString& theResult);
395  };
396 
397 protected:
398 
400 };
401 
402 
403 inline bool
405  const XalanQName& theLHS,
406  const XalanQName& theRHS)
407 {
408  return theLHS.equals(theRHS);
409 }
410 
411 
412 
413 inline bool
415  const XalanQName& theLHS,
416  const XalanQName& theRHS)
417 {
418  return !(theLHS == theRHS);
419 }
420 
421 
422 
423 inline bool
425  const XalanQName& theLHS,
426  const XalanQName& theRHS)
427 {
428  if (theLHS.getNamespace() < theRHS.getNamespace())
429  {
430  return true;
431  }
432  else if (equals(theLHS.getNamespace(), theRHS.getNamespace()))
433  {
434  return theLHS.getLocalPart() < theRHS.getLocalPart();
435  }
436  else
437  {
438  return false;
439  }
440 }
441 
442 template<>
444 {
446  typedef XALAN_STD_QUALIFIER equal_to<XalanQName> Comparator;
447 };
448 
449 template<>
451 {
454 };
455 
456 
457 XALAN_CPP_NAMESPACE_END
458 
459 
460 
461 #endif // XALANQNAME_HEADER_GUARD_1357924680
Definition: STLHelper.hpp:628
XalanQName()
Construct an empty XalanQName.
Definition: XalanQName.hpp:82
Definition: XSLException.hpp:39
XALAN_STD_QUALIFIER equal_to< XalanQName > Comparator
Definition: XalanQName.hpp:446
Definition: XalanElement.hpp:42
Definition: XalanMap.hpp:66
XalanDOMString::size_type hash() const
Definition: XalanQName.hpp:146
Definition: XalanQName.hpp:329
XalanDeque< NameSpace, ConstructWithMemoryManagerTraits< NameSpace > > NamespaceVectorType
Definition: XalanQName.hpp:73
virtual const XalanDOMString & getNamespace() const =0
Retrieve the namespace of qualified name.
bool isValid() const
Determine if the qualified name is valid.
Definition: XalanQName.hpp:113
virtual const XalanDOMString & getURI() const =0
Retrieve the base URI for the resolver.
virtual const XalanDOMChar * getType() const
Retrieve type of exception.
Definition: XalanQName.hpp:381
bool operator<(const XalanQName &theLHS, const XalanQName &theRHS)
Definition: XalanQName.hpp:424
XalanHashMemberReference< XalanQName > Hasher
Definition: XalanQName.hpp:445
Definition: XPathEnvSupport.hpp:62
bool operator!=(const XalanQName &theLHS, const XalanQName &theRHS)
Definition: XalanQName.hpp:414
static const XalanDOMString s_emptyString
Definition: XalanQName.hpp:399
This class defines an interface for classes that resolve namespace prefixes to their URIs...
Definition: PrefixResolver.hpp:37
XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType
Definition: FormatterListener.hpp:47
Definition: XalanMap.hpp:85
pointer_equal< XalanQName > Comparator
Definition: XalanQName.hpp:453
Definition: XalanMap.hpp:74
XalanDeque< NamespaceVectorType, ConstructWithMemoryManagerTraits< NamespaceVectorType > > NamespacesStackType
Definition: XalanQName.hpp:75
Definition: XalanDOMString.hpp:42
virtual const XalanDOMString & getLocalPart() const =0
Retrieve the local part of qualified name.
Definition: XalanQName.hpp:151
bool equals(const XalanQName &theRHS) const
Override equals and agree that we're equal if the passed object is a string and it matches the name o...
Definition: XalanQName.hpp:137
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const =0
Retrieve a namespace corresponding to a prefix.
bool operator==(const XalanQName &theLHS, const XalanQName &theRHS)
Definition: XalanQName.hpp:404
unsigned int size_type
Definition: XalanDOMString.hpp:53
#define XALAN_XPATH_EXPORT
Definition: XPathDefinitions.hpp:33
equals(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, XalanDOMString::size_type theLength)
Compare the contents of two arrays for equality.
bool isEmpty() const
Whether the qualified name is empty.
Definition: XalanQName.hpp:124
Class to represent a qualified name: "The name of an internal XSLT object, specifically a named templ...
Definition: XalanQName.hpp:68
XalanHashMemberPointer< XalanQName > Hasher
Definition: XalanQName.hpp:452
Xalan implementation of deque.
Definition: XalanDeque.hpp:160
virtual ~XalanQName()
Definition: XalanQName.hpp:87
Definition: XalanDOMString.hpp:63
Definition: XalanDeque.hpp:59

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo