Diana Software
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
QProgressBar Class Reference

one-line description of your QObject More...

Inheritance diagram for QProgressBar:

Public Member Functions

 QProgressBar (uint64_t total_iterations, string description="Progress", bool leave=true, int step=1, bool enable=true, std::ostream &out=std::cout)
 
 QProgressBar (const QProgressBar &other)
 
 QProgressBar ()
 
 ~QProgressBar ()
 
void Clear ()
 clear members More...
 
void SetIterations (uint64_t total_iterations)
 
void SetDescription (string description)
 
void IncrementIter (bool printbar=true)
 
void Print (string message, bool isbar=false) const
 
QProgressBaroperator= (const QProgressBar &other)
 

Protected Attributes

std::ostream & foutstream
 

Private Member Functions

void get_terminal_size ()
 
void PrintBar ()
 
 QObjectDef (QProgressBar, 2)
 

Private Attributes

bool fleave
 
uint64_t fNumOfIters
 
uint64_t fCurrentIter
 
uint64_t fstep
 
string fdesc
 
std::ostringstream bar
 
size_t terminalwidth
 
bool fEnabled
 

Detailed Description

one-line description of your QObject

Author
Giorgio

Simple Implementation of a progress bar in c++ Usage: int numIter=1000; QProgressBar chbar((uint64_t)numIter,"MyDescription",true,1);//the last three arguments are optional for(int i=0;i<numIter;i++){ <dosomething>; if(condition){ chbar.Print("MyMessage");//Way to print messages without breaking the charging bar } chbar.IncrementIter(); }

Definition at line 34 of file QProgressBar.hh.

Constructor & Destructor Documentation

◆ QProgressBar() [1/3]

QProgressBar::QProgressBar ( uint64_t  total_iterations,
string  description = "Progress",
bool  leave = true,
int  step = 1,
bool  enable = true,
std::ostream &  out = std::cout 
)
inline

◆ QProgressBar() [2/3]

QProgressBar::QProgressBar ( const QProgressBar other)
inline

Definition at line 51 of file QProgressBar.hh.

◆ QProgressBar() [3/3]

QProgressBar::QProgressBar ( )
inline

Definition at line 56 of file QProgressBar.hh.

References Clear().

◆ ~QProgressBar()

QProgressBar::~QProgressBar ( )
inline

Definition at line 62 of file QProgressBar.hh.

References Clear().

Member Function Documentation

◆ Clear()

void QProgressBar::Clear ( )
inline

clear members

Definition at line 64 of file QProgressBar.hh.

References fCurrentIter, fdesc, fEnabled, fleave, fNumOfIters, foutstream, fstep, get_terminal_size(), and terminalwidth.

Referenced by QProgressBar(), and ~QProgressBar().

◆ get_terminal_size()

void QProgressBar::get_terminal_size ( )
inlineprivate

Definition at line 143 of file QProgressBar.hh.

References terminalwidth.

Referenced by Clear(), operator=(), and QProgressBar().

◆ IncrementIter()

void QProgressBar::IncrementIter ( bool  printbar = true)
inline

Definition at line 91 of file QProgressBar.hh.

References fCurrentIter, fEnabled, fleave, fNumOfIters, foutstream, fstep, PrintBar(), and terminalwidth.

◆ operator=()

QProgressBar& QProgressBar::operator= ( const QProgressBar other)
inline

Definition at line 128 of file QProgressBar.hh.

References bar, fCurrentIter, fdesc, fEnabled, fleave, fNumOfIters, and get_terminal_size().

◆ Print()

void QProgressBar::Print ( string  message,
bool  isbar = false 
) const
inline

Definition at line 112 of file QProgressBar.hh.

References bar, fEnabled, foutstream, and terminalwidth.

Referenced by PrintBar().

◆ PrintBar()

void QProgressBar::PrintBar ( )
inlineprivate

Definition at line 154 of file QProgressBar.hh.

References bar, fCurrentIter, fdesc, fNumOfIters, Print(), and terminalwidth.

Referenced by IncrementIter().

◆ QObjectDef()

QProgressBar::QObjectDef ( QProgressBar  ,
 
)
private

◆ SetDescription()

void QProgressBar::SetDescription ( string  description)
inline

Definition at line 89 of file QProgressBar.hh.

References fdesc.

Referenced by QProgressBar().

◆ SetIterations()

void QProgressBar::SetIterations ( uint64_t  total_iterations)
inline

Definition at line 82 of file QProgressBar.hh.

References fNumOfIters, and fstep.

Referenced by QProgressBar().

Member Data Documentation

◆ bar

std::ostringstream QProgressBar::bar
private

Definition at line 182 of file QProgressBar.hh.

Referenced by operator=(), Print(), and PrintBar().

◆ fCurrentIter

uint64_t QProgressBar::fCurrentIter
private

Definition at line 177 of file QProgressBar.hh.

Referenced by Clear(), IncrementIter(), operator=(), and PrintBar().

◆ fdesc

string QProgressBar::fdesc
private

Definition at line 180 of file QProgressBar.hh.

Referenced by Clear(), operator=(), PrintBar(), and SetDescription().

◆ fEnabled

bool QProgressBar::fEnabled
private

Definition at line 184 of file QProgressBar.hh.

Referenced by Clear(), IncrementIter(), operator=(), Print(), and QProgressBar().

◆ fleave

bool QProgressBar::fleave
private

Definition at line 174 of file QProgressBar.hh.

Referenced by Clear(), IncrementIter(), operator=(), and QProgressBar().

◆ fNumOfIters

uint64_t QProgressBar::fNumOfIters
private

Definition at line 176 of file QProgressBar.hh.

Referenced by Clear(), IncrementIter(), operator=(), PrintBar(), and SetIterations().

◆ foutstream

std::ostream& QProgressBar::foutstream
protected

Definition at line 140 of file QProgressBar.hh.

Referenced by Clear(), IncrementIter(), and Print().

◆ fstep

uint64_t QProgressBar::fstep
private

Definition at line 178 of file QProgressBar.hh.

Referenced by Clear(), IncrementIter(), QProgressBar(), and SetIterations().

◆ terminalwidth

size_t QProgressBar::terminalwidth
private

Definition at line 183 of file QProgressBar.hh.

Referenced by Clear(), get_terminal_size(), IncrementIter(), Print(), and PrintBar().


The documentation for this class was generated from the following file: