ref: refs/heads/master
commit 376864f86054caf376e52677ae002c9e1d936aff
Author: Ján Kupec
Date: Tue Mar 31 20:16:14 2009 +0200
Renamed TableStyle -> TableLineStyle.
---
src/Table.cc | 6 +++---
src/Table.h | 19 ++++++++++---------
src/Zypper.cc | 4 ++--
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/Table.cc b/src/Table.cc
index cbf700e..bd0da65 100644
--- a/src/Table.cc
+++ b/src/Table.cc
@@ -15,7 +15,7 @@
using namespace std;
-TableStyle Table::defaultStyle = Ascii;
+TableLineStyle Table::defaultStyle = Ascii;
static
const char * lines[][3] = {
@@ -54,7 +54,7 @@ void TableRow::dumbDumpTo (ostream &stream) const {
}
void TableRow::dumpTo (ostream &stream, const vector<unsigned>& widths,
- TableStyle st, unsigned margin) const {
+ TableLineStyle st, unsigned margin) const {
const char * vline = st != none ? lines[st][0] : "";
unsigned int ssize = 0; // string size in columns
@@ -193,7 +193,7 @@ void Table::dumpTo (ostream &stream) const {
}
}
-void Table::style (TableStyle st) {
+void Table::lineStyle (TableLineStyle st) {
if (st < _End)
_style = st;
}
diff --git a/src/Table.h b/src/Table.h
index 6ef45df..caaaaf4 100644
--- a/src/Table.h
+++ b/src/Table.h
@@ -20,7 +20,7 @@ using std::list;
using std::vector;
//! table drawing style
-enum TableStyle {
+enum TableLineStyle {
Ascii = 0, ///< | - +
Light,
Heavy,
@@ -51,7 +51,7 @@ public:
void dumbDumpTo (ostream &stream) const;
//! output with field widths
void dumpTo (ostream &stream, const vector<unsigned>& widths,
- TableStyle st, unsigned margin) const;
+ TableLineStyle st, unsigned margin) const;
typedef vector<string> container;
@@ -84,7 +84,7 @@ TableRow& operator << (TableRow& tr, const string& s) {
class Table {
public:
- static TableStyle defaultStyle;
+ static TableLineStyle defaultStyle;
void add (const TableRow& tr);
void setHeader (const TableHeader& tr);
@@ -92,7 +92,7 @@ public:
bool empty () const { return _rows.empty(); }
typedef list<TableRow> container;
- void style (TableStyle st);
+ void lineStyle (TableLineStyle st);
void sort (unsigned by_column); // columns start with 0...
void allowAbbrev(unsigned column);
void margin(unsigned margin);
@@ -106,19 +106,20 @@ private:
bool _has_header;
TableHeader _header;
container _rows;
+
//! maximum column index seen in this table
unsigned _max_col;
//! maximum width of respective columns
mutable vector<unsigned> _max_width;
//! table width (columns)
int _width;
- //! table drawing style
- TableStyle _style;
- //! console screen width as retrieved by readline
+ //! table line drawing style
+ TableLineStyle _style;
+ //! amount of space we have to print this table
int _screen_width;
- //! whether to abbreviate the column if needed
+ //! whether to abbreviate the respective column if needed
vector<bool> _abbrev_col;
-
+ //! left/right margin in number of spaces
unsigned _margin;
};
diff --git a/src/Zypper.cc b/src/Zypper.cc
index 17fc943..bd1476c 100644
--- a/src/Zypper.cc
+++ b/src/Zypper.cc
@@ -417,7 +417,7 @@ void Zypper::processGlobalOptions()
unsigned s;
str::strtonum (it->second.front(), s);
if (s < _End)
- Table::defaultStyle = (TableStyle) s;
+ Table::defaultStyle = (TableLineStyle) s;
else
out().error(str::form(_("Invalid table style %d."), s),
str::form(_("Use an integer number from %d to %d"), 0, 8));
@@ -3311,7 +3311,7 @@ void Zypper::doCommand()
resolve(*this);
Table t;
- t.style(Ascii);
+ t.lineStyle(Ascii);
try
{
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org