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

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