Tag Parser
6.4.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
The StatusProvider class acts as a base class for objects providing status information. More...
#include <statusprovider.h>
Public Types | |
typedef std::function< void(StatusProvider &sender)> | CallbackFunction |
typedef std::vector< CallbackFunction > | CallbackVector |
typedef std::pair< int, CallbackFunction > | CallbackPair |
Public Member Functions | |
const NotificationList & | notifications () const |
Returns notifications for the current object. More... | |
bool | hasNotifications () const |
Returns an indication whether there are notifications for the current object. More... | |
bool | hasCriticalNotifications () const |
Returns an indication whether there are critical notifications for the current object. More... | |
NotificationType | worstNotificationType () const |
Returns the worst notification type. More... | |
const std::string & | currentStatus () const |
Returns a status information for the current object. More... | |
double | currentPercentage () const |
Returns the progress percentage of the current object. More... | |
size_t | registerCallback (CallbackFunction callback) |
Registers a callback function. More... | |
void | unregisterCallback (size_t id) |
Unregisters a previously registered callback function whith the specified id. More... | |
void | unregisterAllCallbacks () |
Unregisters all callback functions. More... | |
void | forwardStatusUpdateCalls (StatusProvider *other=nullptr) |
Forwards all status updates calls to the specified statusProvider. More... | |
StatusProvider * | usedProvider () |
Returns the provider which callback functions will be called when the status or the percentage is updated. More... | |
void | tryToAbort () |
Commands the object to abort the current operation. More... | |
bool | isAborted () const |
Returns an indication whether the current operation should be aborted. More... | |
void | invalidateStatus () |
Invalidates the current status. More... | |
void | invalidateNotifications () |
Invalidates the object's notifications. More... | |
void | updateStatus (const std::string &status) |
This method is meant to be called by the derived class to report updated status information. More... | |
void | updateStatus (const std::string &status, double percentage) |
This method is meant to be called by the derived class to report updated status information. More... | |
void | updatePercentage (double percentage) |
This method is meant to be called by the derived class to report updated progress percentage only. More... | |
void | addNotification (const Notification ¬ification) |
This method is meant to be called by the derived class to add a notification. More... | |
void | addNotification (NotificationType type, const std::string &message, const std::string &context) |
This method is meant to be called by the derived class to add a notification of the specified type, message and context. More... | |
void | addNotifications (const StatusProvider &from) |
This method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More... | |
void | addNotifications (const std::string &higherContext, const StatusProvider &from) |
This method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More... | |
void | addNotifications (const NotificationList ¬ifications) |
This method is meant to be called by the derived class to add the specified notifications. More... | |
Protected Member Functions | |
StatusProvider () | |
Constructs a new StatusProvider. More... | |
Friends | |
class | MediaFileInfo |
The StatusProvider class acts as a base class for objects providing status information.
Definition at line 13 of file statusprovider.h.
typedef std::function<void (StatusProvider &sender)> Media::StatusProvider::CallbackFunction |
Definition at line 19 of file statusprovider.h.
typedef std::pair<int, CallbackFunction> Media::StatusProvider::CallbackPair |
Definition at line 21 of file statusprovider.h.
typedef std::vector<CallbackFunction> Media::StatusProvider::CallbackVector |
Definition at line 20 of file statusprovider.h.
|
protected |
Constructs a new StatusProvider.
Since the class is meant to be used as base class the constructor is protected.
Definition at line 20 of file statusprovider.cpp.
void Media::StatusProvider::addNotification | ( | const Notification & | notification | ) |
This method is meant to be called by the derived class to add a notification.
Definition at line 53 of file statusprovider.cpp.
void Media::StatusProvider::addNotification | ( | NotificationType | type, |
const std::string & | message, | ||
const std::string & | context | ||
) |
This method is meant to be called by the derived class to add a notification of the specified type, message and context.
Definition at line 64 of file statusprovider.cpp.
void Media::StatusProvider::addNotifications | ( | const StatusProvider & | from | ) |
This method is meant to be called by the derived class to add all notifications from another StatusProvider instance.
Definition at line 75 of file statusprovider.cpp.
void Media::StatusProvider::addNotifications | ( | const std::string & | higherContext, |
const StatusProvider & | from | ||
) |
This method is meant to be called by the derived class to add all notifications from another StatusProvider instance.
The specified higherContext is concatenated with the original context string.
Definition at line 91 of file statusprovider.cpp.
void Media::StatusProvider::addNotifications | ( | const NotificationList & | notifications | ) |
This method is meant to be called by the derived class to add the specified notifications.
Definition at line 104 of file statusprovider.cpp.
|
inline |
Returns the progress percentage of the current object.
Definition at line 152 of file statusprovider.h.
|
inline |
Returns a status information for the current object.
Definition at line 141 of file statusprovider.h.
|
inline |
Forwards all status updates calls to the specified statusProvider.
Not the callback methods associated to the current instance will be called to inform about status updates. Instead the callback methods associated to the specified instance will be called.
The current instance is still the sender.
The current instance is considered as abortet if the specified provider is abortet even if tryToAbort() has not been called.
The current instance will return the status and percentage of the specified provider if it provides no own status or percentage.
Provide nullptr to revert to the default behaviour.
Definition at line 214 of file statusprovider.h.
|
inline |
Returns an indication whether there are critical notifications for the current object.
Definition at line 125 of file statusprovider.h.
|
inline |
Returns an indication whether there are notifications for the current object.
Definition at line 117 of file statusprovider.h.
|
inline |
Invalidates the object's notifications.
All notifications will be wiped.
Definition at line 252 of file statusprovider.h.
|
inline |
Invalidates the current status.
The status, the progress percentage and the "aborted"-flag will be wiped. It is recommend to call this method before performing an operation.
This method is meant to be called by the derived class before performing operations to wipe possibly still present previous/obsolet status information.
Definition at line 240 of file statusprovider.h.
|
inline |
Returns an indication whether the current operation should be aborted.
This can be tested when implementing an operation that should be able to be aborted.
Definition at line 166 of file statusprovider.h.
|
inline |
Returns notifications for the current object.
Definition at line 109 of file statusprovider.h.
size_t Media::StatusProvider::registerCallback | ( | CallbackFunction | callback | ) |
Registers a callback function.
This function will be called when the status/progress changes.
callback | Specifies the function to be called. |
Definition at line 36 of file statusprovider.cpp.
|
inline |
Commands the object to abort the current operation.
If the object is currently not operating calling this method has no effect.
The current operation might not be stopped immediately.
Definition at line 226 of file statusprovider.h.
|
inline |
Unregisters all callback functions.
Definition at line 189 of file statusprovider.h.
|
inline |
Unregisters a previously registered callback function whith the specified id.
id | Specifies the ID of the callback to be unregistered. |
Definition at line 177 of file statusprovider.h.
|
inline |
This method is meant to be called by the derived class to report updated progress percentage only.
The specified percentage should be a value between 0 and 1.
Definition at line 90 of file statusprovider.h.
|
inline |
This method is meant to be called by the derived class to report updated status information.
Definition at line 67 of file statusprovider.h.
|
inline |
This method is meant to be called by the derived class to report updated status information.
The specified progress percentage should be a value between 0 and 1.
Definition at line 78 of file statusprovider.h.
|
inline |
Returns the provider which callback functions will be called when the status or the percentage is updated.
The default is the current instance. This can be changed using the forwardStatusUpdateCalls() method.
Definition at line 101 of file statusprovider.h.
|
inline |
Returns the worst notification type.
Definition at line 133 of file statusprovider.h.
|
friend |
Definition at line 16 of file statusprovider.h.