From cd59f7f510b164f7edb1f5c72a333d776043de5c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 26 Jun 2010 17:33:58 -0400 Subject: [PATCH] Code Cleanup - Corrected comments. - Eliminated redundant code, at the expense of Task::parse call. --- src/Att.cpp | 3 --- src/Task.cpp | 20 +++----------------- src/tests/tdb.t.cpp | 3 +-- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/Att.cpp b/src/Att.cpp index 4857ceffa..217a47157 100644 --- a/src/Att.cpp +++ b/src/Att.cpp @@ -744,12 +744,9 @@ void Att::dequote (std::string& value) const //////////////////////////////////////////////////////////////////////////////// // Encode values prior to serialization. // \t -> &tab; -// ' -> &squot; <-- deprecated, no need to encode/decod single quotes. // " -> &dquot; -// , -> , <-- deprecated, no need to encode/decode commas. // [ -> &open; // ] -> &close; -// : -> : <-- deprecated, no need to encode/decode colons. void Att::encode (std::string& value) const { std::string::size_type i; diff --git a/src/Task.cpp b/src/Task.cpp index 15d51a864..0a4cd135f 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -78,25 +78,9 @@ bool Task::operator== (const Task& other) } //////////////////////////////////////////////////////////////////////////////// -// Attempt an FF4 parse first, using Record::parse, and in the event of an error -// try a legacy parse (F3, FF2). Note that FF1 is no longer supported. Task::Task (const std::string& input) { - std::string copy; - if (input[input.length () - 1] == '\n') - copy = input.substr (0, input.length () - 1); - else - copy = input; - - try - { - Record::parse (copy); - } - - catch (std::string& e) - { - legacyParse (copy); - } + parse (input); } //////////////////////////////////////////////////////////////////////////////// @@ -149,6 +133,8 @@ void Task::setStatus (Task::status status) } //////////////////////////////////////////////////////////////////////////////// +// Attempt an FF4 parse first, using Record::parse, and in the event of an error +// try a legacy parse (F3, FF2). Note that FF1 is no longer supported. void Task::parse (const std::string& line) { std::string copy; diff --git a/src/tests/tdb.t.cpp b/src/tests/tdb.t.cpp index 636471d1f..a6e5cffc9 100644 --- a/src/tests/tdb.t.cpp +++ b/src/tests/tdb.t.cpp @@ -69,9 +69,8 @@ int main (int argc, char** argv) tdb.location ("."); tdb.lock (); Task task ("[name:\"value\"]"); - tdb.add (task); + tdb.add (task); // P0 C0 N1 M0 tdb.unlock (); -// P0 C0 N1 M0 pending.clear (); completed.clear ();