00001 /** @file rutz/bzip2stream.h handle bzip2-encoding through a c++ iostreams interface */ 00002 00003 /////////////////////////////////////////////////////////////////////// 00004 // 00005 // Copyright (c) 2005-2007 University of Southern California 00006 // Rob Peters <rjpeters at usc dot edu> 00007 // 00008 // created: Wed Jun 14 15:00:54 2006 00009 // commit: $Id: bzip2stream.h 8249 2007-04-12 06:03:40Z rjpeters $ 00010 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/bzip2stream.h $ 00011 // 00012 // -------------------------------------------------------------------- 00013 // 00014 // This file is part of GroovX. 00015 // [http://www.klab.caltech.edu/rjpeters/groovx/] 00016 // 00017 // GroovX is free software; you can redistribute it and/or modify it 00018 // under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation; either version 2 of the License, or 00020 // (at your option) any later version. 00021 // 00022 // GroovX is distributed in the hope that it will be useful, but 00023 // WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00025 // General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with GroovX; if not, write to the Free Software Foundation, 00029 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00030 // 00031 /////////////////////////////////////////////////////////////////////// 00032 00033 #ifndef GROOVX_RUTZ_BZIP2STREAM_H_UTC20060614220054_DEFINED 00034 #define GROOVX_RUTZ_BZIP2STREAM_H_UTC20060614220054_DEFINED 00035 00036 #include <ios> 00037 #include <iosfwd> 00038 00039 namespace rutz 00040 { 00041 class fstring; 00042 00043 template <class T> class shared_ptr; 00044 00045 /** Opens a file for writing. An exception will be thrown if the 00046 specified file cannot be opened. The output file will be 00047 bzip2-compressed if the filename ends with ".bz2". */ 00048 shared_ptr<std::ostream> obzip2open(const rutz::fstring& filename, 00049 std::ios::openmode flags = 00050 std::ios::openmode(0)); 00051 00052 /// Overload. 00053 shared_ptr<std::ostream> obzip2open(const char* filename, 00054 std::ios::openmode flags = 00055 std::ios::openmode(0)); 00056 00057 /** Opens a file for reading. An exception will be thrown if the 00058 specified file cannot be opened. The input file will be 00059 bzip2-decompressed if the filename ends with ".bz2". */ 00060 shared_ptr<std::istream> ibzip2open(const rutz::fstring& filename, 00061 std::ios::openmode flags = 00062 std::ios::openmode(0)); 00063 00064 /// Overload. 00065 shared_ptr<std::istream> ibzip2open(const char* filename, 00066 std::ios::openmode flags = 00067 std::ios::openmode(0)); 00068 } 00069 00070 static const char vcid_groovx_rutz_bzip2stream_h_utc20060614220054[] = "$Id: bzip2stream.h 8249 2007-04-12 06:03:40Z rjpeters $ $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/bzip2stream.h $"; 00071 #endif // !GROOVX_RUTZ_BZIP2STREAM_H_UTC20060614220054DEFINED