Change license header.
[shibboleth/cpp-sp.git] / shibsp / attribute / SimpleAttribute.h
index 8e8f2c6..55770c0 100644 (file)
@@ -1,17 +1,21 @@
-/*
- *  Copyright 2001-2007 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
+ *
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
  */
 
 /**
@@ -34,27 +38,21 @@ namespace shibsp {
     {
     public:
         /**
-         * Constructor
+         * Constructor.
          * 
-         * @param id    Attribute identifier
+         * @param ids   array with primary identifier in first position, followed by any aliases
          */
-        SimpleAttribute(const char* id) : Attribute(id) {}
+        SimpleAttribute(const std::vector<std::string>& ids);
 
         /**
          * Constructs based on a remoted SimpleAttribute.
          * 
          * @param in    input object containing marshalled SimpleAttribute
          */
-        SimpleAttribute(DDF& in) : Attribute(in) {
-            DDF val = in.first().first();
-            while (val.string()) {
-                m_serialized.push_back(val.string());
-                val = val.next();
-            }
-        }
-        
-        virtual ~SimpleAttribute() {}
+        SimpleAttribute(DDF& in);
         
+        virtual ~SimpleAttribute();
+
         /**
          * Returns the set of values encoded as UTF-8 strings.
          * 
@@ -63,21 +61,11 @@ namespace shibsp {
          * 
          * @return  a mutable vector of the values
          */
-        std::vector<std::string>& getValues() {
-            return m_serialized;
-        }
-        
-        void clearSerializedValues() {
-            // Do nothing, since our values are already serialized.
-        }
+        std::vector<std::string>& getValues();
         
-        DDF marshall() const {
-            DDF ddf = Attribute::marshall();
-            DDF vlist = ddf.first();
-            for (std::vector<std::string>::const_iterator i=m_serialized.begin(); i!=m_serialized.end(); ++i)
-                vlist.add(DDF(NULL).string(i->c_str()));
-            return ddf;
-        }
+        // Virtual function overrides.
+        void clearSerializedValues();
+        DDF marshall() const;
     };
 
 };