This file is indexed.

/usr/include/tjutils/tjfeedback.h is in libodin-dev 1.8.8-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
/***************************************************************************
                          tjfeedback.h  -  description
                             -------------------
    begin                : Fri Jun 6 2003
    copyright            : (C) 2000-2014 by Thies Jochimsen
    email                : thies@jochimsen.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef TJFEEDBACK_H
#define TJFEEDBACK_H

#include <tjutils/tjutils.h>
#include <tjutils/tjthread.h>


/**
  * @addtogroup tjutils
  * @{
  */


/**
  *
  *  Base class for all display drivers of a progress, e.g. console, widget, ...
  */
class ProgressDisplayDriver {

 public:

  virtual ~ProgressDisplayDriver() {}

/**
  * Initializes the driver to display to expect 'nsteps' calls to 'increase()'.
  * The message 'txt' will be displayed prior to the progress report.
  */
  virtual void init(unsigned int nsteps, const char* txt) = 0;

/**
  * Increments progress display.
  * The message 'subj', if non-null, will be displayed.
  */
  virtual void increase(const char* subj) = 0;

/**
  * Refreshes display without increasing progress.
  * Returns true if cancel is requested by the driver.
  */
  virtual bool refresh() = 0;

};

//////////////////////////////////////////////////////


/**
  *
  * Class to preset the progress of an operation to the user.
  * The implementation is thread-safe.
  */
class ProgressMeter {

 public:

/**
  * Creates progress meter using display driver 'disp' which should
  * exist for the whole life time of the progress meter.
  */
  ProgressMeter(ProgressDisplayDriver& disp) : display(&disp) {}

/**
  * Initialize new task with 'total_steps' increments.
  * The message 'txt' will be displayed prior to the progress report.
  */
  ProgressMeter& new_task(unsigned int total_steps, const char* txt = 0);

/**
  * Increments progress display.
  * The message 'subj', if non-null, will be displayed.
  * Returns true if cancel is requested by the driver.
  */
  bool increase_counter(const char* subj = 0);

/**
  * Refreshes display without increasing progress.
  * Returns true if cancel is requested by the driver.
  */
  bool refresh_display();


 private:

  // disable copy construction and copying
  ProgressMeter(const ProgressMeter&) {}
  ProgressMeter& operator = (const ProgressMeter&) {return *this;}

  ProgressDisplayDriver* display;
  Mutex mutex;


};


//////////////////////////////////////////////////////

#ifndef NO_CMDLINE

class ProgressDisplayConsole : public virtual ProgressDisplayDriver {

 public:
  ProgressDisplayConsole() : counter(0), nsteps_cache(0), done(false) {}

  // Implementing virtual functions of ProgressDisplayDriver
  void init(unsigned int nsteps, const char* txt);
  void increase(const char*);
  bool refresh() {return false;}

 private:
  unsigned int counter, nsteps_cache, old_perc;
  bool done;
};

#endif

/** @}
  */
#endif