Imported Upstream version 2.3+dfsg
[shibboleth/sp.git] / shibsp / attribute / XMLAttribute.h
1 /*
2  *  Copyright 2009 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/attribute/XMLAttribute.h
19  *
20  * An Attribute whose values are serialized XML.
21  */
22
23 #ifndef __shibsp_xmlattr_h__
24 #define __shibsp_xmlattr_h__
25
26 #include <shibsp/attribute/Attribute.h>
27
28 namespace shibsp {
29
30     /**
31      * An Attribute whose values are serialized XML.
32      */
33     class SHIBSP_API XMLAttribute : public Attribute
34     {
35     public:
36         /**
37          * Constructor.
38          *
39          * @param ids   array with primary identifier in first position, followed by any aliases
40          */
41         XMLAttribute(const std::vector<std::string>& ids);
42
43         /**
44          * Constructs based on a remoted XMLAttribute.
45          *
46          * @param in    input object containing marshalled XMLAttribute
47          */
48         XMLAttribute(DDF& in);
49
50         virtual ~XMLAttribute();
51
52         /**
53          * Returns the set of values encoded as XML.
54          *
55          * @return  a mutable vector of the values
56          */
57         std::vector<std::string>& getValues();
58
59         /**
60          * Returns the set of values encoded as XML.
61          *
62          * @return  an immutable vector of the values
63          */
64         const std::vector<std::string>& getValues() const;
65
66         // Virtual function overrides.
67         size_t valueCount() const;
68         void clearSerializedValues();
69         const char* getString(size_t index) const;
70         void removeValue(size_t index);
71         const std::vector<std::string>& getSerializedValues() const;
72         DDF marshall() const;
73
74     private:
75         std::vector<std::string> m_values;
76     };
77
78 };
79
80 #endif /* __shibsp_xmlattr_h__ */