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:
@@ -38,6 +38,7 @@ extern Context context;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnID::ColumnID ()
|
||||
{
|
||||
_name = "id";
|
||||
_type = "number";
|
||||
_style = "default";
|
||||
_label = STRING_COLUMN_LABEL_ID;
|
||||
@@ -48,6 +49,12 @@ ColumnID::~ColumnID ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool ColumnID::validate (std::string& value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnID::measure (Task& task, int& minimum, int& maximum)
|
||||
@@ -63,7 +70,7 @@ void ColumnID::measure (Task& task, int& minimum, int& maximum)
|
||||
minimum = maximum = length;
|
||||
|
||||
if (_style != "default")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "id", _style);
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user