- Implemented View::lines.
This commit is contained in:
Paul Beckingham 2011-04-29 01:57:53 -04:00
parent 4dca2a5a2d
commit 683a269991
3 changed files with 7 additions and 8 deletions

View file

@ -25,8 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream> // TODO Remove
#include <sstream>
//#include <iostream> // TODO Remove
#include <View.h>
#include <text.h>
@ -48,11 +47,6 @@ View::View ()
{
}
////////////////////////////////////////////////////////////////////////////////
View::~View ()
{
}
////////////////////////////////////////////////////////////////////////////////
// |<---------- terminal width ---------->|
//
@ -196,6 +190,7 @@ std::string View::render (std::vector <Task>& data, std::vector <int>& sequence)
// Output string.
std::string out;
_lines = 0;
// Render column headers.
std::string left_margin = std::string (_left_margin, ' ');
@ -218,6 +213,7 @@ std::string View::render (std::vector <Task>& data, std::vector <int>& sequence)
}
out += extra + "\n";
++_lines;
}
// Compose, render columns, in sequence.
@ -253,6 +249,7 @@ std::string View::render (std::vector <Task>& data, std::vector <int>& sequence)
}
out += extra + "\n";
++_lines;
}
cells.clear ();

View file

@ -37,7 +37,7 @@ class View
{
public:
View ();
~View ();
~View () {}
// View specifications.
void add (Column* column) { _columns.push_back (column); }

View file

@ -74,6 +74,8 @@ int main (int argc, char** argv)
// Render the view.
std::cout << view.render (data, sequence)
<< std::endl;
t.is (view.lines (), 4, "View::lines == 4");
}
catch (std::string& e)