mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 07:57:20 +02:00
Code Cleanup
- Corrected comments. - Eliminated redundant code, at the expense of Task::parse call.
This commit is contained in:
parent
6a1a1cd70f
commit
cd59f7f510
3 changed files with 4 additions and 22 deletions
|
@ -744,12 +744,9 @@ void Att::dequote (std::string& value) const
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Encode values prior to serialization.
|
// Encode values prior to serialization.
|
||||||
// \t -> &tab;
|
// \t -> &tab;
|
||||||
// ' -> &squot; <-- deprecated, no need to encode/decod single quotes.
|
|
||||||
// " -> &dquot;
|
// " -> &dquot;
|
||||||
// , -> , <-- deprecated, no need to encode/decode commas.
|
|
||||||
// [ -> &open;
|
// [ -> &open;
|
||||||
// ] -> &close;
|
// ] -> &close;
|
||||||
// : -> : <-- deprecated, no need to encode/decode colons.
|
|
||||||
void Att::encode (std::string& value) const
|
void Att::encode (std::string& value) const
|
||||||
{
|
{
|
||||||
std::string::size_type i;
|
std::string::size_type i;
|
||||||
|
|
20
src/Task.cpp
20
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)
|
Task::Task (const std::string& input)
|
||||||
{
|
{
|
||||||
std::string copy;
|
parse (input);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -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)
|
void Task::parse (const std::string& line)
|
||||||
{
|
{
|
||||||
std::string copy;
|
std::string copy;
|
||||||
|
|
|
@ -69,9 +69,8 @@ int main (int argc, char** argv)
|
||||||
tdb.location (".");
|
tdb.location (".");
|
||||||
tdb.lock ();
|
tdb.lock ();
|
||||||
Task task ("[name:\"value\"]");
|
Task task ("[name:\"value\"]");
|
||||||
tdb.add (task);
|
tdb.add (task); // P0 C0 N1 M0
|
||||||
tdb.unlock ();
|
tdb.unlock ();
|
||||||
// P0 C0 N1 M0
|
|
||||||
|
|
||||||
pending.clear ();
|
pending.clear ();
|
||||||
completed.clear ();
|
completed.clear ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue