https://bugs.internet2.edu/jira/browse/SSPCPP-365
[shibboleth/sp.git] / shibsp / attribute / BinaryAttribute.h
1 /*
2  *  Copyright 2001-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/BinaryAttribute.h
19  * 
20  * An Attribute whose values are binary data.
21  */
22
23 #ifndef __shibsp_binattr_h__
24 #define __shibsp_binattr_h__
25
26 #include <shibsp/attribute/Attribute.h>
27
28 namespace shibsp {
29
30 #if defined (_MSC_VER)
31     #pragma warning( push )
32     #pragma warning( disable : 4251 )
33 #endif
34
35     /**
36      * An Attribute whose values are binary data.
37      * 
38      * <p>Binary attributes use base64 encoding to serialize their values.
39      * The original binary values are accessible in the underlying value
40      * collection.
41      */
42     class SHIBSP_API BinaryAttribute : public Attribute
43     {
44     public:
45         /**
46          * Constructor.
47          * 
48          * @param ids   array with primary identifier in first position, followed by any aliases
49          */
50         BinaryAttribute(const std::vector<std::string>& ids);
51
52         /**
53          * Constructs based on a remoted BinaryAttribute.
54          * 
55          * @param in    input object containing marshalled BinaryAttribute
56          */
57         BinaryAttribute(DDF& in);
58         
59         virtual ~BinaryAttribute();
60
61         /**
62          * Returns the set of raw binary values.
63          * 
64          * @return  a mutable vector of the values
65          */
66         std::vector<std::string>& getValues();
67
68         /**
69          * Returns the set of raw binary values.
70          * 
71          * @return  an immutable vector of the values
72          */
73         const std::vector<std::string>& getValues() const;
74
75         // Virtual function overrides.
76         size_t valueCount() const;
77         void clearSerializedValues();
78         const char* getString(size_t index) const;
79         void removeValue(size_t index);
80         const std::vector<std::string>& getSerializedValues() const;
81         DDF marshall() const;
82     
83     private:
84         std::vector<std::string> m_values;
85     };
86
87 #if defined (_MSC_VER)
88     #pragma warning( pop )
89 #endif
90
91 };
92
93 #endif /* __shibsp_scopedattr_h__ */