00001 // -*- Mode: C++ -*- 00002 // FileInputStream.h 00003 // Copyright © 2003 Laboratoire de Biologie Informatique et Théorique 00004 // Université de Montréal. 00005 // Author : Martin Larose 00006 // Created On : Tue Nov 4 16:39:40 2003 00007 // $Revision: 1.1 $ 00008 // 00009 // This file is part of xmlcpg. 00010 // 00011 // xmlcpg is free software; you can redistribute it and/or modify it under 00012 // the terms of the GNU Lesser General Public License as published by the Free 00013 // Software Foundation; either version 2 of the License, or (at your option) 00014 // any later version. 00015 // 00016 // xmlcpg is distributed in the hope that it will be useful, but WITHOUT ANY 00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00019 // more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public License 00022 // along with xmlcpg; if not, write to the Free Software Foundation, Inc., 00023 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 00026 #ifndef _rnaml_FileInputStream_h_ 00027 #define _rnaml_FileInputStream_h_ 00028 00029 #include <cstdio> 00030 00031 extern "C" { 00032 #include "fileinputstream.h" 00033 #include "inputstream.h" 00034 } 00035 00036 #include "InputStream.h" 00037 00038 00039 00040 namespace rnaml 00041 { 00046 class FileInputStream : public InputStream 00047 { 00051 xmlcpgFileInputStream *is; 00052 00053 public: 00054 00055 // LIFECYCLE ------------------------------------------------------------ 00056 00061 FileInputStream (FILE *f); 00062 00067 FileInputStream (const char *name); 00068 00073 FileInputStream (int fd); 00074 00078 virtual ~FileInputStream (); 00079 00080 // OPERATORS ------------------------------------------------------------ 00081 00082 // ACCESS --------------------------------------------------------------- 00083 00088 virtual xmlcpgInputStream* getCStructure () const { return (xmlcpgInputStream*) is; } 00089 00094 virtual void setCStructure (xmlcpgInputStream *is); 00095 00096 // METHODS -------------------------------------------------------------- 00097 00102 int getFD () const; 00103 00108 virtual bool getEOS () const; 00109 00114 virtual bool getError () const; 00115 00120 virtual const char* getErrorString () const; 00121 00122 // I/O ----------------------------------------------------------------- 00123 00128 virtual int read (); 00129 00136 virtual int read (void *ptr, int nbytes); 00137 00142 virtual bool close (); 00143 00144 }; 00145 } 00146 00147 #endif