TagLib API Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
TagLib::ID3v1::Tag Class Reference

The main class in the ID3v1 implementation. More...

#include <id3v1tag.h>

Inheritance diagram for TagLib::ID3v1::Tag:
[legend]
Collaboration diagram for TagLib::ID3v1::Tag:
[legend]

Public Member Functions

 Tag ()
 
 Tag (File *file, offset_t tagOffset)
 
 ~Tag () override
 
 Tag (const Tag &)=delete
 
Tagoperator= (const Tag &)=delete
 
ByteVector render () const
 
String title () const override
 
String artist () const override
 
String album () const override
 
String comment () const override
 
String genre () const override
 
unsigned int year () const override
 
unsigned int track () const override
 
void setTitle (const String &s) override
 
void setArtist (const String &s) override
 
void setAlbum (const String &s) override
 
void setComment (const String &s) override
 
void setGenre (const String &s) override
 
void setYear (unsigned int i) override
 
void setTrack (unsigned int i) override
 
unsigned int genreNumber () const
 
void setGenreNumber (unsigned int i)
 
- Public Member Functions inherited from TagLib::Tag
virtual ~Tag ()
 
 Tag (const Tag &)=delete
 
Tagoperator= (const Tag &)=delete
 
virtual PropertyMap properties () const
 
virtual void removeUnsupportedProperties (const StringList &properties)
 
virtual PropertyMap setProperties (const PropertyMap &origProps)
 
virtual StringList complexPropertyKeys () const
 
virtual List< VariantMapcomplexProperties (const String &key) const
 
virtual bool setComplexProperties (const String &key, const List< VariantMap > &value)
 
virtual String title () const =0
 
virtual String artist () const =0
 
virtual String album () const =0
 
virtual String comment () const =0
 
virtual String genre () const =0
 
virtual unsigned int year () const =0
 
virtual unsigned int track () const =0
 
virtual void setTitle (const String &s)=0
 
virtual void setArtist (const String &s)=0
 
virtual void setAlbum (const String &s)=0
 
virtual void setComment (const String &s)=0
 
virtual void setGenre (const String &s)=0
 
virtual void setYear (unsigned int i)=0
 
virtual void setTrack (unsigned int i)=0
 
virtual bool isEmpty () const
 

Static Public Member Functions

static ByteVector fileIdentifier ()
 
static void setStringHandler (const StringHandler *handler)
 
- Static Public Member Functions inherited from TagLib::Tag
static void duplicate (const Tag *source, Tag *target, bool overwrite=true)
 
static String joinTagValues (const StringList &values)
 

Protected Member Functions

void read ()
 
void parse (const ByteVector &data)
 
- Protected Member Functions inherited from TagLib::Tag
 Tag ()
 

Detailed Description

The main class in the ID3v1 implementation.

This is an implementation of the ID3v1 format. ID3v1 is both the simplest and most common of tag formats but is rather limited. Because of its pervasiveness and the way that applications have been written around the fields that it provides, the generic TagLib::Tag API is a mirror of what is provided by ID3v1.

ID3v1 tags should generally only contain Latin1 information. However because many applications do not follow this rule there is now support for overriding the ID3v1 string handling using the ID3v1::StringHandler class. Please see the documentation for that class for more information.

See also
StringHandler
Note
Most fields are truncated to a maximum of 28-30 bytes. The truncation happens automatically when the tag is rendered.

Constructor & Destructor Documentation

◆ Tag() [1/3]

TagLib::ID3v1::Tag::Tag ( )

Create an ID3v1 tag with default values.

◆ Tag() [2/3]

TagLib::ID3v1::Tag::Tag ( File file,
offset_t  tagOffset 
)

Create an ID3v1 tag and parse the data in file starting at tagOffset.

◆ ~Tag()

TagLib::ID3v1::Tag::~Tag ( )
overridevirtual

Destroys this Tag instance.

Reimplemented from TagLib::Tag.

◆ Tag() [3/3]

TagLib::ID3v1::Tag::Tag ( const Tag )
delete

Member Function Documentation

◆ album()

String TagLib::ID3v1::Tag::album ( ) const
overridevirtual

Returns the album name; if no album name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ artist()

String TagLib::ID3v1::Tag::artist ( ) const
overridevirtual

Returns the artist name; if no artist name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ comment()

String TagLib::ID3v1::Tag::comment ( ) const
overridevirtual

Returns the track comment; if no comment is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ fileIdentifier()

static ByteVector TagLib::ID3v1::Tag::fileIdentifier ( )
static

Returns the string "TAG" suitable for usage in locating the tag in a file.

◆ genre()

String TagLib::ID3v1::Tag::genre ( ) const
overridevirtual

Returns the genre name; if no genre is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ genreNumber()

unsigned int TagLib::ID3v1::Tag::genreNumber ( ) const

Returns the genre in number.

Note
Normally 255 indicates that this tag contains no genre.

◆ operator=()

Tag & TagLib::ID3v1::Tag::operator= ( const Tag )
delete

◆ parse()

void TagLib::ID3v1::Tag::parse ( const ByteVector data)
protected

Parses the body of the tag in data.

◆ read()

void TagLib::ID3v1::Tag::read ( )
protected

Reads from the file specified in the constructor.

◆ render()

ByteVector TagLib::ID3v1::Tag::render ( ) const

Renders the in memory values to a ByteVector suitable for writing to the file.

◆ setAlbum()

void TagLib::ID3v1::Tag::setAlbum ( const String s)
overridevirtual

Sets the album to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setArtist()

void TagLib::ID3v1::Tag::setArtist ( const String s)
overridevirtual

Sets the artist to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setComment()

void TagLib::ID3v1::Tag::setComment ( const String s)
overridevirtual

Sets the comment to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setGenre()

void TagLib::ID3v1::Tag::setGenre ( const String s)
overridevirtual

Sets the genre to s. If s is an empty string then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation.

Implements TagLib::Tag.

◆ setGenreNumber()

void TagLib::ID3v1::Tag::setGenreNumber ( unsigned int  i)

Sets the genre in number to i.

Note
Valid value is from 0 up to 255. Normally 255 indicates that this tag contains no genre.

◆ setStringHandler()

static void TagLib::ID3v1::Tag::setStringHandler ( const StringHandler handler)
static

Sets the string handler that decides how the ID3v1 data will be converted to and from binary data. If the parameter handler is null, the previous handler is released and default ISO-8859-1 handler is restored.

Note
The caller is responsible for deleting the previous handler as needed after it is released.
See also
StringHandler

◆ setTitle()

void TagLib::ID3v1::Tag::setTitle ( const String s)
overridevirtual

Sets the title to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setTrack()

void TagLib::ID3v1::Tag::setTrack ( unsigned int  i)
overridevirtual

Sets the track to i. If s is 0 then this value will be cleared.

Implements TagLib::Tag.

◆ setYear()

void TagLib::ID3v1::Tag::setYear ( unsigned int  i)
overridevirtual

Sets the year to i. If s is 0 then this value will be cleared.

Implements TagLib::Tag.

◆ title()

String TagLib::ID3v1::Tag::title ( ) const
overridevirtual

Returns the track name; if no track name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ track()

unsigned int TagLib::ID3v1::Tag::track ( ) const
overridevirtual

Returns the track number; if there is no track number set, this will return 0.

Implements TagLib::Tag.

◆ year()

unsigned int TagLib::ID3v1::Tag::year ( ) const
overridevirtual

Returns the year; if there is no year set, this will return 0.

Implements TagLib::Tag.


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