fileref.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2002 - 2008 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  *   Alternatively, this file is available under the Mozilla Public        *
00022  *   License Version 1.1.  You may obtain a copy of the License at         *
00023  *   http://www.mozilla.org/MPL/                                           *
00024  ***************************************************************************/
00025 
00026 #ifndef TAGLIB_FILEREF_H
00027 #define TAGLIB_FILEREF_H
00028 
00029 #include "tfile.h"
00030 #include "tstringlist.h"
00031 
00032 #include "taglib_export.h"
00033 #include "audioproperties.h"
00034 
00035 namespace TagLib {
00036 
00037   class Tag;
00038 
00040 
00059   class TAGLIB_EXPORT FileRef
00060   {
00061   public:
00062 
00064 
00092     class TAGLIB_EXPORT FileTypeResolver
00093     {
00094       TAGLIB_IGNORE_MISSING_DESTRUCTOR
00095     public:
00105       virtual File *createFile(FileName fileName,
00106                                bool readAudioProperties = true,
00107                                AudioProperties::ReadStyle
00108                                audioPropertiesStyle = AudioProperties::Average) const = 0;
00109     };
00110 
00114     FileRef();
00115 
00125     explicit FileRef(FileName fileName,
00126                      bool readAudioProperties = true,
00127                      AudioProperties::ReadStyle
00128                      audioPropertiesStyle = AudioProperties::Average);
00129 
00134     explicit FileRef(File *file);
00135 
00139     FileRef(const FileRef &ref);
00140 
00144     virtual ~FileRef();
00145 
00154     Tag *tag() const;
00155 
00160     AudioProperties *audioProperties() const;
00161 
00177     File *file() const;
00178 
00182     bool save();
00183 
00196     static const FileTypeResolver *addFileTypeResolver(const FileTypeResolver *resolver);
00197 
00214     static StringList defaultFileExtensions();
00215 
00219     bool isNull() const;
00220 
00224     FileRef &operator=(const FileRef &ref);
00225 
00229     bool operator==(const FileRef &ref) const;
00230 
00235     bool operator!=(const FileRef &ref) const;
00236 
00248     static File *create(FileName fileName,
00249                         bool readAudioProperties = true,
00250                         AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
00251 
00252 
00253   private:
00254     class FileRefPrivate;
00255     FileRefPrivate *d;
00256   };
00257 
00258 } // namespace TagLib
00259 
00260 #endif