MPD: TagBuilder Class Reference

MPD 0.20.18

Public Member Functions
TagBuilder Class Reference

A class that constructs Tag objects. More...

`#include <TagBuilder.hxx>`

## Public Member Functions
| TagBuilder ()
| Create an empty tag. More...
| ~TagBuilder ()
| TagBuilder (const TagBuilder &other)=delete
| TagBuilder (const Tag &other)
| TagBuilder (Tag &&other)
TagBuilder & | operator= (const TagBuilder &other)
TagBuilder & | operator= (TagBuilder &&other)
TagBuilder & | operator= (Tag &&other)
bool | IsEmpty () const
| Returns true if the tag contains no items. More...
gcc_pure bool | IsDefined () const noexcept
| Returns true if the object contains any information. More...
void | Clear ()
void | Commit (Tag &tag)
| Move this object to the given Tag instance. More...
Tag | Commit ()
| Create a new Tag instance from data in this object. More...
Tag * | CommitNew ()
| Create a new Tag instance from data in this object. More...
void | SetDuration (SignedSongTime _duration)
void | SetHasPlaylist (bool _has_playlist)
void | Reserve (unsigned n)
gcc_pure bool | HasType (TagType type) const noexcept
| Checks whether the tag contains one or more items with the specified type. More...
void | Complement (const Tag &other)
| Copy attributes and items from the other object that do not exist in this object. More...
gcc_nonnull_all void | AddItem (TagType type, StringView value)
| Appends a new tag item. More...
gcc_nonnull_all void | AddItem (TagType type, const char *value)
| Appends a new tag item. More...
void | AddEmptyItem (TagType type)
| Appends a new tag item with an empty value. More...
void | RemoveAll () noexcept
| Removes all tag items. More...
void | RemoveType (TagType type) noexcept
| Removes all tag items of the specified type. More...

## Detailed Description

A class that constructs Tag objects.

Definition at line 36 of file TagBuilder.hxx.

## Constructor & Destructor Documentation

## ◆ TagBuilder() [1/4]

TagBuilder::TagBuilder | ( |  | ) |
| inline

Create an empty tag.

Definition at line 56 of file TagBuilder.hxx.

## ◆ ~TagBuilder()

TagBuilder::~TagBuilder | ( |  | ) |
| inline

Definition at line 59 of file TagBuilder.hxx.

## ◆ TagBuilder() [2/4]

TagBuilder::TagBuilder | ( | const TagBuilder & | other | ) |
| delete

## ◆ TagBuilder() [3/4]

TagBuilder::TagBuilder | ( | const Tag & | other | ) |
| explicit

## ◆ TagBuilder() [4/4]

TagBuilder::TagBuilder | ( | Tag && | other | ) |
| explicit

## Member Function Documentation

## ◆ AddEmptyItem()

void TagBuilder::AddEmptyItem | ( | TagType | type | ) |

Appends a new tag item with an empty value.

Do not use this unless you know what you're doing - because usually, empty values are discarded.

## ◆ AddItem() [1/2]

gcc_nonnull_all void TagBuilder::AddItem | ( | TagType | type,
|  | StringView | value
| ) |  |

Appends a new tag item.

Parameters

  type | the type of the new tag item
  value | the value of the tag item (not null-terminated)
  length | the length of #value

## ◆ AddItem() [2/2]

gcc_nonnull_all void TagBuilder::AddItem | ( | TagType | type,
|  | const char * | value
| ) |  |

Appends a new tag item.

Parameters

  type | the type of the new tag item
  value | the value of the tag item (null-terminated)

## ◆ Clear()

void TagBuilder::Clear | ( |  | ) |

## ◆ Commit() [1/2]

void TagBuilder::Commit | ( | Tag & | tag | ) |

Move this object to the given Tag instance.

This object is empty afterwards.

## ◆ Commit() [2/2]

Tag TagBuilder::Commit | ( |  | ) |

Create a new Tag instance from data in this object.

This object is empty afterwards.

## ◆ CommitNew()

Tag* TagBuilder::CommitNew | ( |  | ) |

Create a new Tag instance from data in this object.

The returned object is owned by the caller. This object is empty afterwards.

## ◆ Complement()

void TagBuilder::Complement | ( | const Tag & | other | ) |

Copy attributes and items from the other object that do not exist in this object.

## ◆ HasType()

gcc_pure bool TagBuilder::HasType | ( | TagType | type | ) | const
| noexcept

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

## ◆ IsDefined()

gcc_pure bool TagBuilder::IsDefined | ( |  | ) | const
| inlinenoexcept

Returns true if the object contains any information.

Definition at line 85 of file TagBuilder.hxx.

## ◆ IsEmpty()

bool TagBuilder::IsEmpty | ( |  | ) | const
| inline

Returns true if the tag contains no items.

This ignores the "duration" attribute.

Definition at line 77 of file TagBuilder.hxx.

## ◆ operator=() [1/3]

TagBuilder& TagBuilder::operator= | ( | const TagBuilder & | other | ) |

## ◆ operator=() [2/3]

TagBuilder& TagBuilder::operator= | ( | TagBuilder && | other | ) |

## ◆ operator=() [3/3]

TagBuilder& TagBuilder::operator= | ( | Tag && | other | ) |

## ◆ RemoveAll()

void TagBuilder::RemoveAll | ( |  | ) |
| noexcept

Removes all tag items.

## ◆ RemoveType()

void TagBuilder::RemoveType | ( | TagType | type | ) |
| noexcept

Removes all tag items of the specified type.

## ◆ Reserve()

void TagBuilder::Reserve | ( | unsigned | n | ) |
| inline

Definition at line 118 of file TagBuilder.hxx.

## ◆ SetDuration()

void TagBuilder::SetDuration | ( | SignedSongTime | _duration | ) |
| inline

Definition at line 110 of file TagBuilder.hxx.

## ◆ SetHasPlaylist()

void TagBuilder::SetHasPlaylist | ( | bool | _has_playlist | ) |
| inline

Definition at line 114 of file TagBuilder.hxx.

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

- tag/TagBuilder.hxx