/usr/include/libProgressBar-1.2.0/progressBar.h is in libgkarrays-dev 2.1.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | /******************************************************************************
* *
* Copyright © 2007 -- Université de Antilles et de la Guyane *
* Copyright © 2007 -- Institut National de Recherche en Informatique *
* et en Automatique *
* *
* Author: DoccY <alban.mancheron@inria.fr> *
* *
* This File initially comes from StatiSTARS. *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Library General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public *
* License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; if not, write: *
* *
* the Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, *
* Boston, MA 02111-1307, USA. *
* *
******************************************************************************/
/*
* =============================================
*
* $Id: progressBar.h,v 1.4 2013/11/29 16:46:35 doccy Exp $
*
* ---------------------------------------------
*
* $Log: progressBar.h,v $
* Revision 1.4 2013/11/29 16:46:35 doccy
* Update:
* - Time display enhancement.
* - Allows systems without tex distribution to install the library (doc is just not built).
* - Add a method/constructor option to add/set an initial a value to the timer.
* - Add a 'C' function to get version number.
*
* Revision 1.3 2007/09/27 14:40:50 mancheron
* Ajout de la méthode GetTime() qui permet de récupérer le temps
* écoulé (en s.) depuis le début du processus en progrès.
*
* Revision 1.2 2007-09-09 21:16:29 mancheron
* Modulation de l'affichage (avec ou sans temps/pourcentage).
*
* Revision 1.1 2007-08-15 16:36:23 mancheron
* *** empty log message ***
*
* =============================================
*
*/
#ifndef __PROGRESSBAR_H
#define __PROGRESSBAR_H
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <ctime>
#include <config.h>
using namespace std;
/**
* @Namespace DoccY
* For my personal convenience, I have decided to put all my C++ contributions
* (at this time, it is the only one...) in this namespace.
*/
namespace DoccY {
extern "C" {
/* One can use this function to test the library availability */
char *libProgressBarVersion();
}
/**
* Class ProgressBar.
* @Author DoccY <alban.mancheron@inria.fr>
* @Copyright © 2007 --
* Université de Antilles et de la Guyane
* Institut National de Recherche en Informatique et en Automatique
* @brief A C++ class to manage... progress bars.
*/
class ProgressBar {
private:
/**
* Symbol used for show the progression (default: '=').
*/
const char symbol;
/**
* Starting delimiter (default: '[').
*/
const char delim1;
/**
* Ending delimiter (default: ']').
*/
const char delim2;
/**
* ProgressBar Title.
*/
const string title;
/**
* Current value of the process.
*/
unsigned int val;
/**
* Max value (at the end of the process).
*/
const unsigned int max_val;
/**
* Width of the progress bar.
* This parameter must be large enough to write the title
* and the optional time and percents (@see display).
*/
const unsigned int width;
/**
* Output stream to display the progress bar.
*/
ostream &output;
/**
* Starting time of the process.
*/
clock_t start;
/**
* Optional informations to display:
* if (display & 1), then show percents;
* if (display & 2), then show consumed time.
*/
unsigned char display;
public:
/**
* Constructor (standard)
* @param t ProgressBar title (@see title).
* @param m Max value at the end of the process (@see max_val).
* @param w Width of the Progress Bar (@see width).
* @param os Output stream to display the progress bar (@see output)
* [default: ios::cerr].
* @param startnewline Tell if the progress bar starts by an new line
* [default: true]. This parameter is usefull when
* managing many progress bars.
* @param start Set starting time to this value (in seconds) [default: 0].
*/
ProgressBar(const string &t, const unsigned int m, const unsigned int w, ostream &os = cerr, bool startnewline = true, clock_t start = 0);
/**
* Constructor (custom)
* @param s Symbol used for show the progression (@see symbol)
* [default: '='].
* @param d1 Starting delimiter (@see delim1) [default: '['].
* @param d2 Ending delimiter (@see delim2) [default: '['].
* @param t ProgressBar title (@see title) [default: "ProgressBar"].
* @param v Initial value at the begining of the process (@see val)
* [default: 0].
* @param m Max value at the end of the process (@see max_val)
* [default: 100].
* @param w Width of the Progress Bar (@see width) [default: 80].
* @param os Output stream to display the progress bar (@see output)
* [default: ios::cerr].
* @param startnewline Tell if the progress bar starts by an new line
* [default: true]. This parameter is usefull when
* managing many progress bars.
* @param start Set starting time to this value (in seconds) [default: 0].
*/
ProgressBar(const char s = '=', const char d1 = '[', const char d2 = ']',
const string &t = "ProgressBar",
unsigned int v = 0, const unsigned int m = 100, const unsigned int w = 80,
ostream &os = cerr, bool startnewline = true, clock_t start = 0);
/**
* Destructor
*/
~ProgressBar();
/**
* Enable percentage display (@see display).
*/
void ShowPercent();
/**
* Disable percentage display (@see display).
*/
void HidePercent();
/**
* Enable consumed time display (@see display).
*/
void ShowTime();
/**
* Disable consumed time display (@see display).
*/
void HideTime();
/**
* Get consumed time in seconds (@see start).
*/
double GetTime() const;
/**
* Add sec seconds to expanded time (@see start).
*/
void AddTime(clock_t sec);
/**
* Reset the progress bar (@see val, @see start).
*/
void Reset();
/**
* Set the current value of the process.
* @param v The current value (@see val).
* @param update Refresh the progress bar display.
*/
void SetVal(unsigned int v, bool update = false);
/**
* Increment by one the current value of the process
* (@see val).
* @param update Refresh the progress bar display.
*/
void Step(bool update = true);
/**
* Refresh the progress bar display.
* @param goback If true, rewind the cursor at the
* beginning of the progress bar.
*/
void update(bool goback = true) const;
/**
* Clear the progress bar from the display. This
* doesn't reset either the timer, or the current
* value!!!
*/
void clear() const;
/**
* Fill the progress bar with some symbol.
* @param c Symbol used to fill the progress bar
* [default: ' '].
*/
void fill(const char c = ' ') const;
}; /* Fin ProgressBar */
} /* Fin espace de nom DoccY */
#endif /* __PROGRESSBAR_H */
// Local Variables:
// mode:c++
// End:
|