X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2FNamespace.cpp;h=aebb5b6455d2eb813c8b999668f3d7148f39ed52;hb=1b63b1422645ba9fa856a28d31c3f8c238ffff4c;hp=ca3f896c8d890f493512d38b83445888d43730f6;hpb=5cb314df178f78c6fa7b9826c2c5a5298ec7a473;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/Namespace.cpp b/xmltooling/Namespace.cpp index ca3f896..aebb5b6 100644 --- a/xmltooling/Namespace.cpp +++ b/xmltooling/Namespace.cpp @@ -1,23 +1,27 @@ -/* - * Copyright 2001-2007 Internet2 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + * + * UCAID licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the + * License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. */ /** * Namespace.cpp * - * Representing XML namespace attributes + * Representing XML namespace attributes. */ #include "internal.h" @@ -25,73 +29,34 @@ using namespace xmltooling; -Namespace::Namespace(const XMLCh* uri, const XMLCh* prefix, bool alwaysDeclare) : m_pinned(alwaysDeclare) +using xercesc::XMLString; + +Namespace::Namespace(const XMLCh* uri, const XMLCh* prefix, bool alwaysDeclare, namespace_usage_t usage) + : m_pinned(alwaysDeclare), m_usage(usage) { -#ifndef HAVE_GOOD_STL - m_uri=m_prefix=NULL; -#endif setNamespaceURI(uri); setNamespacePrefix(prefix); } Namespace::~Namespace() { -#ifndef HAVE_GOOD_STL - XMLString::release(&m_uri); - XMLString::release(&m_prefix); -#endif } void Namespace::setNamespacePrefix(const XMLCh* prefix) { -#ifdef HAVE_GOOD_STL if (prefix) m_prefix=prefix; else m_prefix.erase(); -#else - if (m_prefix) - XMLString::release(&m_prefix); - m_prefix=XMLString::replicate(prefix); -#endif } void Namespace::setNamespaceURI(const XMLCh* uri) { -#ifdef HAVE_GOOD_STL if (uri) m_uri=uri; else m_uri.erase(); -#else - if (m_uri) - XMLString::release(&m_uri); - m_uri=XMLString::replicate(uri); -#endif -} - -#ifndef HAVE_GOOD_STL -Namespace::Namespace(const Namespace& src) -{ - m_uri=XMLString::replicate(src.getNamespaceURI()); - m_prefix=XMLString::replicate(src.getNamespacePrefix()); - m_pinned=src.alwaysDeclare(); -} - -Namespace& Namespace::operator=(const Namespace& src) -{ - m_uri=XMLString::replicate(src.getNamespaceURI()); - m_prefix=XMLString::replicate(src.getNamespacePrefix()); - m_pinned=src.alwaysDeclare(); - return *this; -} - -bool xmltooling::operator==(const Namespace& op1, const Namespace& op2) -{ - return (XMLString::equals(op1.getNamespaceURI(),op2.getNamespaceURI()) && - XMLString::equals(op1.getNamespacePrefix(),op2.getNamespacePrefix())); } -#endif bool xmltooling::operator<(const Namespace& op1, const Namespace& op2) { @@ -103,3 +68,9 @@ bool xmltooling::operator<(const Namespace& op1, const Namespace& op2) else return false; } + +bool xmltooling::operator==(const Namespace& op1, const Namespace& op2) +{ + return (XMLString::equals(op1.getNamespacePrefix(), op2.getNamespacePrefix()) && + XMLString::equals(op1.getNamespaceURI(), op2.getNamespaceURI())); +}