Tag Parser  8.0.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Public Member Functions | List of all members
TagParser::AbortableProgressFeedback Class Reference

The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks. More...

#include <progressfeedback.h>

Inheritance diagram for TagParser::AbortableProgressFeedback:
[legend]
Collaboration diagram for TagParser::AbortableProgressFeedback:
[legend]

Public Member Functions

 AbortableProgressFeedback (const Callback &callback, const Callback &percentageOnlyCallback=Callback())
 Constructs a new AbortableProgressFeedback. More...
 
 AbortableProgressFeedback (Callback &&callback, Callback &&percentageOnlyCallback=Callback())
 Constructs a new AbortableProgressFeedback. More...
 
bool isAborted () const
 Returns whether the operation has been aborted via tryToAbort(). More...
 
void tryToAbort ()
 Aborts the operation. More...
 
void stopIfAborted () const
 Throws an OperationAbortedException if aborted. More...
 
void nextStepOrStop (const std::string &step, byte stepPercentage=0)
 Throws an OperationAbortedException if aborted; otherwise the data for the next step is set. More...
 
void nextStepOrStop (std::string &&step, byte stepPercentage=0)
 Throws an OperationAbortedException if aborted; otherwise the data for the next step is set. More...
 
- Public Member Functions inherited from TagParser::BasicProgressFeedback< AbortableProgressFeedback >
 BasicProgressFeedback (const Callback &callback, const Callback &percentageOnlyCallback=Callback())
 Constructs a new BasicProgressFeedback. More...
 
 BasicProgressFeedback (Callback &&callback, Callback &&percentageOnlyCallback=Callback())
 Constructs a new BasicProgressFeedback. More...
 
const std::string & step () const
 Returns the name of the current step (initially empty). More...
 
byte stepPercentage () const
 Returns the percentage of the current step (initially 0, supposed to be a value from 0 to 100). More...
 
byte overallPercentage () const
 Returns the overall percentage (initially 0, supposed to be a value from 0 to 100). More...
 
void updateStep (const std::string &step, byte stepPercentage=0)
 Updates the current step and invokes the first callback specified on construction. More...
 
void updateStep (std::string &&step, byte stepPercentage=0)
 Updates the current step and invokes the first callback specified on construction. More...
 
void updateStepPercentage (byte stepPercentage)
 Updates the current step percentage and invokes the second callback specified on construction (or the first if only one has been specified). More...
 
void updateStepPercentageFromFraction (double stepPercentage)
 Updates the current step percentage and invokes the second callback specified on construction (or the first if only one has been specified). More...
 
void updateOverallPercentage (byte overallPercentage)
 Updates the overall percentage and invokes the second callback specified on construction (or the first if only one has been specified). More...
 

Additional Inherited Members

- Public Types inherited from TagParser::BasicProgressFeedback< AbortableProgressFeedback >
using Callback = std::function< void(AbortableProgressFeedback &feedback)>
 

Detailed Description

The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks.

It also allows to abort the operation.

Definition at line 185 of file progressfeedback.h.

Constructor & Destructor Documentation

◆ AbortableProgressFeedback() [1/2]

TagParser::AbortableProgressFeedback::AbortableProgressFeedback ( const Callback callback,
const Callback percentageOnlyCallback = Callback() 
)
inline

Constructs a new AbortableProgressFeedback.

It will call callback on the next step and percentageOnlyCallback when only the percentage changes.

Definition at line 205 of file progressfeedback.h.

◆ AbortableProgressFeedback() [2/2]

TagParser::AbortableProgressFeedback::AbortableProgressFeedback ( Callback &&  callback,
Callback &&  percentageOnlyCallback = Callback() 
)
inline

Constructs a new AbortableProgressFeedback.

It will call callback on the next step and percentageOnlyCallback when only the percentage changes.

Definition at line 216 of file progressfeedback.h.

Member Function Documentation

◆ isAborted()

bool TagParser::AbortableProgressFeedback::isAborted ( ) const
inline

Returns whether the operation has been aborted via tryToAbort().

Definition at line 225 of file progressfeedback.h.

◆ nextStepOrStop() [1/2]

void TagParser::AbortableProgressFeedback::nextStepOrStop ( const std::string &  status,
byte  percentage = 0 
)
inline

Throws an OperationAbortedException if aborted; otherwise the data for the next step is set.

Remarks
Supposed to be called only by the operation itself.

Definition at line 255 of file progressfeedback.h.

◆ nextStepOrStop() [2/2]

void TagParser::AbortableProgressFeedback::nextStepOrStop ( std::string &&  status,
byte  percentage = 0 
)
inline

Throws an OperationAbortedException if aborted; otherwise the data for the next step is set.

Remarks
Supposed to be called only by the operation itself.

Definition at line 267 of file progressfeedback.h.

◆ stopIfAborted()

void TagParser::AbortableProgressFeedback::stopIfAborted ( ) const
inline

Throws an OperationAbortedException if aborted.

Remarks
Supposed to be called only by the operation itself.

Definition at line 244 of file progressfeedback.h.

◆ tryToAbort()

void TagParser::AbortableProgressFeedback::tryToAbort ( )
inline

Aborts the operation.

Remarks
The operation will not be killed forcefully. It will be aborted at the next point where it makes sense or even finish if it makes no sense to abort.

Definition at line 235 of file progressfeedback.h.


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