View
- Implemented View::lines.
This commit is contained in:
11
src/View.cpp
11
src/View.cpp
@@ -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 ();
|
||||
|
||||
@@ -37,7 +37,7 @@ class View
|
||||
{
|
||||
public:
|
||||
View ();
|
||||
~View ();
|
||||
~View () {}
|
||||
|
||||
// View specifications.
|
||||
void add (Column* column) { _columns.push_back (column); }
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user