TagLib  1.13.1
fileref.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2002 - 2008 by Scott Wheeler
3  email : wheeler@kde.org
4  ***************************************************************************/
5 
6 /***************************************************************************
7  * This library is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU Lesser General Public License version *
9  * 2.1 as published by the Free Software Foundation. *
10  * *
11  * This library is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the Free Software *
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19  * 02110-1301 USA *
20  * *
21  * Alternatively, this file is available under the Mozilla Public *
22  * License Version 1.1. You may obtain a copy of the License at *
23  * http://www.mozilla.org/MPL/ *
24  ***************************************************************************/
25 
26 #ifndef TAGLIB_FILEREF_H
27 #define TAGLIB_FILEREF_H
28 
29 #include "tfile.h"
30 #include "tstringlist.h"
31 
32 #include "taglib_export.h"
33 #include "audioproperties.h"
34 
35 namespace TagLib {
36 
37  class Tag;
38 
40 
60  {
61  public:
62 
64 
93  {
95  public:
105  virtual File *createFile(FileName fileName,
106  bool readAudioProperties = true,
108  audioPropertiesStyle = AudioProperties::Average) const = 0;
109  };
110 
112  {
114  public:
116  bool readAudioProperties = true,
118  audioPropertiesStyle = AudioProperties::Average) const = 0;
119  };
120 
125 
135  explicit FileRef(FileName fileName,
136  bool readAudioProperties = true,
138  audioPropertiesStyle = AudioProperties::Average);
139 
152  explicit FileRef(IOStream* stream,
153  bool readAudioProperties = true,
155  audioPropertiesStyle = AudioProperties::Average);
156 
161  explicit FileRef(File *file);
162 
166  FileRef(const FileRef &ref);
167 
171  virtual ~FileRef();
172 
184  Tag *tag() const;
185 
191 
207  File *file() const;
208 
212  bool save();
213 
226  static const FileTypeResolver *addFileTypeResolver(const FileTypeResolver *resolver);
227 
245 
249  bool isNull() const;
250 
254  FileRef &operator=(const FileRef &ref);
255 
259  void swap(FileRef &ref);
260 
264  bool operator==(const FileRef &ref) const;
265 
270  bool operator!=(const FileRef &ref) const;
271 
283  static File *create(FileName fileName,
284  bool readAudioProperties = true,
286 
287  private:
288  void parse(FileName fileName, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
289  void parse(IOStream *stream, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
290 
291  class FileRefPrivate;
292  FileRefPrivate *d;
293  };
294 
295 } // namespace TagLib
296 
297 #endif
A simple, abstract interface to common audio properties.
Definition: audioproperties.h:43
ReadStyle
Definition: audioproperties.h:53
@ Average
Read more of the file and make better values guesses.
Definition: audioproperties.h:57
A class for pluggable file type resolution.
Definition: fileref.h:93
virtual File * createFile(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
Definition: fileref.h:112
virtual File * createFileFromStream(IOStream *stream, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
This class provides a simple abstraction for creating and handling files.
Definition: fileref.h:60
void swap(FileRef &ref)
static File * create(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
File * file() const
static StringList defaultFileExtensions()
FileRef(const FileRef &ref)
bool operator!=(const FileRef &ref) const
FileRef(File *file)
FileRef(IOStream *stream, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
AudioProperties * audioProperties() const
virtual ~FileRef()
static const FileTypeResolver * addFileTypeResolver(const FileTypeResolver *resolver)
FileRef & operator=(const FileRef &ref)
FileRef(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
bool isNull() const
Tag * tag() const
bool operator==(const FileRef &ref) const
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:63
A list of strings.
Definition: tstringlist.h:46
Definition: tag.h:47
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
const char * FileName
Definition: tiostream.h:57
#define TAGLIB_IGNORE_MISSING_DESTRUCTOR
Definition: taglib.h:38
#define TAGLIB_EXPORT
Definition: taglib_export.h:40