Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

tfile.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2002, 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_FILE_H
00023 #define TAGLIB_FILE_H
00024 
00025 #include "taglib.h"
00026 #include "tbytevector.h"
00027 
00028 namespace TagLib {
00029 
00030   class String;
00031   class Tag;
00032   class AudioProperties;
00033 
00035 
00042   class File
00043   {
00044   public:
00048     enum Position {
00050       Beginning,
00052       Current,
00054       End
00055     };
00056 
00060     virtual ~File();
00061 
00065     const char *name() const;
00066 
00071     virtual Tag *tag() const = 0;
00072 
00078     virtual AudioProperties *audioProperties() const = 0;
00079 
00084     virtual void save() = 0;
00085 
00089     ByteVector readBlock(ulong length);
00090 
00100     void writeBlock(const ByteVector &data);
00101 
00114     long find(const ByteVector &pattern,
00115               long fromOffset = 0,
00116               const ByteVector &before = ByteVector::null);
00117 
00130     long rfind(const ByteVector &pattern,
00131                long fromOffset = 0,
00132                const ByteVector &before = ByteVector::null);
00133 
00141     void insert(const ByteVector &data, ulong start = 0, ulong replace = 0);
00142 
00150     void removeBlock(ulong start = 0, ulong length = 0);
00151 
00155     bool readOnly() const;
00156 
00161     bool isOpen() const;
00162 
00167     bool isValid() const;
00168 
00175     void seek(long offset, Position p = Beginning);
00176 
00180     void clear();
00181 
00185     long tell() const;
00186 
00190     long length();
00191 
00196     static bool isReadable(const char *file);
00197 
00201     static bool isWritable(const char *name);
00202 
00203   protected:
00211     File(const char *file);
00212 
00218     void setValid(bool valid);
00219 
00223     void truncate(long length);
00224 
00228     static uint bufferSize();
00229 
00230   private:
00231     File(const File &);
00232     File &operator=(const File &);
00233 
00234     class FilePrivate;
00235     FilePrivate *d;
00236   };
00237 
00238 }
00239 
00240 #endif

Generated on Mon Jun 7 12:51:47 2004 for TagLib by doxygen 1.3.4