VS10 solution files, convert from NULL macro to nullptr.
[shibboleth/sp.git] / shibsp / util / DOMPropertySet.h
1 /*
2  *  Copyright 2001-2010 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file shibsp/util/DOMPropertySet.h
19  * 
20  * DOM-based property set implementation.
21  */
22
23 #ifndef __shibsp_dompropset_h__
24 #define __shibsp_dompropset_h__
25
26 #include <shibsp/util/PropertySet.h>
27
28 #include <xmltooling/logging.h>
29
30 namespace shibsp {
31
32     /**
33      * DOM-based property set implementation.
34      */
35     class SHIBSP_API DOMPropertySet : public virtual PropertySet
36     {
37     public:
38         DOMPropertySet();
39         
40         virtual ~DOMPropertySet();
41
42         const PropertySet* getParent() const;
43         void setParent(const PropertySet* parent);
44         std::pair<bool,bool> getBool(const char* name, const char* ns=nullptr) const;
45         std::pair<bool,const char*> getString(const char* name, const char* ns=nullptr) const;
46         std::pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=nullptr) const;
47         std::pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=nullptr) const;
48         std::pair<bool,int> getInt(const char* name, const char* ns=nullptr) const;
49         void getAll(std::map<std::string,const char*>& properties) const;
50         const PropertySet* getPropertySet(const char* name, const char* ns=shibspconstants::ASCII_SHIB2SPCONFIG_NS) const;
51         const xercesc::DOMElement* getElement() const;
52
53         /**
54          * Loads the property set from a DOM element.
55          * 
56          * @param e         root element of property set
57          * @param log       optional log object for tracing
58          * @param filter    optional filter controls what child elements to include as nested PropertySets
59          * @param remapper  optional map of property rename rules for legacy property support
60          */
61         void load(
62             const xercesc::DOMElement* e,
63             xmltooling::logging::Category* log=nullptr,
64             xercesc::DOMNodeFilter* filter=nullptr,
65             const std::map<std::string,std::string>* remapper=nullptr
66             );
67
68     private:
69         const PropertySet* m_parent;
70         const xercesc::DOMElement* m_root;
71         std::map<std::string,std::pair<char*,const XMLCh*> > m_map;
72         std::map<std::string,DOMPropertySet*> m_nested;
73     };
74
75 };
76
77 #endif /* __shibsp_dompropset_h__ */