Config - defaults

- Implemented replacement Config::get* methods.
- Replaced all calls throughout the code, with the new methods which
  have no static values as defaults.
This commit is contained in:
Paul Beckingham
2010-01-15 20:55:06 -05:00
parent 0faf7fa8ee
commit cb821c2a25
16 changed files with 234 additions and 265 deletions

View File

@@ -168,12 +168,12 @@ static void decorateTask (Task& task)
task.setStatus (Task::pending);
// Override with default.project, if not specified.
std::string defaultProject = context.config.get ("default.project", "");
std::string defaultProject = context.config.get ("default.project");
if (!task.has ("project") && defaultProject != "")
task.set ("project", defaultProject);
// Override with default.priority, if not specified.
std::string defaultPriority = context.config.get ("default.priority", "");
std::string defaultPriority = context.config.get ("default.priority");
if (!task.has ("priority") &&
defaultPriority != "" &&
Att::validNameValue ("priority", "", defaultPriority))
@@ -185,7 +185,7 @@ static std::string importTask_1_4_3 (const std::vector <std::string>& lines)
{
std::vector <std::string> failed;
context.tdb.lock (context.config.get ("locking", true));
context.tdb.lock (context.config.getBoolean ("locking"));
std::vector <std::string>::const_iterator it;
for (it = lines.begin (); it != lines.end (); ++it)
@@ -342,7 +342,7 @@ static std::string importTask_1_5_0 (const std::vector <std::string>& lines)
{
std::vector <std::string> failed;
context.tdb.lock (context.config.get ("locking", true));
context.tdb.lock (context.config.getBoolean ("locking"));
std::vector <std::string>::const_iterator it;
for (it = lines.begin (); it != lines.end (); ++it)
@@ -504,7 +504,7 @@ static std::string importTask_1_6_0 (const std::vector <std::string>& lines)
{
std::vector <std::string> failed;
context.tdb.lock (context.config.get ("locking", true));
context.tdb.lock (context.config.getBoolean ("locking"));
std::vector <std::string>::const_iterator it;
for (it = lines.begin (); it != lines.end (); ++it)
@@ -715,7 +715,7 @@ static std::string importTodoSh_2_0 (const std::vector <std::string>& lines)
{
std::vector <std::string> failed;
context.tdb.lock (context.config.get ("locking", true));
context.tdb.lock (context.config.getBoolean ("locking"));
std::vector <std::string>::const_iterator it;
for (it = lines.begin (); it != lines.end (); ++it)
@@ -840,7 +840,7 @@ static std::string importText (const std::vector <std::string>& lines)
std::vector <std::string> failed;
int count = 0;
context.tdb.lock (context.config.get ("locking", true));
context.tdb.lock (context.config.getBoolean ("locking"));
std::vector <std::string>::const_iterator it;
for (it = lines.begin (); it != lines.end (); ++it)
@@ -904,7 +904,7 @@ static std::string importCSV (const std::vector <std::string>& lines)
{
std::vector <std::string> failed;
context.tdb.lock (context.config.get ("locking", true));
context.tdb.lock (context.config.getBoolean ("locking"));
// Set up mappings. Assume no fields match.
std::map <std::string, int> mapping;