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

FXBZStream.h

00001 /******************************************************************************** 00002 * * 00003 * B Z S t r e a m C l a s s e s * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1999,2004 by Lyle Johnson. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (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 GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXBZStream.h,v 1.3 2004/02/08 17:17:33 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifdef HAVE_BZ2LIB_H 00025 #ifndef FXBZSTREAM_H 00026 #define FXBZSTREAM_H 00027 00028 #ifndef FXSTREAM_H 00029 #include "FXStream.h" 00030 #endif 00031 00032 00033 namespace FX { 00034 00035 00036 /// BZIP2 compressed file stream 00037 class FXAPI FXBZFileStream : public FXStream { 00038 private: 00039 void *file; 00040 void *bzfile; 00041 protected: 00042 virtual unsigned long writeBuffer(unsigned long count); 00043 virtual unsigned long readBuffer(unsigned long count); 00044 public: 00045 00046 /// Create BZIP2 file stream 00047 FXBZFileStream(const FXObject* cont=NULL); 00048 00049 /// Open file stream 00050 FXbool open(const FXString& filename,FXStreamDirection save_or_load,unsigned long size=8192); 00051 00052 /// Close file stream 00053 virtual FXbool close(); 00054 00055 /// Move to position 00056 virtual FXbool position(long,FXWhence){ return FALSE; } 00057 00058 /// Save single items to stream 00059 FXBZFileStream& operator<<(const FXuchar& v){ FXStream::operator<<(v); return *this; } 00060 FXBZFileStream& operator<<(const FXchar& v){ FXStream::operator<<(v); return *this; } 00061 FXBZFileStream& operator<<(const FXushort& v){ FXStream::operator<<(v); return *this; } 00062 FXBZFileStream& operator<<(const FXshort& v){ FXStream::operator<<(v); return *this; } 00063 FXBZFileStream& operator<<(const FXuint& v){ FXStream::operator<<(v); return *this; } 00064 FXBZFileStream& operator<<(const FXint& v){ FXStream::operator<<(v); return *this; } 00065 FXBZFileStream& operator<<(const FXfloat& v){ FXStream::operator<<(v); return *this; } 00066 FXBZFileStream& operator<<(const FXdouble& v){ FXStream::operator<<(v); return *this; } 00067 #ifdef FX_LONG 00068 FXBZFileStream& operator<<(const FXlong& v){ FXStream::operator<<(v); return *this; } 00069 FXBZFileStream& operator<<(const FXulong& v){ FXStream::operator<<(v); return *this; } 00070 #endif 00071 00072 /// Save arrays of items to stream 00073 FXBZFileStream& save(const FXuchar* p,unsigned long n){ FXStream::save(p,n); return *this; } 00074 FXBZFileStream& save(const FXchar* p,unsigned long n){ FXStream::save(p,n); return *this; } 00075 FXBZFileStream& save(const FXushort* p,unsigned long n){ FXStream::save(p,n); return *this; } 00076 FXBZFileStream& save(const FXshort* p,unsigned long n){ FXStream::save(p,n); return *this; } 00077 FXBZFileStream& save(const FXuint* p,unsigned long n){ FXStream::save(p,n); return *this; } 00078 FXBZFileStream& save(const FXint* p,unsigned long n){ FXStream::save(p,n); return *this; } 00079 FXBZFileStream& save(const FXfloat* p,unsigned long n){ FXStream::save(p,n); return *this; } 00080 FXBZFileStream& save(const FXdouble* p,unsigned long n){ FXStream::save(p,n); return *this; } 00081 #ifdef FX_LONG 00082 FXBZFileStream& save(const FXlong* p,unsigned long n){ FXStream::save(p,n); return *this; } 00083 FXBZFileStream& save(const FXulong* p,unsigned long n){ FXStream::save(p,n); return *this; } 00084 #endif 00085 00086 /// Load single items from stream 00087 FXBZFileStream& operator>>(FXuchar& v){ FXStream::operator>>(v); return *this; } 00088 FXBZFileStream& operator>>(FXchar& v){ FXStream::operator>>(v); return *this; } 00089 FXBZFileStream& operator>>(FXushort& v){ FXStream::operator>>(v); return *this; } 00090 FXBZFileStream& operator>>(FXshort& v){ FXStream::operator>>(v); return *this; } 00091 FXBZFileStream& operator>>(FXuint& v){ FXStream::operator>>(v); return *this; } 00092 FXBZFileStream& operator>>(FXint& v){ FXStream::operator>>(v); return *this; } 00093 FXBZFileStream& operator>>(FXfloat& v){ FXStream::operator>>(v); return *this; } 00094 FXBZFileStream& operator>>(FXdouble& v){ FXStream::operator>>(v); return *this; } 00095 #ifdef FX_LONG 00096 FXBZFileStream& operator>>(FXlong& v){ FXStream::operator>>(v); return *this; } 00097 FXBZFileStream& operator>>(FXulong& v){ FXStream::operator>>(v); return *this; } 00098 #endif 00099 00100 /// Load arrays of items from stream 00101 FXBZFileStream& load(FXuchar* p,unsigned long n){ FXStream::load(p,n); return *this; } 00102 FXBZFileStream& load(FXchar* p,unsigned long n){ FXStream::load(p,n); return *this; } 00103 FXBZFileStream& load(FXushort* p,unsigned long n){ FXStream::load(p,n); return *this; } 00104 FXBZFileStream& load(FXshort* p,unsigned long n){ FXStream::load(p,n); return *this; } 00105 FXBZFileStream& load(FXuint* p,unsigned long n){ FXStream::load(p,n); return *this; } 00106 FXBZFileStream& load(FXint* p,unsigned long n){ FXStream::load(p,n); return *this; } 00107 FXBZFileStream& load(FXfloat* p,unsigned long n){ FXStream::load(p,n); return *this; } 00108 FXBZFileStream& load(FXdouble* p,unsigned long n){ FXStream::load(p,n); return *this; } 00109 #ifdef FX_LONG 00110 FXBZFileStream& load(FXlong* p,unsigned long n){ FXStream::load(p,n); return *this; } 00111 FXBZFileStream& load(FXulong* p,unsigned long n){ FXStream::load(p,n); return *this; } 00112 #endif 00113 00114 /// Save object 00115 FXBZFileStream& saveObject(const FXObject* v){ FXStream::saveObject(v); return *this; } 00116 00117 /// Load object 00118 FXBZFileStream& loadObject(FXObject*& v){ FXStream::loadObject(v); return *this; } 00119 00120 /// Clean up 00121 virtual ~FXBZFileStream(); 00122 }; 00123 00124 00125 } 00126 00127 #endif 00128 #endif

Copyright © 1997-2004 Jeroen van der Zijp