![]() |
Octave-Forge - Extra packages for GNU Octave |
Home · Packages · Developers · Documentation · FAQ · Bugs · Mailing Lists · Links · Code |
00001 /* 00002 00003 Copyright (C) 1996, 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2007 00004 John W. Eaton 00005 00006 This file is part of Octave. 00007 00008 Octave is free software; you can redistribute it and/or modify it 00009 under the terms of the GNU General Public License as published by the 00010 Free Software Foundation; either version 3 of the License, or (at your 00011 option) any later version. 00012 00013 Octave is distributed in the hope that it will be useful, but WITHOUT 00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00015 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00016 for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with Octave; see the file COPYING. If not, see 00020 <http://www.gnu.org/licenses/>. 00021 00022 */ 00023 00024 #if !defined (octave_octave_fstream_h) 00025 #define octave_octave_fstream_h 1 00026 00027 #include <fstream> 00028 #include <string> 00029 00030 #include "oct-stream.h" 00031 00032 class 00033 octave_fstream : public octave_base_stream 00034 { 00035 public: 00036 00037 octave_fstream (const std::string& nm_arg, 00038 std::ios::openmode arg_md = std::ios::in|std::ios::out, 00039 oct_mach_info::float_format flt_fmt 00040 = oct_mach_info::native_float_format ()); 00041 00042 static octave_stream 00043 create (const std::string& nm_arg, 00044 std::ios::openmode arg_md = std::ios::in|std::ios::out, 00045 oct_mach_info::float_format flt_fmt 00046 = oct_mach_info::native_float_format ()); 00047 00048 // Position a stream at OFFSET relative to ORIGIN. 00049 00050 int seek (long offset, int origin); 00051 00052 // Return current stream position. 00053 00054 long tell (void); 00055 00056 // Return non-zero if EOF has been reached on this stream. 00057 00058 bool eof (void) const; 00059 00060 void do_close (void); 00061 00062 // The name of the file. 00063 00064 std::string name (void) const { return nm; } 00065 00066 std::istream *input_stream (void); 00067 00068 std::ostream *output_stream (void); 00069 00070 protected: 00071 00072 ~octave_fstream (void) { } 00073 00074 private: 00075 00076 std::string nm; 00077 00078 std::fstream fs; 00079 00080 // No copying! 00081 00082 octave_fstream (const octave_fstream&); 00083 00084 octave_fstream& operator = (const octave_fstream&); 00085 }; 00086 00087 #endif 00088 00089 /* 00090 ;;; Local Variables: *** 00091 ;;; mode: C++ *** 00092 ;;; End: *** 00093 */