Enhancement - Att::type
- Implemented Att::type to discern attribute types to assist with type-specific modifier evaluation. - Fixed bug that required attributes to have specified values, whereas stating "name:" means no value for name.
This commit is contained in:
23
src/Att.cpp
23
src/Att.cpp
@@ -392,6 +392,27 @@ bool Att::validMod (const std::string& mod)
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The type of an attribute is useful for modifier evaluation.
|
||||
std::string type (const std::string& name)
|
||||
{
|
||||
if (name == "due" ||
|
||||
name == "until" ||
|
||||
name == "start" ||
|
||||
name == "entry" ||
|
||||
name == "end")
|
||||
return "date";
|
||||
|
||||
else if (name == "recur")
|
||||
return "duration";
|
||||
|
||||
else if (name == "limit")
|
||||
return "number";
|
||||
|
||||
else
|
||||
return "text";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// start --> name --> . --> mod --> : --> " --> value --> " --> end
|
||||
@@ -439,8 +460,6 @@ void Att::parse (Nibbler& n)
|
||||
{
|
||||
decode (mValue);
|
||||
}
|
||||
else
|
||||
throw std::string ("Missing attribute value"); // TODO i18n
|
||||
}
|
||||
else
|
||||
throw std::string ("Missing : after attribute name"); // TODO i18n
|
||||
|
||||
Reference in New Issue
Block a user