From 366a4bfe3f45311a4787369929afc3b4a9f37837 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Thu, 21 Jul 2005 18:10:10 +0000 Subject: [PATCH] Hmm, that last one wasn't really quite ready. Now we actually check our list of FileTypeResolvers. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@437391 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- fileref.cpp | 11 ++++++++++- fileref.h | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/fileref.cpp b/fileref.cpp index 6c12749d..58732656 100644 --- a/fileref.cpp +++ b/fileref.cpp @@ -132,6 +132,15 @@ bool FileRef::operator!=(const FileRef &ref) const File *FileRef::create(const char *fileName, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle) // static { + + List::ConstIterator it = FileRefPrivate::fileTypeResolvers.begin(); + + for(; it != FileRefPrivate::fileTypeResolvers.end(); ++it) { + File *file = (*it)->createFile(fileName, readAudioProperties, audioPropertiesStyle); + if(file) + return file; + } + // Ok, this is really dumb for now, but it works for testing. String s = fileName; @@ -145,7 +154,7 @@ File *FileRef::create(const char *fileName, bool readAudioProperties, return new FLAC::File(fileName, readAudioProperties, audioPropertiesStyle); if(s.substr(s.size() - 4, 4).upper() == ".MPC") return new MPC::File(fileName, readAudioProperties, audioPropertiesStyle); - } + } return 0; } diff --git a/fileref.h b/fileref.h index b4e64eea..2b6352b0 100644 --- a/fileref.h +++ b/fileref.h @@ -95,7 +95,10 @@ namespace TagLib { * deleted. Deletion will happen automatically when the FileRef passes * out of scope. */ - virtual File *createFile(const char *fileName) = 0; + virtual File *createFile(const char *fileName, + bool readAudioProperties = true, + AudioProperties::ReadStyle + audioPropertiesStyle = AudioProperties::Average) const = 0; }; FileRef();