2 * Copyright 2001-2009 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file shibsp/attribute/ScopedAttribute.h
20 * An Attribute whose values are relations of a value and a scope.
23 #ifndef __shibsp_scopedattr_h__
24 #define __shibsp_scopedattr_h__
26 #include <shibsp/attribute/Attribute.h>
30 #if defined (_MSC_VER)
31 #pragma warning( push )
32 #pragma warning( disable : 4251 )
36 * An Attribute whose values are relations of a value and a scope.
38 * <p>In practice, scoped attributes are simple pairs of strings instead
39 * of a single string. They can be expressed as a string easily using a delimeter,
40 * typically an '@' symbol. The scope concept allows certain kinds of filtering to
41 * be performed more intelligently and efficiently, although not all scoped
42 * attributes can be effectively filtered (e.g. if the set of scope values is
45 class SHIBSP_API ScopedAttribute : public Attribute
51 * @param ids array with primary identifier in first position, followed by any aliases
52 * @param delimeter value/scope delimeter when serializing
54 ScopedAttribute(const std::vector<std::string>& ids, char delimeter='@');
57 * Constructs based on a remoted ScopedAttribute.
59 * @param in input object containing marshalled ScopedAttribute
61 ScopedAttribute(DDF& in);
63 virtual ~ScopedAttribute();
66 * Returns the set of values encoded as UTF-8 strings.
68 * <p>Each compound value is a pair containing the simple value and the scope.
70 * @return a mutable vector of the values
72 std::vector< std::pair<std::string,std::string> >& getValues();
75 * Returns the set of values encoded as UTF-8 strings.
77 * <p>Each compound value is a pair containing the simple value and the scope.
79 * @return an immutable vector of the values
81 const std::vector< std::pair<std::string,std::string> >& getValues() const;
83 // Virtual function overrides.
84 size_t valueCount() const;
85 void clearSerializedValues();
86 const char* getString(size_t index) const;
87 const char* getScope(size_t index) const;
88 void removeValue(size_t index);
89 const std::vector<std::string>& getSerializedValues() const;
94 std::vector< std::pair<std::string,std::string> > m_values;
97 #if defined (_MSC_VER)
98 #pragma warning( pop )
103 #endif /* __shibsp_scopedattr_h__ */