tbytevectorstream.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2011 by Lukas Lalinsky
00003     email                : lalinsky@gmail.com
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_BYTEVECTORSTREAM_H
00027 #define TAGLIB_BYTEVECTORSTREAM_H
00028 
00029 #include "taglib_export.h"
00030 #include "taglib.h"
00031 #include "tbytevector.h"
00032 #include "tiostream.h"
00033 
00034 namespace TagLib {
00035 
00036   class String;
00037   class Tag;
00038   class AudioProperties;
00039 
00041 
00042   class TAGLIB_EXPORT ByteVectorStream : public IOStream
00043   {
00044   public:
00049     ByteVectorStream(const ByteVector &data);
00050 
00054     virtual ~ByteVectorStream();
00055 
00059     FileName name() const;
00060 
00064     ByteVector readBlock(ulong length);
00065 
00075     void writeBlock(const ByteVector &data);
00076 
00084     void insert(const ByteVector &data, ulong start = 0, ulong replace = 0);
00085 
00093     void removeBlock(ulong start = 0, ulong length = 0);
00094 
00098     bool readOnly() const;
00099 
00104     bool isOpen() const;
00105 
00112     void seek(long offset, Position p = Beginning);
00113 
00117     void clear();
00118 
00122     long tell() const;
00123 
00127     long length();
00128 
00132     void truncate(long length);
00133 
00134     ByteVector *data();
00135 
00136   protected:
00137 
00138   private:
00139     class ByteVectorStreamPrivate;
00140     ByteVectorStreamPrivate *d;
00141   };
00142 
00143 }
00144 
00145 #endif