mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Expression support
- Added Context::getColumns to return a vector of column names. This is to help a shift toward using the Column objects to assist in the parsing/validation of data entry/modifications. - Added Column::modifiable to delegate an attributes readable/writeable state. This means the columns will be in charge of their own mutability, which will simplify and generalize Command::modify_task.
This commit is contained in:
parent
ee9199b4e0
commit
1164ea5cf1
6 changed files with 49 additions and 27 deletions
|
@ -411,6 +411,17 @@ void Context::shadow ()
|
|||
*/
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::vector <std::string> Context::getColumns () const
|
||||
{
|
||||
std::vector <std::string> output;
|
||||
std::map <std::string, Column*>::const_iterator i;
|
||||
for (i = columns.begin (); i != columns.end (); ++i)
|
||||
output.push_back (i->first);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Context::assumeLocations ()
|
||||
{
|
||||
|
|
|
@ -58,6 +58,8 @@ public:
|
|||
int getWidth (); // determine terminal width
|
||||
int getHeight (); // determine terminal height
|
||||
|
||||
const std::vector <std::string> getColumns () const;
|
||||
|
||||
bool color (); // TTY or <other>?
|
||||
bool verbose (const std::string&); // Verbosity control
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ ColumnID::ColumnID ()
|
|||
_type = "number";
|
||||
_style = "number";
|
||||
_label = STRING_COLUMN_LABEL_ID;
|
||||
_modifiable = false;
|
||||
|
||||
_styles.push_back ("number");
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ ColumnUUID::ColumnUUID ()
|
|||
_type = "string";
|
||||
_style = "long";
|
||||
_label = STRING_COLUMN_LABEL_UUID;
|
||||
_modifiable = false;
|
||||
|
||||
_styles.push_back ("long");
|
||||
_styles.push_back ("short");
|
||||
|
|
|
@ -132,6 +132,7 @@ Column::Column ()
|
|||
, _style ("default")
|
||||
, _label ("")
|
||||
, _report ("")
|
||||
, _modifiable (true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -143,6 +144,7 @@ Column::Column (const Column& other)
|
|||
_style = other._style;
|
||||
_label = other._label;
|
||||
_label = other._report;
|
||||
_modifiable = other._modifiable;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -155,6 +157,7 @@ Column& Column::operator= (const Column& other)
|
|||
_style = other._style;
|
||||
_label = other._label;
|
||||
_report = other._report;
|
||||
_modifiable = other._modifiable;
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
@ -166,7 +169,9 @@ bool Column::operator== (const Column& other) const
|
|||
return _name == other._name &&
|
||||
_type == other._type &&
|
||||
_style == other._style &&
|
||||
_label == other._label;
|
||||
_label == other._label &&
|
||||
_report == other._report &&
|
||||
_modifiable == other._modifiable;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
std::string style () const { return _style; }
|
||||
std::string label () const { return _label; }
|
||||
std::string type () const { return _type; }
|
||||
bool modifiable () const { return _modifiable; }
|
||||
std::vector <std::string> styles () const { return _styles; }
|
||||
std::vector <std::string> examples () const { return _examples; }
|
||||
|
||||
|
@ -68,6 +69,7 @@ protected:
|
|||
std::string _style;
|
||||
std::string _label;
|
||||
std::string _report;
|
||||
bool _modifiable;
|
||||
std::vector <std::string> _styles;
|
||||
std::vector <std::string> _examples;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue