More boostisms
[shibboleth/cpp-xmltooling.git] / xmltooling / AbstractAttributeExtensibleXMLObject.h
1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */
20
21 /**
22  * @file xmltooling/AbstractAttributeExtensibleXMLObject.h
23  * 
24  * AbstractXMLObject mixin that implements AttributeExtensibleXMLObject
25  */
26
27 #ifndef __xmltooling_absattrextxmlobj_h__
28 #define __xmltooling_absattrextxmlobj_h__
29
30 #include <xmltooling/AbstractXMLObject.h>
31 #include <xmltooling/AttributeExtensibleXMLObject.h>
32
33 #include <map>
34
35 #if defined (_MSC_VER)
36     #pragma warning( push )
37     #pragma warning( disable : 4250 4251 )
38 #endif
39
40 namespace xmltooling {
41
42     /**
43      * AbstractXMLObject mixin that implements AttributeExtensibleXMLObject.
44      * Inherit from this class to add support for attribute wildcarding.
45      */
46     class XMLTOOL_API AbstractAttributeExtensibleXMLObject
47         : public virtual AttributeExtensibleXMLObject, public virtual AbstractXMLObject
48     {
49     public:
50         virtual ~AbstractAttributeExtensibleXMLObject();
51         
52         // Virtual function overrides.
53         const XMLCh* getAttribute(const QName& qualifiedName) const;
54         void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false);
55         const std::map<QName,XMLCh*>& getExtensionAttributes() const;
56         const XMLCh* getXMLID() const;
57     
58      protected:
59         AbstractAttributeExtensibleXMLObject();
60
61         /** Copy constructor. */
62         AbstractAttributeExtensibleXMLObject(const AbstractAttributeExtensibleXMLObject& src);
63
64         /**
65          * Assists in the unmarshalling of extension attributes.
66          * 
67          * @param attribute the DOM attribute node being unmarshalled
68          */
69         void unmarshallExtensionAttribute(const xercesc::DOMAttr* attribute);
70
71         /**
72          * Assists in the marshalling of extension attributes.
73          * 
74          * @param domElement    the DOM element against which to marshall the attributes
75          */
76         void marshallExtensionAttributes(xercesc::DOMElement* domElement) const;
77     
78     private:
79         /** Map of arbitrary attributes. */
80         std::map<QName,XMLCh*> m_attributeMap;
81         
82         /** Points to the last attribute designated as an XML ID. */
83         std::map<QName,XMLCh*>::const_iterator m_idAttribute;
84     };
85     
86 };
87
88 #if defined (_MSC_VER)
89     #pragma warning( pop )
90 #endif
91
92 #endif /* __xmltooling_absattrextxmlobj_h__ */