-/*\r
- * Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * Namespace.cpp\r
- * \r
- * Representing XML namespace attributes \r
- */\r
-\r
-#include "internal.h"\r
-#include "Namespace.h"\r
-\r
-using namespace xmltooling;\r
-\r
-Namespace::Namespace(const XMLCh* uri, const XMLCh* prefix, bool alwaysDeclare) : m_pinned(alwaysDeclare)\r
-{\r
-#ifndef HAVE_GOOD_STL\r
- m_uri=m_prefix=NULL;\r
-#endif\r
- setNamespaceURI(uri);\r
- setNamespacePrefix(prefix);\r
-}\r
-\r
-Namespace::~Namespace()\r
-{\r
-#ifndef HAVE_GOOD_STL\r
- XMLString::release(&m_uri);\r
- XMLString::release(&m_prefix);\r
-#endif\r
-}\r
-\r
-void Namespace::setNamespacePrefix(const XMLCh* prefix)\r
-{\r
-#ifdef HAVE_GOOD_STL\r
- if (prefix)\r
- m_prefix=prefix;\r
- else\r
- m_prefix.erase();\r
-#else\r
- if (m_prefix)\r
- XMLString::release(&m_prefix);\r
- m_prefix=XMLString::replicate(prefix);\r
-#endif\r
-}\r
-\r
-void Namespace::setNamespaceURI(const XMLCh* uri)\r
-{\r
-#ifdef HAVE_GOOD_STL\r
- if (uri)\r
- m_uri=uri;\r
- else\r
- m_uri.erase();\r
-#else\r
- if (m_uri)\r
- XMLString::release(&m_uri);\r
- m_uri=XMLString::replicate(uri);\r
-#endif\r
-}\r
-\r
-#ifndef HAVE_GOOD_STL\r
-Namespace::Namespace(const Namespace& src)\r
-{\r
- m_uri=XMLString::replicate(src.getNamespaceURI());\r
- m_prefix=XMLString::replicate(src.getNamespacePrefix());\r
- m_pinned=src.getAlwaysDeclare();\r
-}\r
-\r
-Namespace& Namespace::operator=(const Namespace& src)\r
-{\r
- m_uri=XMLString::replicate(src.getNamespaceURI());\r
- m_prefix=XMLString::replicate(src.getNamespacePrefix());\r
- m_pinned=src.getAlwaysDeclare();\r
- return *this;\r
-}\r
-\r
-bool xmltooling::operator==(const Namespace& op1, const Namespace& op2)\r
-{\r
- return (XMLString::equals(op1.getNamespaceURI(),op2.getNamespaceURI()) &&\r
- XMLString::equals(op1.getNamespacePrefix(),op2.getNamespacePrefix()));\r
-}\r
-#endif\r
-\r
-bool xmltooling::operator<(const Namespace& op1, const Namespace& op2)\r
-{\r
- int i=XMLString::compareString(op1.getNamespaceURI(),op2.getNamespaceURI());\r
- if (i<0)\r
- return true;\r
- else if (i==0)\r
- return (XMLString::compareString(op1.getNamespacePrefix(),op2.getNamespacePrefix())<0);\r
- else\r
- return false;\r
-}\r
+/**
+ * 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
+ *
+ * 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.
+ */
+
+#include "internal.h"
+#include "Namespace.h"
+
+using namespace xmltooling;
+
+using xercesc::XMLString;
+
+Namespace::Namespace(const XMLCh* uri, const XMLCh* prefix, bool alwaysDeclare, namespace_usage_t usage)
+ : m_pinned(alwaysDeclare), m_usage(usage)
+{
+ setNamespaceURI(uri);
+ setNamespacePrefix(prefix);
+}
+
+Namespace::~Namespace()
+{
+}
+
+void Namespace::setNamespacePrefix(const XMLCh* prefix)
+{
+ if (prefix)
+ m_prefix=prefix;
+ else
+ m_prefix.erase();
+}
+
+void Namespace::setNamespaceURI(const XMLCh* uri)
+{
+ if (uri)
+ m_uri=uri;
+ else
+ m_uri.erase();
+}
+
+bool xmltooling::operator<(const Namespace& op1, const Namespace& op2)
+{
+ int i=XMLString::compareString(op1.getNamespaceURI(),op2.getNamespaceURI());
+ if (i<0)
+ return true;
+ else if (i==0)
+ return (XMLString::compareString(op1.getNamespacePrefix(),op2.getNamespacePrefix())<0);
+ 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()));
+}