Bug Fixes - Att, Subst

- Fixed but that required all known attributes to be listed by name
  in order to be recognized by creating new Att::validInternalName
  method.
- Fixed bug in non-global Subst that failed to save a modified
  annotation.
This commit is contained in:
Paul Beckingham
2009-06-18 23:14:26 -04:00
parent cea84b3d3b
commit 3ffb855956
4 changed files with 16 additions and 23 deletions

View File

@@ -187,6 +187,16 @@ bool Att::valid (const std::string& input) const
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Att::validInternalName (const std::string& name)
{
for (unsigned int i = 0; i < NUM_INTERNAL_NAMES; ++i)
if (name == internalNames[i])
return true;
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Att::validModifiableName (const std::string& name)
{
@@ -206,19 +216,7 @@ bool Att::validNameValue (
std::string writableName = name;
std::string writableMod = mod;
std::string writableValue = value;
bool status = Att::validNameValue (writableName, writableMod, writableValue);
/*
// TODO Is this even worth doing?
if (name != writableName)
throw std::string ("The attribute '") + name + "' was not fully qualified.";
if (mod != writableMod)
throw std::string ("The modifier '") + mod + "' was not fully qualified.";
if (value != writableValue)
throw std::string ("The value '") + value + "' was not fully qualified.";
*/
return status;
return Att::validNameValue (writableName, writableMod, writableValue);
}
////////////////////////////////////////////////////////////////////////////////
@@ -369,15 +367,8 @@ bool Att::validNameValue (
"\" is not a valid status. Use 'pending', 'completed', 'deleted' or 'recurring'.";
}
else if (name == "parent")
{
}
else if (name == "uuid")
{
}
else
else if (! validInternalName (name) &&
! validModifiableName (name))
throw std::string ("'") + name + "' is not a recognized attribute.";
return true;