diff --git a/src/Record.cpp b/src/Record.cpp index c0fd24d42..dd4964040 100644 --- a/src/Record.cpp +++ b/src/Record.cpp @@ -47,7 +47,6 @@ Record::Record () //////////////////////////////////////////////////////////////////////////////// Record::Record (const std::string& input) { - parse (input); } //////////////////////////////////////////////////////////////////////////////// @@ -55,42 +54,3 @@ Record::~Record () { } -//////////////////////////////////////////////////////////////////////////////// -// -// start --> [ --> Att --> ] --> end -// ^ | -// +-------+ -// -void Record::parse (const std::string& input) -{ - clear (); - - Nibbler n (input); - std::string line; - if (n.skip ('[') && - n.getUntil (']', line) && - n.skip (']') && - n.depleted ()) - { - if (line.length () == 0) - throw std::string (STRING_RECORD_EMPTY); - - Nibbler nl (line); - Att a; - while (!nl.depleted ()) - { - a.parse (nl); - (*this)[a.name ()] = a; - nl.skip (' '); - } - - std::string remainder; - nl.getUntilEOS (remainder); - if (remainder.length ()) - throw std::string (STRING_RECORD_JUNK_AT_EOL); - } - else - throw std::string (STRING_RECORD_NOT_FF4); -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Record.h b/src/Record.h index 51ca44e22..e3547d9a2 100644 --- a/src/Record.h +++ b/src/Record.h @@ -40,9 +40,6 @@ public: Record (); // Default constructor Record (const std::string&); // Copy constructor virtual ~Record (); // Destructor - - void parse (const std::string&); - }; #endif diff --git a/src/Task.cpp b/src/Task.cpp index b59012c09..c70a15bb1 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -271,17 +271,50 @@ 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) +// +// start --> [ --> Att --> ] --> end +// ^ | +// +-------+ +// +void Task::parse (const std::string& input) { std::string copy; - if (line[line.length () - 1] == '\n') - copy = line.substr (0, line.length () - 1); + if (input[input.length () - 1] == '\n') + copy = input.substr (0, input.length () - 1); else - copy = line; + copy = input; try { - Record::parse (copy); +// Record::parse (copy); + clear (); + + Nibbler n (copy); + std::string line; + if (n.skip ('[') && + n.getUntil (']', line) && + n.skip (']') && + n.depleted ()) + { + if (line.length () == 0) + throw std::string (STRING_RECORD_EMPTY); + + Nibbler nl (line); + Att a; + while (!nl.depleted ()) + { + a.parse (nl); + (*this)[a.name ()] = a; + nl.skip (' '); + } + + std::string remainder; + nl.getUntilEOS (remainder); + if (remainder.length ()) + throw std::string (STRING_RECORD_JUNK_AT_EOL); + } + else + throw std::string (STRING_RECORD_NOT_FF4); } catch (std::string& e)