| TagLib 1.13 |  |

Public Member Functions | List of all members
TagLib::FileRef::FileTypeResolver Class Referenceabstract

A class for pluggable file type resolution. More...

`#include <fileref.h>`

Inheritance diagram for TagLib::FileRef::FileTypeResolver:
[legend]

## Public Member Functions
virtual File * | createFile (FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0

## Detailed Description

A class for pluggable file type resolution.

This class is used to add extend TagLib's very basic file name based file type resolution.

This can be accomplished with:

class MyFileTypeResolver : FileTypeResolver
{
TagLib::File *createFile(TagLib::FileName *fileName, bool, AudioProperties::ReadStyle) const
{
if(someCheckForAnMP3File(fileName))
return new TagLib::MPEG::File(fileName);
return 0;
}
}
FileRef::addFileTypeResolver(new MyFileTypeResolver);
TagLib::AudioProperties::ReadStyle
ReadStyle
Definition: audioproperties.h:53
TagLib::FileRef::FileTypeResolver::createFile
virtual File * createFile(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
TagLib::FileRef::addFileTypeResolver
static const FileTypeResolver * addFileTypeResolver(const FileTypeResolver *resolver)
TagLib::File
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
TagLib::MPEG::File
An MPEG file class with some useful methods specific to MPEG.
Definition: mpegfile.h:56
TagLib::FileName
const char * FileName
Definition: tiostream.h:57

Naturally a less contrived example would be slightly more complex. This can be used to plug in mime-type detection systems or to add new file types to TagLib.

## Member Function Documentation

## ◆ createFile()

virtual File * TagLib::FileRef::FileTypeResolver::createFile | ( | FileName | fileName,
|  | bool | readAudioProperties = `true`,
|  | AudioProperties::ReadStyle | audioPropertiesStyle = `AudioProperties::Average`
| ) |  | const
| pure virtual

This method must be overridden to provide an additional file type resolver. If the resolver is able to determine the file type it should return a valid File object; if not it should return 0.

Note
  The created file is then owned by the FileRef and should not be deleted. Deletion will happen automatically when the FileRef passes out of scope.

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

- fileref.h