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 #include "internal.h"
\r
24 #include "Namespace.h"
\r
26 using namespace xmltooling;
\r
28 Namespace::Namespace(const XMLCh* uri, const XMLCh* prefix)
\r
30 #ifndef HAVE_GOOD_STL
\r
31 m_uri=m_prefix=NULL;
\r
33 setNamespaceURI(uri);
\r
34 setNamespacePrefix(prefix);
\r
37 Namespace::~Namespace()
\r
39 #ifndef HAVE_GOOD_STL
\r
40 XMLString::release(&m_uri);
\r
41 XMLString::release(&m_prefix);
\r
45 void Namespace::setNamespacePrefix(const XMLCh* prefix)
\r
47 #ifdef HAVE_GOOD_STL
\r
54 XMLString::release(&m_prefix);
\r
55 m_prefix=XMLString::replicate(prefix);
\r
59 void Namespace::setNamespaceURI(const XMLCh* uri)
\r
61 #ifdef HAVE_GOOD_STL
\r
68 XMLString::release(&m_uri);
\r
69 m_uri=XMLString::replicate(uri);
\r
73 #ifndef HAVE_GOOD_STL
\r
74 Namespace::Namespace(const Namespace& src)
\r
76 m_uri=XMLString::replicate(src.getNamespaceURI());
\r
77 m_prefix=XMLString::replicate(src.getNamespacePrefix());
\r
80 Namespace& Namespace::operator=(const Namespace& src)
\r
82 m_uri=XMLString::replicate(src.getNamespaceURI());
\r
83 m_prefix=XMLString::replicate(src.getNamespacePrefix());
\r
87 bool xmltooling::operator==(const Namespace& op1, const Namespace& op2)
\r
89 return (!XMLString::compareString(op1.getNamespaceURI(),op2.getNamespaceURI()) &&
\r
90 !XMLString::compareString(op1.getNamespacePrefix(),op2.getNamespacePrefix()));
\r
94 bool xmltooling::operator<(const Namespace& op1, const Namespace& op2)
\r
96 int i=XMLString::compareString(op1.getNamespaceURI(),op2.getNamespaceURI());
\r
100 return (XMLString::compareString(op1.getNamespacePrefix(),op2.getNamespacePrefix())<0);
\r