Tag Parser: TagParser::AbstractAttachment Class Reference

Tag Parser 12.5.2 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
TagParser::AbstractAttachment Class Reference

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

`#include <abstractattachment.h>`

Inheritance diagram for TagParser::AbstractAttachment:
[legend]

## Public Member Functions
const std::string & | description () const
| Returns a description of the attachment.
void | setDescription (std::string_view description)
| Sets a description of the attachment.
const std::string & | name () const
| Returns the (file) name of the attachment.
void | setName (std::string_view name)
| Sets the (file) name of the attachment.
const std::string & | mimeType () const
| Returns the MIME-type of the attachment.
void | setMimeType (std::string_view mimeType)
| Sets the MIME-type of the attachment.
std::uint64_t | id () const
| Returns the ID of the attachment.
void | setId (std::uint64_t id)
| Sets the ID of the attachment.
const StreamDataBlock * | data () const
| Returns a reference to the data of the attachment.
void | setData (std::unique_ptr< StreamDataBlock > &&data)
| Sets the data for the attachment.
void | setFile (std::string_view path, Diagnostics &diag, AbortableProgressFeedback &progress)
| Sets the data, name and MIME-type for the specified path.
bool | isDataFromFile () const
| Returns whether the assigned data has been assigned using the setFile() method.
std::string | label () const
| Returns a label for the track.
void | clear ()
| Resets the object to its initial state.
bool | isIgnored () const
| Returns whether the attachment is ignored/omitted when rewriting the container.
void | setIgnored (bool ignored)
| Sets whether the attachment is ignored/omitted when rewriting the container.
bool | isEmpty () const
| Returns whether the attachment is empty (no data and no meta-data assigned).

## Protected Member Functions
| AbstractAttachment ()
| Constructs a new attachment.
virtual | ~AbstractAttachment ()
| Destroys the attachment.

## Detailed Description

The AbstractAttachment class parses and stores attachment information.

Definition at line 107 of file abstractattachment.h.

## Constructor & Destructor Documentation

## ◆ AbstractAttachment()

TagParser::AbstractAttachment::AbstractAttachment | ( |  | ) |
| explicitprotected

Constructs a new attachment.

Definition at line 136 of file abstractattachment.cpp.

## ◆ ~AbstractAttachment()

TagParser::AbstractAttachment::~AbstractAttachment | ( |  | ) |
| protectedvirtual

Destroys the attachment.

Definition at line 146 of file abstractattachment.cpp.

## Member Function Documentation

## ◆ clear()

void TagParser::AbstractAttachment::clear | ( |  | ) |

Resets the object to its initial state.

Definition at line 169 of file abstractattachment.cpp.

## ◆ data()

const StreamDataBlock * TagParser::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 213 of file abstractattachment.h.

## ◆ description()

const std::string & TagParser::AbstractAttachment::description | ( |  | ) | const
| inline

Returns a description of the attachment.

Definition at line 145 of file abstractattachment.h.

## ◆ id()

std::uint64_t TagParser::AbstractAttachment::id | ( |  | ) | const
| inline

Returns the ID of the attachment.

Definition at line 193 of file abstractattachment.h.

## ◆ isDataFromFile()

bool TagParser::AbstractAttachment::isDataFromFile | ( |  | ) | const
| inline

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

Definition at line 232 of file abstractattachment.h.

## ◆ isEmpty()

bool TagParser::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 262 of file abstractattachment.h.

## ◆ isIgnored()

bool TagParser::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 243 of file abstractattachment.h.

## ◆ label()

string TagParser::AbstractAttachment::label | ( |  | ) | const

Returns a label for the track.

Definition at line 153 of file abstractattachment.cpp.

## ◆ mimeType()

const std::string & TagParser::AbstractAttachment::mimeType | ( |  | ) | const
| inline

Returns the MIME-type of the attachment.

Definition at line 177 of file abstractattachment.h.

## ◆ name()

const std::string & TagParser::AbstractAttachment::name | ( |  | ) | const
| inline

Returns the (file) name of the attachment.

Definition at line 161 of file abstractattachment.h.

## ◆ setData()

void TagParser::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 223 of file abstractattachment.h.

## ◆ setDescription()

void TagParser::AbstractAttachment::setDescription | ( | std::string_view | description | ) |
| inline

Sets a description of the attachment.

Definition at line 153 of file abstractattachment.h.

## ◆ setFile()

void TagParser::AbstractAttachment::setFile | ( | std::string_view | path,
|  | Diagnostics & | diag,
|  | AbortableProgressFeedback & | progress )

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

  Throws | std::ios_base::failure when an IO error occurs.
  Throws | TagParser::Failure or a derived class when a parsing error occurs.

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

Definition at line 191 of file abstractattachment.cpp.

## ◆ setId()

void TagParser::AbstractAttachment::setId | ( | std::uint64_t | id | ) |
| inline

Sets the ID of the attachment.

Definition at line 201 of file abstractattachment.h.

## ◆ setIgnored()

void TagParser::AbstractAttachment::setIgnored | ( | bool | ignored | ) |
| inline

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

See also
  isIgnored()

Definition at line 253 of file abstractattachment.h.

## ◆ setMimeType()

void TagParser::AbstractAttachment::setMimeType | ( | std::string_view | mimeType | ) |
| inline

Sets the MIME-type of the attachment.

Definition at line 185 of file abstractattachment.h.

## ◆ setName()

void TagParser::AbstractAttachment::setName | ( | std::string_view | name | ) |
| inline

Sets the (file) name of the attachment.

Definition at line 169 of file abstractattachment.h.

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

- abstractattachment.h
- abstractattachment.cpp