Logo Search packages:      
Sourcecode: schroot version File versions  Download package

template<typename T, template< typename T > class C>
bool sbuild::keyfile::get_list_value ( std::string const &  group,
std::string const &  key,
C< T > &  value 
) const [inline]

Get a key value as a list.

Parameters:
group the group the key is in.
key the key to get.
value the list value to store the key's value in. The value type must be settable from an istream and be copyable. The list must be a container with a standard insert method.
Returns:
true if the key was found, otherwise false (in which case value will be unchanged).

Definition at line 299 of file sbuild-keyfile.h.

References get_value(), and separator.

Referenced by get_list_value(), sbuild::chroot::set_keyfile(), and sbuild::chroot_source::set_keyfile().

    {
      std::string item_value;
      if (get_value(group, key, item_value))
      {
        C<T> tmplist;
        string_list items = split_string(item_value, this->separator);
        for (string_list::const_iterator pos = items.begin();
             pos != items.end();
             ++pos
             )
          {
            T tmpval;
            if (parse_value(*pos, tmpval) == false)
            return false;
            tmplist.push_back(tmpval);
          }
        value = tmplist;
        return true;
      }
      return false;
    }


Generated by  Doxygen 1.6.0   Back to index