2 * Copyright 2001-2006 Internet2
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
20 * Representing XML namespace attributes
\r
23 #if !defined(__xmltooling_namespace_h__)
\r
24 #define __xmltooling_namespace_h__
\r
27 #include <xmltooling/Namespace.h>
\r
29 namespace xmltooling {
\r
32 * A data structure for encapsulating XML Namespace attributes
\r
34 class XMLTOOL_API Namespace
\r
38 * Default constructor
\r
43 * Constructor that takes an existing declaration
\r
44 * @param uri namespace URI
\r
45 * @param prefix namespace prefix (without the colon)
\r
47 Namespace(const XMLCh* uri, const XMLCh* prefix);
\r
50 #ifndef HAVE_GOOD_STL
\r
52 * Deep copy constructor
\r
54 Namespace(const Namespace&);
\r
57 * Deep assignment operator
\r
59 Namespace& operator=(const Namespace&);
\r
62 #ifdef HAVE_GOOD_STL
\r
64 * Returns the namespace prefix
\r
65 * @return Null-terminated Unicode string containing the prefix, without the colon
\r
67 const XMLCh* getNamespacePrefix() const { return m_prefix.c_str(); }
\r
70 * Returns the namespace URI
\r
71 * @return Null-terminated Unicode string containing the URI
\r
73 const XMLCh* getNamespaceURI() const { return m_uri.c_str(); }
\r
76 * Returns the namespace prefix
\r
77 * @return Null-terminated Unicode string containing the prefix, without the colon
\r
79 const XMLCh* getNamespacePrefix() const { return m_prefix; }
\r
82 * Returns the namespace URI
\r
83 * @return Null-terminated Unicode string containing the URI
\r
85 const XMLCh* getNamespaceURI() const { return m_uri; }
\r
89 * Sets the namespace prefix
\r
90 * @param prefix Null-terminated Unicode string containing the prefix, without the colon
\r
92 void setNamespacePrefix(const XMLCh* prefix);
\r
95 * Sets the namespace URI
\r
96 * @param uri Null-terminated Unicode string containing the URI
\r
98 void setNamespaceURI(const XMLCh* uri);
\r
101 #ifdef HAVE_GOOD_STL
\r
111 * Returns true iff op1's namespace lexically compares less than op2's namespace,
\r
112 * or if equal, iff op1's prefix lexically compares less than op2's prefix.
\r
114 * Needed for use with sorted STL containers.
\r
116 * @param op1 First namspace to compare
\r
117 * @param op2 Second namespace to compare
\r
119 extern XMLTOOL_API bool operator<(const Namespace& op1, const Namespace& op2);
\r
121 #ifndef HAVE_GOOD_STL
\r
123 * Returns true iff op1's namespace and prefix are equal to op2's namespace and prefix.
\r
124 * @param op1 First namspace to compare
\r
125 * @param op2 Second namespace to compare
\r
127 extern XMLTOOL_API bool operator==(const Namespace& op1, const Namespace& op2);
\r
132 #endif /* __xmltooling_namespace_h__ */
\r