mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-06 17:37:21 +02:00
Columns
- Refactored column objects to contain a ::validate method, for the validation of incoming data. - Context.columns is now a vector of one of each column object, indexed by attribute name, for validation purposes.
This commit is contained in:
parent
a7d6b91ad3
commit
3c1c900b5b
38 changed files with 252 additions and 76 deletions
|
@ -37,6 +37,7 @@ extern Context context;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnStatus::ColumnStatus ()
|
||||
{
|
||||
_name = "status";
|
||||
_type = "string";
|
||||
_style = "default";
|
||||
_label = STRING_COLUMN_LABEL_STATUS;
|
||||
|
@ -47,6 +48,12 @@ ColumnStatus::~ColumnStatus ()
|
|||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool ColumnStatus::validate (std::string& value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Overriden so that style <----> label are linked.
|
||||
// Note that you can not determine which gets called first.
|
||||
|
@ -81,7 +88,7 @@ void ColumnStatus::measure (Task& task, int& minimum, int& maximum)
|
|||
else if (_style == "short")
|
||||
minimum = maximum = 1;
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "status.", _style);
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue