From 56d1504957acc63258702af7f1dfa1045cf8391c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Kupec?= Date: Wed, 20 Jan 2010 16:21:22 +0100 Subject: [PATCH] let display_progress and display_tick be member functions --- src/output/OutNormal.cc | 16 ++++++++-------- src/output/OutNormal.h | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/output/OutNormal.cc b/src/output/OutNormal.cc index 261e56e..c52adc6 100644 --- a/src/output/OutNormal.cc +++ b/src/output/OutNormal.cc @@ -120,11 +120,11 @@ void OutNormal::error(const zypp::Exception & e, // ---------------------------------------------------------------------------- -static void display_progress ( const std::string & id, const string & s, int percent) +void OutNormal::displayProgress (const string & s, int percent) { static AliveCursor cursor; - if (isatty(STDOUT_FILENO)) + if (_isatty) { cout << CLEARLN << s << " ["; // dont display percents if invalid @@ -141,11 +141,11 @@ static void display_progress ( const std::string & id, const string & s, int per // ---------------------------------------------------------------------------- -static void display_tick ( const std::string & id, const string & s) +void OutNormal::displayTick (const string & s) { static AliveCursor cursor; - if (isatty(STDOUT_FILENO)) + if (_isatty) { cout << CLEARLN << s << " [" << ++cursor << "]"; cout << std::flush; @@ -167,9 +167,9 @@ void OutNormal::progressStart(const std::string & id, cout << label << " ["; if (is_tick) - display_tick(id, label); + displayTick(label); else - display_progress(id, label, 0); + displayProgress(label, 0); _newline = false; } @@ -180,9 +180,9 @@ void OutNormal::progress(const std::string & id, const string & label, int value return; if (value) - display_progress(id, label, value); + displayProgress(label, value); else - display_tick(id, label); + displayTick(label); _newline = false; } diff --git a/src/output/OutNormal.h b/src/output/OutNormal.h index 8ac75cd..ed5dc75 100644 --- a/src/output/OutNormal.h +++ b/src/output/OutNormal.h @@ -75,6 +75,8 @@ protected: private: bool infoWarningFilter(Verbosity verbosity, Type mask); + void displayProgress(const std::string & s, int percent); + void displayTick(const std::string & s); bool _use_colors; bool _isatty; -- 2.7.4