From 683a269991d6f5e6b91fb14f05cba8d655e20d5d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 29 Apr 2011 01:57:53 -0400 Subject: [PATCH] View - Implemented View::lines. --- src/View.cpp | 11 ++++------- src/View.h | 2 +- test/view.t.cpp | 2 ++ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/View.cpp b/src/View.cpp index d27f66796..125abfa2b 100644 --- a/src/View.cpp +++ b/src/View.cpp @@ -25,8 +25,7 @@ // //////////////////////////////////////////////////////////////////////////////// -#include // TODO Remove -#include +//#include // TODO Remove #include #include @@ -48,11 +47,6 @@ View::View () { } -//////////////////////////////////////////////////////////////////////////////// -View::~View () -{ -} - //////////////////////////////////////////////////////////////////////////////// // |<---------- terminal width ---------->| // @@ -196,6 +190,7 @@ std::string View::render (std::vector & data, std::vector & 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 & data, std::vector & sequence) } out += extra + "\n"; + ++_lines; } // Compose, render columns, in sequence. @@ -253,6 +249,7 @@ std::string View::render (std::vector & data, std::vector & sequence) } out += extra + "\n"; + ++_lines; } cells.clear (); diff --git a/src/View.h b/src/View.h index 72bd6f67e..293690de8 100644 --- a/src/View.h +++ b/src/View.h @@ -37,7 +37,7 @@ class View { public: View (); - ~View (); + ~View () {} // View specifications. void add (Column* column) { _columns.push_back (column); } diff --git a/test/view.t.cpp b/test/view.t.cpp index e232c38f2..ca0347502 100644 --- a/test/view.t.cpp +++ b/test/view.t.cpp @@ -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)