Implement progress output
This commit is contained in:
@@ -35,6 +35,9 @@ namespace IO {
|
||||
//! Returns true, if EOF is reached, and there are no more blocks to fetch (GetNextBlock())
|
||||
static bool IsFinished();
|
||||
|
||||
//! Returns how many blocks have been read, in total
|
||||
static std::size_t NBlocksRead();
|
||||
|
||||
private:
|
||||
static std::istream* in;
|
||||
|
||||
@@ -57,6 +60,9 @@ namespace IO {
|
||||
// Are we reading ciphertext or regular text?
|
||||
static bool isReadingCiphertext;
|
||||
|
||||
// How many blocks have been read in total
|
||||
static std::size_t nBlocksRead;
|
||||
|
||||
// All read blocks, that haven't been given out yet
|
||||
static std::queue<Block> blocks;
|
||||
|
||||
|
23
GCryptCLI/include/ProgressPrinter.h
Normal file
23
GCryptCLI/include/ProgressPrinter.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef GCRYPTCLI_PROGRESSPRINTER_H
|
||||
#define GCRYPTCLI_PROGRESSPRINTER_H
|
||||
|
||||
#include <iostream>
|
||||
#include "CommandlineInterface.h"
|
||||
|
||||
// This class has the task to output progress to stderr, if requested
|
||||
class ProgressPrinter {
|
||||
public:
|
||||
//! Will print progress to stderr, if requested, and the interval matches
|
||||
static void PrintIfAppropriate(
|
||||
const std::string& message,
|
||||
const std::size_t current,
|
||||
const std::size_t target
|
||||
);
|
||||
|
||||
private:
|
||||
// No instanciation! >:(
|
||||
ProgressPrinter() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef GCRYPTCLI_VERSION_H
|
||||
#define GCRYPTCLI_VERSION_H
|
||||
|
||||
#define GCRYPTCLI_VERSION 0.125
|
||||
#define GCRYPTCLI_VERSION 0.1251
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user