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

The AbstractAttachment class parses and stores attachment information. More...

#include <abstractattachment.h>

Inheritance diagram for Media::AbstractAttachment:
[legend]
Collaboration diagram for Media::AbstractAttachment:
[legend]

Public Member Functions

const std::string & description () const
 Returns a description of the attachment. More...
 
void setDescription (const std::string &description)
 Sets a description of the attachment. More...
 
const std::string & name () const
 Returns the (file) name of the attachment. More...
 
void setName (const std::string &name)
 Sets the (file) name of the attachment. More...
 
const std::string & mimeType () const
 Returns the MIME-type of the attachment. More...
 
void setMimeType (const std::string &mimeType)
 Sets the MIME-type of the attachment. More...
 
uint64 id () const
 Returns the ID of the attachment. More...
 
void setId (const uint64 &id)
 Sets the ID of the attachment. More...
 
const StreamDataBlockdata () const
 Returns a reference to the data of the attachment. More...
 
void setData (std::unique_ptr< StreamDataBlock > &&data)
 Sets the data for the attachment. More...
 
void setFile (const std::string &path)
 Sets the data, name and MIME-type for the specified path. More...
 
bool isDataFromFile () const
 Returns whether the assigned data has been assigned using the setFile() method. More...
 
std::string label () const
 Returns a label for the track. More...
 
void clear ()
 Resets the object to its initial state. More...
 
bool isIgnored () const
 Returns whether the attachment is ignored/omitted when rewriting the container. More...
 
void setIgnored (bool ignored)
 Sets whether the attachment is ignored/omitted when rewriting the container. More...
 
bool isEmpty () const
 Returns whether the attachment is empty (no data and no meta-data assigned). More...
 
- Public Member Functions inherited from Media::StatusProvider
const NotificationListnotifications () 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...
 
StatusProviderusedProvider ()
 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 &notification)
 This protected 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 protected 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 protected 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 protected method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More...
 
void addNotifications (const NotificationList &notifications)
 This protected method is meant to be called by the derived class to add the specified notifications. More...
 

Protected Member Functions

 AbstractAttachment ()
 Constructs a new attachment. More...
 
- Protected Member Functions inherited from Media::StatusProvider
 StatusProvider ()
 Constructs a new StatusProvider. More...
 

Additional Inherited Members

- Public Types inherited from Media::StatusProvider
typedef std::function< void(StatusProvider &sender)> CallbackFunction
 
typedef std::vector< CallbackFunctionCallbackVector
 
typedef std::pair< int, CallbackFunctionCallbackPair
 

Detailed Description

The AbstractAttachment class parses and stores attachment information.

Definition at line 105 of file abstractattachment.h.

Constructor & Destructor Documentation

◆ AbstractAttachment()

Media::AbstractAttachment::AbstractAttachment ( )
inlineprotected

Constructs a new attachment.

Definition at line 142 of file abstractattachment.h.

Member Function Documentation

◆ clear()

void Media::AbstractAttachment::clear ( )

Resets the object to its initial state.

Definition at line 132 of file abstractattachment.cpp.

◆ data()

const StreamDataBlock * Media::AbstractAttachment::data ( ) const
inline

Returns a reference to the data of the attachment.

Remarks
  • The reference might be nullptr if there is no data assigned.
  • The attachment keeps ownership over the reference.
See also
setData(), setFile()

Definition at line 219 of file abstractattachment.h.

◆ description()

const std::string & Media::AbstractAttachment::description ( ) const
inline

Returns a description of the attachment.

Definition at line 151 of file abstractattachment.h.

◆ id()

uint64 Media::AbstractAttachment::id ( ) const
inline

Returns the ID of the attachment.

Definition at line 199 of file abstractattachment.h.

◆ isDataFromFile()

bool Media::AbstractAttachment::isDataFromFile ( ) const
inline

Returns whether the assigned data has been assigned using the setFile() method.

Definition at line 238 of file abstractattachment.h.

◆ isEmpty()

bool Media::AbstractAttachment::isEmpty ( ) const
inline

Returns whether the attachment is empty (no data and no meta-data assigned).

Remarks
Does not take into account whether an ID is set.

Definition at line 268 of file abstractattachment.h.

◆ isIgnored()

bool Media::AbstractAttachment::isIgnored ( ) const
inline

Returns whether the attachment is ignored/omitted when rewriting the container.

The default value is false.

See also
setIgnored()

Definition at line 249 of file abstractattachment.h.

◆ label()

string Media::AbstractAttachment::label ( ) const

Returns a label for the track.

Definition at line 116 of file abstractattachment.cpp.

◆ mimeType()

const std::string & Media::AbstractAttachment::mimeType ( ) const
inline

Returns the MIME-type of the attachment.

Definition at line 183 of file abstractattachment.h.

◆ name()

const std::string & Media::AbstractAttachment::name ( ) const
inline

Returns the (file) name of the attachment.

Definition at line 167 of file abstractattachment.h.

◆ setData()

void Media::AbstractAttachment::setData ( std::unique_ptr< StreamDataBlock > &&  data)
inline

Sets the data for the attachment.

Remarks
The specified data is moved to the attachment.
See also
data(), setFile()

Definition at line 229 of file abstractattachment.h.

◆ setDescription()

void Media::AbstractAttachment::setDescription ( const std::string &  description)
inline

Sets a description of the attachment.

Definition at line 159 of file abstractattachment.h.

◆ setFile()

void Media::AbstractAttachment::setFile ( const std::string &  path)

Sets the data, name and MIME-type for the specified path.

A stream for the file with the specified path is opened (read-only). This stream will be freed by the attachment if the other data is assigned or the attachment gets destroyed.

Exceptions
Throwsstd::ios_base::failure when an IO error occurs.
ThrowsMedia::Failure or a derived class when a parsing error occurs.

When such an exception is thrown, the attachment remains unchanged.

Definition at line 154 of file abstractattachment.cpp.

◆ setId()

void Media::AbstractAttachment::setId ( const uint64 &  id)
inline

Sets the ID of the attachment.

Definition at line 207 of file abstractattachment.h.

◆ setIgnored()

void Media::AbstractAttachment::setIgnored ( bool  ignored)
inline

Sets whether the attachment is ignored/omitted when rewriting the container.

See also
isIgnored()

Definition at line 259 of file abstractattachment.h.

◆ setMimeType()

void Media::AbstractAttachment::setMimeType ( const std::string &  mimeType)
inline

Sets the MIME-type of the attachment.

Definition at line 191 of file abstractattachment.h.

◆ setName()

void Media::AbstractAttachment::setName ( const std::string &  name)
inline

Sets the (file) name of the attachment.

Definition at line 175 of file abstractattachment.h.


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