Enhancements - Complete Record parsing

- Enhanced Record unit tests
- Fixed broken Att unit tests
- Fixed broken Att
This commit is contained in:
Paul Beckingham 2009-06-01 01:25:07 -04:00
parent 75c220c352
commit a98951a8c3
5 changed files with 54 additions and 77 deletions

View file

@ -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;