TagLib 1.4 (TagLib: TagLib::FileRef::FileTypeResolver Class Reference)

TagLib::FileRef::FileTypeResolver Class Reference

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

#include <fileref.h>

List of all members.

Public Member Functions

virtual FilecreateFile (const char *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(const char *fileName)
   {
     if(someCheckForAnMP3File(fileName))
       return new TagLib::MPEG::File(fileName);
     return 0;
   }
 }

 FileRef::addFileTypeResolver(new MyFileTypeResolver);

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

virtual File* TagLib::FileRef::FileTypeResolver::createFile ( const char *  fileName,
bool  readAudioProperties = true,
AudioProperties::ReadStyle  audioPropertiesStyle = AudioProperties::Average 
) const [pure virtual]

This method must be overriden 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: