Integration - attribute validation

- Implemented digitsOnly primitive.
- Implemented noSpaces primitive.
- Added unit tests for above.
- Att now manages the lists of valid attributes and modifier names.
- validName migrated to Att.
- validModifiableName migrated to Att.
- New Att::validNameValue.
- Removed obsolete validDescription.
- Removed obsolete validPriority.
- Removed obsolete valid.cpp/guess.
- Implemented text.cpp/noVerticalSpace.
- Added unit tests for text.cpp/noVerticalSpace.
- Removed final static lists from valid.cpp.
This commit is contained in:
Paul Beckingham 2009-06-13 14:56:27 -04:00
parent eda17772c9
commit 25d27bec93
11 changed files with 287 additions and 151 deletions

View file

@ -27,6 +27,7 @@
#include <iostream>
#include <vector>
#include <string>
#include <ctype.h>
#include "Context.h"
#include "util.h"
#include "text.h"
@ -337,3 +338,32 @@ void guess (
}
////////////////////////////////////////////////////////////////////////////////
bool digitsOnly (const std::string& input)
{
for (size_t i = 0; i < input.length (); ++i)
if (!::isdigit (input[i]))
return false;
return true;
}
////////////////////////////////////////////////////////////////////////////////
bool noSpaces (const std::string& input)
{
for (size_t i = 0; i < input.length (); ++i)
if (::isspace (input[i]))
return false;
return true;
}
////////////////////////////////////////////////////////////////////////////////
bool noVerticalSpace (const std::string& input)
{
if (input.find_first_of ("\n\r\f") != std::string::npos)
return false;
return true;
}
////////////////////////////////////////////////////////////////////////////////