fileref.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2003 by Scott Wheeler
00003     email                : wheeler@kde.org
00004  ***************************************************************************/
00005 
00006 /***************************************************************************
00007  *   This library is free software; you can redistribute it and/or modify  *
00008  *   it  under the terms of the GNU Lesser General Public License version  *
00009  *   2.1 as published by the Free Software Foundation.                     *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful, but   *
00012  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the Free Software   *
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00019  *   USA                                                                   *
00020  ***************************************************************************/
00021 
00022 #ifndef TAGLIB_FILEREF_H
00023 #define TAGLIB_FILEREF_H
00024 
00025 #include <tstringlist.h>
00026 
00027 #include "audioproperties.h"
00028 
00029 namespace TagLib {
00030 
00031   class String;
00032   class File;
00033   class Tag;
00034 
00036 
00055   class FileRef
00056   {
00057   public:
00058     
00060 
00088     class FileTypeResolver
00089     {
00090     public:
00100       virtual File *createFile(const char *fileName,
00101                                bool readAudioProperties = true,
00102                                AudioProperties::ReadStyle
00103                                audioPropertiesStyle = AudioProperties::Average) const = 0;
00104     };
00105 
00109     FileRef();
00110 
00120     explicit FileRef(const char *fileName,
00121                      bool readAudioProperties = true,
00122                      AudioProperties::ReadStyle
00123                      audioPropertiesStyle = AudioProperties::Average);
00124 
00129     explicit FileRef(File *file);
00130 
00134     FileRef(const FileRef &ref);
00135 
00139     virtual ~FileRef();
00140 
00149     Tag *tag() const;
00150 
00155     AudioProperties *audioProperties() const;
00156 
00172     File *file() const;
00173 
00177     bool save();
00178 
00191     static const FileTypeResolver *addFileTypeResolver(const FileTypeResolver *resolver);
00192 
00209     static StringList defaultFileExtensions();
00210 
00214     bool isNull() const;
00215 
00219     FileRef &operator=(const FileRef &ref);
00220 
00224     bool operator==(const FileRef &ref) const;
00225 
00230     bool operator!=(const FileRef &ref) const;
00231 
00243     static File *create(const char *fileName,
00244                         bool readAudioProperties = true,
00245                         AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
00246 
00247 
00248   private:
00249     class FileRefPrivate;
00250     FileRefPrivate *d;
00251   };
00252 
00253 } // namespace TagLib
00254 
00255 #endif