X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2FAttributeExtensibleXMLObject.h;h=598b3fa487db57b2eba0dbc1694ace2ebb66d14d;hb=221860019da7b734e81171e4167f8f5c0d03285d;hp=8ba087b32130f4fa82fd5bd68c570dbee8deb07a;hpb=c61580d5c20b1af1c8c7e30f8811aae322c30de2;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/AttributeExtensibleXMLObject.h b/xmltooling/AttributeExtensibleXMLObject.h index 8ba087b..598b3fa 100644 --- a/xmltooling/AttributeExtensibleXMLObject.h +++ b/xmltooling/AttributeExtensibleXMLObject.h @@ -1,118 +1,127 @@ -/* - * Copyright 2001-2006 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 - * - * 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. - */ - -/** - * @file AttributeExtensibleXMLObject.h - * - * An XMLObject that supports arbitrary attributes - */ - -#if !defined(__xmltooling_attrextxmlobj_h__) -#define __xmltooling_attrextxmlobj_h__ - -#include - -using namespace xercesc; - -#if defined (_MSC_VER) - #pragma warning( push ) - #pragma warning( disable : 4250 4251 ) -#endif - -namespace xmltooling { - - /** - * An XMLObject that supports arbitrary attributes. - */ - class XMLTOOL_API AttributeExtensibleXMLObject : public virtual XMLObject - { - protected: - AttributeExtensibleXMLObject() {} - - public: - virtual ~AttributeExtensibleXMLObject() {} - - /** - * Gets the value of an XML attribute of the object. - * - * @param qualifiedName qualified name of the attribute - * @return the attribute value, or NULL - */ - virtual const XMLCh* getAttribute(const QName& qualifiedName) const=0; - - /** - * Sets (or clears) an XML attribute of the object. - * - * @param qualifiedName qualified name of the attribute - * @param value value to set, or NULL to clear - * @param ID true iff the attribute is an XML ID - */ - virtual void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false)=0; - - /** - * Gets an immutable map of the extended XML attributes of the object. - * - * This set is not guaranteed to (and generally will not) include - * attributes defined directly on the object's "type". - */ - virtual const std::map& getExtensionAttributes() const=0; - - /** - * Gets an immutable list of all the ID attributes currently registered. - * - * @return list of all the ID attributes currently registered - */ - static const std::set& getRegisteredIDAttributes() { - return m_idAttributeSet; - } - - /** - * Registers a new attribute as being of XML ID type. - * - * @param name the qualified attribute name - */ - static void registerIDAttribute(const QName& name) { - m_idAttributeSet.insert(name); - } - - /** - * Deregisters an ID attribute. - * - * @param name the qualified attribute name - */ - static void deregisterIDAttribute(const QName& name) { - m_idAttributeSet.erase(name); - } - - /** - * Deregisters all ID attributes. - */ - static void deregisterIDAttributes() { - m_idAttributeSet.clear(); - } - - private: - /** Set of attributes to treat as XML IDs. */ - static std::set m_idAttributeSet; - }; - -}; - -#if defined (_MSC_VER) - #pragma warning( pop ) -#endif - -#endif /* __xmltooling_attrextxmlobj_h__ */ +/** + * 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. + */ + +/** + * @file xmltooling/AttributeExtensibleXMLObject.h + * + * An XMLObject that supports arbitrary attributes + */ + +#ifndef __xmltooling_attrextxmlobj_h__ +#define __xmltooling_attrextxmlobj_h__ + +#include + +#if defined (_MSC_VER) + #pragma warning( push ) + #pragma warning( disable : 4250 4251 ) +#endif + +namespace xmltooling { + + /** + * An XMLObject that supports arbitrary attributes. + */ + class XMLTOOL_API AttributeExtensibleXMLObject : public virtual XMLObject + { + protected: + AttributeExtensibleXMLObject(); + + public: + virtual ~AttributeExtensibleXMLObject(); + + /** + * Gets the value of an XML attribute of the object. + * + * @param qualifiedName qualified name of the attribute + * @return the attribute value, or nullptr + */ + virtual const XMLCh* getAttribute(const QName& qualifiedName) const=0; + + /** + * Sets (or clears) an XML attribute of the object. + * + * @param qualifiedName qualified name of the attribute + * @param value value to set, or nullptr to clear + * @param ID true iff the attribute is an XML ID + */ + virtual void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false)=0; + + /** + * Sets a QName-valued XML attribute of the object. + * + * @param qualifiedName qualified name of the attribute + * @param value value to set + */ + virtual void setAttribute(const QName& qualifiedName, const QName& value); + + /** + * Gets an immutable map of the extended XML attributes of the object. + * + * This set is not guaranteed to (and generally will not) include + * attributes defined directly on the object's "type". + */ + virtual const std::map& getExtensionAttributes() const=0; + + /** + * Gets an immutable list of all the ID attributes currently registered. + * + * @return list of all the ID attributes currently registered + */ + static const std::set& getRegisteredIDAttributes(); + + /** + * Tests whether an XML attribute is registered as an XML ID. + * + * @return true iff the attribute name matches a registered XML ID attribute + */ + static bool isRegisteredIDAttribute(const QName& name); + + /** + * Registers a new attribute as being of XML ID type. + * + * @param name the qualified attribute name + */ + static void registerIDAttribute(const QName& name); + + /** + * Deregisters an ID attribute. + * + * @param name the qualified attribute name + */ + static void deregisterIDAttribute(const QName& name); + + /** + * Deregisters all ID attributes. + */ + static void deregisterIDAttributes(); + + private: + /** Set of attributes to treat as XML IDs. */ + static std::set m_idAttributeSet; + }; + +}; + +#if defined (_MSC_VER) + #pragma warning( pop ) +#endif + +#endif /* __xmltooling_attrextxmlobj_h__ */