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

template<typename T>
void sbuild::keyfile::set_value ( std::string const &  group,
std::string const &  key,
T const &  value,
std::string const &  comment 
) [inline]

Set a key value.

Parameters:
group the group the key is in.
key the key to set.
value the value to get the key's value from. This must
comment the comment for this key. allow output to an ostream.

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

References find_group(), and set_group().

    {
      std::ostringstream os;
      os.imbue(std::locale("C"));
      os << std::boolalpha << value;

      set_group(group, "");
      group_type *found_group = find_group(group);
      assert (found_group != 0); // should not fail

      item_map_type& items = std::tr1::get<1>(*found_group);

      item_map_type::iterator pos = items.find(key);
      if (pos != items.end())
      items.erase(pos);

      items.insert
      (item_map_type::value_type(key,
                           item_type(key, os.str(), comment)));
    }


Generated by  Doxygen 1.6.0   Back to index