Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXBZFileStream.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                      B Z F i l e S t r e a m   C l a s s e s                  *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2009 by Lyle Johnson. All Rights Reserved.                 *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXBZFileStream.h,v 1.16 2009/01/06 13:07:22 fox Exp $                    *
00022 ********************************************************************************/
00023 #ifdef HAVE_BZ2LIB_H
00024 #ifndef FXBZFILESTREAM_H
00025 #define FXBZFILESTREAM_H
00026 
00027 #ifndef FXFILESTREAM_H
00028 #include "FXFileStream.h"
00029 #endif
00030 
00031 
00032 namespace FX {
00033 
00034 
00035 struct BZBlock;
00036 
00037 
00038 /// BZIP2 compressed file stream
00039 class FXAPI FXBZFileStream : public FXFileStream {
00040 private:
00041   BZBlock *bz;
00042   int      ac;
00043 protected:
00044   virtual FXuval writeBuffer(FXuval count);
00045   virtual FXuval readBuffer(FXuval count);
00046 public:
00047 
00048   /// Create BZIP2 file stream
00049   FXBZFileStream(const FXObject* cont=NULL);
00050 
00051   /// Create and open BZIP2 file stream
00052   FXBZFileStream(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
00053 
00054   /// Open file stream
00055   FXbool open(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
00056 
00057   /// Flush buffer
00058   virtual FXbool flush();
00059 
00060   /// Close file stream
00061   virtual FXbool close();
00062 
00063   /// Get position
00064   FXlong position() const { return FXStream::position(); }
00065 
00066   /// Move to position
00067   virtual FXbool position(FXlong,FXWhence){ return false; }
00068 
00069   /// Save single items to stream
00070   FXBZFileStream& operator<<(const FXuchar& v){ FXStream::operator<<(v); return *this; }
00071   FXBZFileStream& operator<<(const FXchar& v){ FXStream::operator<<(v); return *this; }
00072   FXBZFileStream& operator<<(const FXbool& v){ FXStream::operator<<(v); return *this; }
00073   FXBZFileStream& operator<<(const FXushort& v){ FXStream::operator<<(v); return *this; }
00074   FXBZFileStream& operator<<(const FXshort& v){ FXStream::operator<<(v); return *this; }
00075   FXBZFileStream& operator<<(const FXuint& v){ FXStream::operator<<(v); return *this; }
00076   FXBZFileStream& operator<<(const FXint& v){ FXStream::operator<<(v); return *this; }
00077   FXBZFileStream& operator<<(const FXfloat& v){ FXStream::operator<<(v); return *this; }
00078   FXBZFileStream& operator<<(const FXdouble& v){ FXStream::operator<<(v); return *this; }
00079   FXBZFileStream& operator<<(const FXlong& v){ FXStream::operator<<(v); return *this; }
00080   FXBZFileStream& operator<<(const FXulong& v){ FXStream::operator<<(v); return *this; }
00081 
00082   /// Save arrays of items to stream
00083   FXBZFileStream& save(const FXuchar* p,FXuval n){ FXStream::save(p,n); return *this; }
00084   FXBZFileStream& save(const FXchar* p,FXuval n){ FXStream::save(p,n); return *this; }
00085   FXBZFileStream& save(const FXbool* p,FXuval n){ FXStream::save(p,n); return *this; }
00086   FXBZFileStream& save(const FXushort* p,FXuval n){ FXStream::save(p,n); return *this; }
00087   FXBZFileStream& save(const FXshort* p,FXuval n){ FXStream::save(p,n); return *this; }
00088   FXBZFileStream& save(const FXuint* p,FXuval n){ FXStream::save(p,n); return *this; }
00089   FXBZFileStream& save(const FXint* p,FXuval n){ FXStream::save(p,n); return *this; }
00090   FXBZFileStream& save(const FXfloat* p,FXuval n){ FXStream::save(p,n); return *this; }
00091   FXBZFileStream& save(const FXdouble* p,FXuval n){ FXStream::save(p,n); return *this; }
00092   FXBZFileStream& save(const FXlong* p,FXuval n){ FXStream::save(p,n); return *this; }
00093   FXBZFileStream& save(const FXulong* p,FXuval n){ FXStream::save(p,n); return *this; }
00094 
00095   /// Load single items from stream
00096   FXBZFileStream& operator>>(FXuchar& v){ FXStream::operator>>(v); return *this; }
00097   FXBZFileStream& operator>>(FXchar& v){ FXStream::operator>>(v); return *this; }
00098   FXBZFileStream& operator>>(FXbool& v){ FXStream::operator>>(v); return *this; }
00099   FXBZFileStream& operator>>(FXushort& v){ FXStream::operator>>(v); return *this; }
00100   FXBZFileStream& operator>>(FXshort& v){ FXStream::operator>>(v); return *this; }
00101   FXBZFileStream& operator>>(FXuint& v){ FXStream::operator>>(v); return *this; }
00102   FXBZFileStream& operator>>(FXint& v){ FXStream::operator>>(v); return *this; }
00103   FXBZFileStream& operator>>(FXfloat& v){ FXStream::operator>>(v); return *this; }
00104   FXBZFileStream& operator>>(FXdouble& v){ FXStream::operator>>(v); return *this; }
00105   FXBZFileStream& operator>>(FXlong& v){ FXStream::operator>>(v); return *this; }
00106   FXBZFileStream& operator>>(FXulong& v){ FXStream::operator>>(v); return *this; }
00107 
00108   /// Load arrays of items from stream
00109   FXBZFileStream& load(FXuchar* p,FXuval n){ FXStream::load(p,n); return *this; }
00110   FXBZFileStream& load(FXchar* p,FXuval n){ FXStream::load(p,n); return *this; }
00111   FXBZFileStream& load(FXbool* p,FXuval n){ FXStream::load(p,n); return *this; }
00112   FXBZFileStream& load(FXushort* p,FXuval n){ FXStream::load(p,n); return *this; }
00113   FXBZFileStream& load(FXshort* p,FXuval n){ FXStream::load(p,n); return *this; }
00114   FXBZFileStream& load(FXuint* p,FXuval n){ FXStream::load(p,n); return *this; }
00115   FXBZFileStream& load(FXint* p,FXuval n){ FXStream::load(p,n); return *this; }
00116   FXBZFileStream& load(FXfloat* p,FXuval n){ FXStream::load(p,n); return *this; }
00117   FXBZFileStream& load(FXdouble* p,FXuval n){ FXStream::load(p,n); return *this; }
00118   FXBZFileStream& load(FXlong* p,FXuval n){ FXStream::load(p,n); return *this; }
00119   FXBZFileStream& load(FXulong* p,FXuval n){ FXStream::load(p,n); return *this; }
00120 
00121   /// Save object
00122   FXBZFileStream& saveObject(const FXObject* v){ FXStream::saveObject(v); return *this; }
00123 
00124   /// Load object
00125   FXBZFileStream& loadObject(FXObject*& v){ FXStream::loadObject(v); return *this; }
00126 
00127   /// Clean up
00128   virtual ~FXBZFileStream();
00129   };
00130 
00131 
00132 }
00133 
00134 #endif
00135 #endif

Copyright © 1997-2009 Jeroen van der Zijp