MPD  0.20.15
Data Structures | Public Member Functions | Static Public Member Functions | Data Fields
Tag Struct Reference

The meta information about a song file. More...

#include <Tag.hxx>

Collaboration diagram for Tag:
[legend]

Data Structures

class  const_iterator
 

Public Member Functions

 Tag ()
 Create an empty tag. More...
 
 Tag (const Tag &other)
 
 Tag (Tag &&other)
 
 ~Tag ()
 Free the tag object and all its items. More...
 
Tagoperator= (const Tag &other)=delete
 
Tagoperator= (Tag &&other)
 
void MoveItemsFrom (Tag &&other)
 Similar to the move operator, but move only the TagItem array. More...
 
bool IsEmpty () const
 Returns true if the tag contains no items. More...
 
bool IsDefined () const
 Returns true if the tag contains any information. More...
 
void Clear ()
 Clear everything, as if this was a new Tag object. More...
 
gcc_pure const char * GetValue (TagType type) const noexcept
 Returns the first value of the specified tag type, or nullptr if none is present in this tag object. More...
 
gcc_pure bool HasType (TagType type) const noexcept
 Checks whether the tag contains one or more items with the specified type. More...
 
const_iterator begin () const
 
const_iterator end () const
 

Static Public Member Functions

static gcc_malloc TagMerge (const Tag &base, const Tag &add)
 Merges the data from two tags. More...
 
static gcc_malloc TagMergeReplace (Tag *base, Tag *add)
 Merges the data from two tags. More...
 

Data Fields

SignedSongTime duration
 The duration of the song. More...
 
bool has_playlist
 Does this file have an embedded playlist (e.g. More...
 
unsigned short num_items
 the total number of tag items in the items array More...
 
TagItem ** items
 an array of tag items More...
 

Detailed Description

The meta information about a song file.

It is a MPD specific subset of tags (e.g. from ID3, vorbis comments, ...).

Definition at line 34 of file Tag.hxx.

Constructor & Destructor Documentation

◆ Tag() [1/3]

Tag::Tag ( )
inline

Create an empty tag.

Definition at line 56 of file Tag.hxx.

◆ Tag() [2/3]

Tag::Tag ( const Tag other)

◆ Tag() [3/3]

Tag::Tag ( Tag &&  other)
inline

Definition at line 61 of file Tag.hxx.

◆ ~Tag()

Tag::~Tag ( )
inline

Free the tag object and all its items.

Definition at line 71 of file Tag.hxx.

Member Function Documentation

◆ begin()

const_iterator Tag::begin ( ) const
inline

Definition at line 190 of file Tag.hxx.

◆ Clear()

void Tag::Clear ( )

Clear everything, as if this was a new Tag object.

◆ end()

const_iterator Tag::end ( ) const
inline

Definition at line 194 of file Tag.hxx.

◆ GetValue()

gcc_pure const char* Tag::GetValue ( TagType  type) const
noexcept

Returns the first value of the specified tag type, or nullptr if none is present in this tag object.

◆ HasType()

gcc_pure bool Tag::HasType ( TagType  type) const
noexcept

Checks whether the tag contains one or more items with the specified type.

◆ IsDefined()

bool Tag::IsDefined ( ) const
inline

Returns true if the tag contains any information.

Definition at line 104 of file Tag.hxx.

◆ IsEmpty()

bool Tag::IsEmpty ( ) const
inline

Returns true if the tag contains no items.

This ignores the "duration" attribute.

Definition at line 97 of file Tag.hxx.

◆ Merge()

static gcc_malloc Tag* Tag::Merge ( const Tag base,
const Tag add 
)
static

Merges the data from two tags.

If both tags share data for the same TagType, only data from "add" is used.

Returns
a newly allocated tag

◆ MergeReplace()

static gcc_malloc Tag* Tag::MergeReplace ( Tag base,
Tag add 
)
static

Merges the data from two tags.

Any of the two may be nullptr. Both are freed by this function.

Returns
a newly allocated tag

◆ MoveItemsFrom()

void Tag::MoveItemsFrom ( Tag &&  other)
inline

Similar to the move operator, but move only the TagItem array.

Definition at line 88 of file Tag.hxx.

◆ operator=() [1/2]

Tag& Tag::operator= ( const Tag other)
delete

◆ operator=() [2/2]

Tag& Tag::operator= ( Tag &&  other)
inline

Definition at line 77 of file Tag.hxx.

Field Documentation

◆ duration

SignedSongTime Tag::duration

The duration of the song.

A negative value means that the length is unknown.

Definition at line 39 of file Tag.hxx.

◆ has_playlist

bool Tag::has_playlist

Does this file have an embedded playlist (e.g.

embedded CUE sheet)?

Definition at line 45 of file Tag.hxx.

◆ items

TagItem** Tag::items

an array of tag items

Definition at line 51 of file Tag.hxx.

◆ num_items

unsigned short Tag::num_items

the total number of tag items in the items array

Definition at line 48 of file Tag.hxx.


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