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., 51 Franklin Street, Fifth Floor, Boston, MA         *
00019  *   02110-1301  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 
00142     explicit FileRef(IOStream* stream,
00143                      bool readAudioProperties = true,
00144                      AudioProperties::ReadStyle
00145                      audioPropertiesStyle = AudioProperties::Average);
00146 
00151     explicit FileRef(File *file);
00152 
00156     FileRef(const FileRef &ref);
00157 
00161     virtual ~FileRef();
00162 
00174     Tag *tag() const;
00175 
00180     AudioProperties *audioProperties() const;
00181 
00197     File *file() const;
00198 
00202     bool save();
00203 
00216     static const FileTypeResolver *addFileTypeResolver(const FileTypeResolver *resolver);
00217 
00234     static StringList defaultFileExtensions();
00235 
00239     bool isNull() const;
00240 
00244     FileRef &operator=(const FileRef &ref);
00245 
00249     void swap(FileRef &ref);
00250 
00254     bool operator==(const FileRef &ref) const;
00255 
00260     bool operator!=(const FileRef &ref) const;
00261 
00273     static File *create(FileName fileName,
00274                         bool readAudioProperties = true,
00275                         AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
00276 
00277 
00278   private:
00279     class FileRefPrivate;
00280     FileRefPrivate *d;
00281   };
00282 
00283 } // namespace TagLib
00284 
00285 #endif