- Removed unused std::vector forms of get/set

- Added more defaults to Config::createDefault
This commit is contained in:
Paul Beckingham 2008-06-16 23:37:32 -04:00
parent 08fc906d5f
commit 7ec523d5ea
2 changed files with 6 additions and 25 deletions

View file

@ -116,6 +116,9 @@ void Config::createDefault (const std::string& file)
fprintf (out, "confirmation=yes\n"); fprintf (out, "confirmation=yes\n");
fprintf (out, "#nag=Note: try to stick to high priority tasks. See \"task next\".\n"); fprintf (out, "#nag=Note: try to stick to high priority tasks. See \"task next\".\n");
fprintf (out, "next=2\n"); fprintf (out, "next=2\n");
fprintf (out, "dateformat=m/d/Y\n");
fprintf (out, "showage=yes\n");
fprintf (out, "monthsperline=1\n");
fprintf (out, "curses=on\n"); fprintf (out, "curses=on\n");
fprintf (out, "color=on\n"); fprintf (out, "color=on\n");
@ -137,6 +140,9 @@ void Config::createDefault (const std::string& file)
set ("command.logging", "off"); set ("command.logging", "off");
set ("confirmation", "yes"); set ("confirmation", "yes");
set ("next", 1); set ("next", 1);
set ("dateformat", "m/d/Y");
set ("showage", "yes");
set ("monthsperline", 3);
set ("curses", "on"); set ("curses", "on");
set ("color", "on"); set ("color", "on");
set ("color.overdue", "red"); set ("color.overdue", "red");
@ -246,29 +252,6 @@ void Config::set (const std::string& key, const std::string& value)
(*this)[key] = value; (*this)[key] = value;
} }
////////////////////////////////////////////////////////////////////////////////
// The vector form of Config::get assumes the single value is comma-separated,
// and splits accordingly.
void Config::get (
const std::string& key,
std::vector <std::string>& values)
{
values.clear ();
split (values, (*this)[key], ',');
}
////////////////////////////////////////////////////////////////////////////////
// The vector form of Config::set joins the values together with commas, and
// stores the single value.
void Config::set (
const std::string& key,
const std::vector <std::string>& values)
{
std::string conjoined;
join (conjoined, ",", values);
(*this)[key] = conjoined;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Provide a vector of all configuration keys. // Provide a vector of all configuration keys.
void Config::all (std::vector<std::string>& items) void Config::all (std::vector<std::string>& items)

View file

@ -47,11 +47,9 @@ public:
bool get (const std::string&, bool); bool get (const std::string&, bool);
int get (const std::string&, const int); int get (const std::string&, const int);
double get (const std::string&, const double); double get (const std::string&, const double);
void get (const std::string&, std::vector <std::string>&);
void set (const std::string&, const int); void set (const std::string&, const int);
void set (const std::string&, const double); void set (const std::string&, const double);
void set (const std::string&, const std::string&); void set (const std::string&, const std::string&);
void set (const std::string&, const std::vector <std::string>&);
void all (std::vector <std::string>&); void all (std::vector <std::string>&);
}; };