mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 10:07:19 +02:00
Enhancements - Complete Record parsing
- Enhanced Record unit tests - Fixed broken Att unit tests - Fixed broken Att
This commit is contained in:
parent
75c220c352
commit
a98951a8c3
5 changed files with 54 additions and 77 deletions
|
@ -37,25 +37,12 @@ Record::Record ()
|
|||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Record::Record (const Record& other)
|
||||
{
|
||||
throw std::string ("unimplemented Record::Record");
|
||||
*this = other;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Record::Record (const std::string& input)
|
||||
{
|
||||
parse (input);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Record& Record::operator= (const Record& other)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Record::~Record ()
|
||||
{
|
||||
|
@ -80,9 +67,9 @@ std::string Record::composeF4 ()
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// start --> name --> : --> " --> value --> " --> end
|
||||
// ^ |
|
||||
// +------------- \s <--------------+
|
||||
// [ --> start --> name --> : --> " --> value --> " --> ] --> end
|
||||
// ^ |
|
||||
// +------------- \s <--------------+
|
||||
//
|
||||
void Record::parse (const std::string& input)
|
||||
{
|
||||
|
@ -93,13 +80,15 @@ void Record::parse (const std::string& input)
|
|||
n.skip (']') &&
|
||||
n.depleted ())
|
||||
{
|
||||
Nibbler nl (line);
|
||||
if (line.length () == 0)
|
||||
throw std::string ("Empty FF4 record");
|
||||
|
||||
Nibbler nl (line);
|
||||
Att a;
|
||||
while (a.parse (nl))
|
||||
while (!nl.depleted () && a.parse (nl))
|
||||
{
|
||||
nl.skip (' ');
|
||||
(*this)[a.name ()] = a;
|
||||
nl.skip (' ');
|
||||
}
|
||||
|
||||
std::string remainder;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue