diff --git a/src/Context.cpp b/src/Context.cpp index daf6c5874..de9d60a90 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -411,6 +411,17 @@ void Context::shadow () */ } +//////////////////////////////////////////////////////////////////////////////// +const std::vector Context::getColumns () const +{ + std::vector output; + std::map ::const_iterator i; + for (i = columns.begin (); i != columns.end (); ++i) + output.push_back (i->first); + + return output; +} + //////////////////////////////////////////////////////////////////////////////// void Context::assumeLocations () { diff --git a/src/Context.h b/src/Context.h index 9b9175c1b..50e9c85c9 100644 --- a/src/Context.h +++ b/src/Context.h @@ -58,6 +58,8 @@ public: int getWidth (); // determine terminal width int getHeight (); // determine terminal height + const std::vector getColumns () const; + bool color (); // TTY or ? bool verbose (const std::string&); // Verbosity control diff --git a/src/columns/ColID.cpp b/src/columns/ColID.cpp index 55eca33ef..f5bfc84db 100644 --- a/src/columns/ColID.cpp +++ b/src/columns/ColID.cpp @@ -38,10 +38,11 @@ extern Context context; //////////////////////////////////////////////////////////////////////////////// ColumnID::ColumnID () { - _name = "id"; - _type = "number"; - _style = "number"; - _label = STRING_COLUMN_LABEL_ID; + _name = "id"; + _type = "number"; + _style = "number"; + _label = STRING_COLUMN_LABEL_ID; + _modifiable = false; _styles.push_back ("number"); diff --git a/src/columns/ColUUID.cpp b/src/columns/ColUUID.cpp index 068d555c5..a83f080bb 100644 --- a/src/columns/ColUUID.cpp +++ b/src/columns/ColUUID.cpp @@ -38,10 +38,11 @@ extern Context context; //////////////////////////////////////////////////////////////////////////////// ColumnUUID::ColumnUUID () { - _name = "uuid"; - _type = "string"; - _style = "long"; - _label = STRING_COLUMN_LABEL_UUID; + _name = "uuid"; + _type = "string"; + _style = "long"; + _label = STRING_COLUMN_LABEL_UUID; + _modifiable = false; _styles.push_back ("long"); _styles.push_back ("short"); diff --git a/src/columns/Column.cpp b/src/columns/Column.cpp index 2acfa1beb..b1e656cb7 100644 --- a/src/columns/Column.cpp +++ b/src/columns/Column.cpp @@ -132,17 +132,19 @@ Column::Column () , _style ("default") , _label ("") , _report ("") +, _modifiable (true) { } //////////////////////////////////////////////////////////////////////////////// Column::Column (const Column& other) { - _name = other._name; - _type = other._type; - _style = other._style; - _label = other._label; - _label = other._report; + _name = other._name; + _type = other._type; + _style = other._style; + _label = other._label; + _label = other._report; + _modifiable = other._modifiable; } //////////////////////////////////////////////////////////////////////////////// @@ -150,11 +152,12 @@ Column& Column::operator= (const Column& other) { if (this != &other) { - _name = other._name; - _type = other._type; - _style = other._style; - _label = other._label; - _report = other._report; + _name = other._name; + _type = other._type; + _style = other._style; + _label = other._label; + _report = other._report; + _modifiable = other._modifiable; } return *this; @@ -163,10 +166,12 @@ Column& Column::operator= (const Column& other) //////////////////////////////////////////////////////////////////////////////// bool Column::operator== (const Column& other) const { - return _name == other._name && - _type == other._type && - _style == other._style && - _label == other._label; + return _name == other._name && + _type == other._type && + _style == other._style && + _label == other._label && + _report == other._report && + _modifiable == other._modifiable; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/Column.h b/src/columns/Column.h index cc95cd739..7ba4ec3ef 100644 --- a/src/columns/Column.h +++ b/src/columns/Column.h @@ -45,11 +45,12 @@ public: bool operator== (const Column&) const; // TODO Is this necessary? ~Column (); - std::string style () const { return _style; } - std::string label () const { return _label; } - std::string type () const { return _type; } - std::vector styles () const { return _styles; } - std::vector examples () const { return _examples; } + 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 styles () const { return _styles; } + std::vector examples () const { return _examples; } virtual void setStyle (const std::string& value) { _style = value; } virtual void setLabel (const std::string& value) { _label = value; } @@ -68,6 +69,7 @@ protected: std::string _style; std::string _label; std::string _report; + bool _modifiable; std::vector _styles; std::vector _examples; };