CPPXT-104 - Add exception handling to integer conversions
[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         const XMLCh* getLang() const;
58     
59      protected:
60         AbstractAttributeExtensibleXMLObject();
61
62         /** Copy constructor. */
63         AbstractAttributeExtensibleXMLObject(const AbstractAttributeExtensibleXMLObject& src);
64
65         /**
66          * Assists in the unmarshalling of extension attributes.
67          * 
68          * @param attribute the DOM attribute node being unmarshalled
69          */
70         void unmarshallExtensionAttribute(const xercesc::DOMAttr* attribute);
71
72         /**
73          * Assists in the marshalling of extension attributes.
74          * 
75          * @param domElement    the DOM element against which to marshall the attributes
76          */
77         void marshallExtensionAttributes(xercesc::DOMElement* domElement) const;
78     
79     private:
80         /** Map of arbitrary attributes. */
81         std::map<QName,XMLCh*> m_attributeMap;
82         
83         /** Points to the last attribute designated as an XML ID. */
84         std::map<QName,XMLCh*>::const_iterator m_idAttribute;
85     };
86     
87 };
88
89 #if defined (_MSC_VER)
90     #pragma warning( pop )
91 #endif
92
93 #endif /* __xmltooling_absattrextxmlobj_h__ */