Code Cleanup
- Removed obsolete Nibbler::getDOM.
This commit is contained in:
@@ -934,83 +934,6 @@ bool Nibbler::getOneOf (
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// [<number>|<uuid>|<word>|].<word>[.<word> ...]
|
|
||||||
//
|
|
||||||
// TODO Obsolete
|
|
||||||
bool Nibbler::getDOM (std::string& result)
|
|
||||||
{
|
|
||||||
std::string::size_type i = mCursor;
|
|
||||||
if (i < mLength)
|
|
||||||
{
|
|
||||||
save ();
|
|
||||||
|
|
||||||
std::string left;
|
|
||||||
std::string right;
|
|
||||||
int number;
|
|
||||||
|
|
||||||
// <name>.<name>[.<name> ...]
|
|
||||||
if (getName (left) &&
|
|
||||||
skip ('.') &&
|
|
||||||
getName (right))
|
|
||||||
{
|
|
||||||
while (skip ('.') &&
|
|
||||||
getWord (right))
|
|
||||||
;
|
|
||||||
|
|
||||||
result = mInput.substr (i, mCursor - i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
restore ();
|
|
||||||
|
|
||||||
// <id>.<name>[.<name> ...]
|
|
||||||
if (getInt (number) &&
|
|
||||||
skip ('.') &&
|
|
||||||
getName (right))
|
|
||||||
{
|
|
||||||
while (skip ('.') &&
|
|
||||||
getWord (right))
|
|
||||||
;
|
|
||||||
|
|
||||||
result = mInput.substr (i, mCursor - i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
restore ();
|
|
||||||
|
|
||||||
// <uuid>.<name>[.<name> ...]
|
|
||||||
if (getUUID (left) &&
|
|
||||||
skip ('.') &&
|
|
||||||
getName (right))
|
|
||||||
{
|
|
||||||
while (skip ('.') &&
|
|
||||||
getWord (right))
|
|
||||||
;
|
|
||||||
|
|
||||||
result = mInput.substr (i, mCursor - i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
restore ();
|
|
||||||
|
|
||||||
// <name>[.<name> ...]
|
|
||||||
if (getName (right))
|
|
||||||
{
|
|
||||||
while (skip ('.') &&
|
|
||||||
getWord (right))
|
|
||||||
;
|
|
||||||
|
|
||||||
result = mInput.substr (i, mCursor - i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
restore ();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// A name is a string of alpha-numeric characters.
|
// A name is a string of alpha-numeric characters.
|
||||||
bool Nibbler::getName (std::string& result)
|
bool Nibbler::getName (std::string& result)
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ public:
|
|||||||
bool getDateISO (time_t&);
|
bool getDateISO (time_t&);
|
||||||
bool getDate (const std::string&, time_t&);
|
bool getDate (const std::string&, time_t&);
|
||||||
bool getOneOf (const std::vector <std::string>&, std::string&);
|
bool getOneOf (const std::vector <std::string>&, std::string&);
|
||||||
bool getDOM (std::string&);
|
|
||||||
bool getName (std::string&);
|
bool getName (std::string&);
|
||||||
bool getWord (std::string&);
|
bool getWord (std::string&);
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Context context;
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
UnitTest t (292);
|
UnitTest t (282);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -410,35 +410,6 @@ int main (int argc, char** argv)
|
|||||||
t.is (s, "three", " 'threefour': getOneOf () -> three");
|
t.is (s, "three", " 'threefour': getOneOf () -> three");
|
||||||
t.notok (n.getOneOf (options, s), " 'four': getOneOf () -> false");
|
t.notok (n.getOneOf (options, s), " 'four': getOneOf () -> false");
|
||||||
|
|
||||||
// bool getDOM (std::string&);
|
|
||||||
t.diag ("Nibbler::getDOM");
|
|
||||||
|
|
||||||
// positive.
|
|
||||||
n = Nibbler ("due ");
|
|
||||||
t.ok (n.getDOM (s), "'due' getDOM -> ok");
|
|
||||||
t.is (s, "due", "'due' getDOM -> 'due'");
|
|
||||||
|
|
||||||
n = Nibbler ("123.due ");
|
|
||||||
t.ok (n.getDOM (s), "'123.due' getDOM -> ok");
|
|
||||||
t.is (s, "123.due", "'123.due' getDOM -> '123.due'");
|
|
||||||
|
|
||||||
n = Nibbler ("ebeeab00-ccf8-464b-8b58-f7f2d606edfb.due ");
|
|
||||||
t.ok (n.getDOM (s), "'ebeeab00-ccf8-464b-8b58-f7f2d606edfb.due' getDOM -> ok");
|
|
||||||
t.is (s, "ebeeab00-ccf8-464b-8b58-f7f2d606edfb.due",
|
|
||||||
"'ebeeab00-ccf8-464b-8b58-f7f2d606edfb.due' getDOM -> 'ebeeab00-ccf8-464b-8b58-f7f2d606edfb.due");
|
|
||||||
|
|
||||||
n = Nibbler ("rc.one.two.three.four.five.six.seven ");
|
|
||||||
t.ok (n.getDOM (s), "'rc.one.two.three.four.five.six.seven' getDOM -> 'rc.one.two.three.four.five.six.seven'");
|
|
||||||
t.is (s, "rc.one.two.three.four.five.six.seven",
|
|
||||||
"'rc.one.two.three.four.five.six.seven' getDOM -> 'rc.one.two.three.four.five.six.seven'");
|
|
||||||
|
|
||||||
// negative.
|
|
||||||
n = Nibbler ("1+2 ");
|
|
||||||
t.notok (n.getDOM (s), "'1+2' getDOM -> notok");
|
|
||||||
|
|
||||||
n = Nibbler ("..foo ");
|
|
||||||
t.notok (n.getDOM (s), "'..foo' getDOM -> notok");
|
|
||||||
|
|
||||||
// bool getName (std::string&);
|
// bool getName (std::string&);
|
||||||
t.diag ("Nibbler::getName");
|
t.diag ("Nibbler::getName");
|
||||||
n = Nibbler ("a1 one one.two 9");
|
n = Nibbler ("a1 one one.two 9");
|
||||||
|
|||||||
Reference in New Issue
Block a user