00001 /* 00002 00003 Copyright (C) 1996-2012 John W. Eaton 00004 00005 This file is part of Octave. 00006 00007 Octave is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by the 00009 Free Software Foundation; either version 3 of the License, or (at your 00010 option) any later version. 00011 00012 Octave is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Octave; see the file COPYING. If not, see 00019 <http://www.gnu.org/licenses/>. 00020 00021 */ 00022 00023 #ifdef HAVE_CONFIG_H 00024 #include <config.h> 00025 #endif 00026 00027 #include "error.h" 00028 #include "oct-iostrm.h" 00029 00030 // Position a stream at OFFSET relative to ORIGIN. 00031 00032 int 00033 octave_base_iostream::seek (long, int) 00034 { 00035 invalid_operation (); 00036 return -1; 00037 } 00038 00039 // Return current stream position. 00040 00041 long 00042 octave_base_iostream::tell (void) 00043 { 00044 invalid_operation (); 00045 return -1; 00046 } 00047 00048 // Return non-zero if EOF has been reached on this stream. 00049 00050 bool 00051 octave_base_iostream::eof (void) const 00052 { 00053 invalid_operation (); 00054 return false; 00055 } 00056 00057 void 00058 octave_base_iostream::invalid_operation (void) const 00059 { 00060 ::error ("%s: invalid operation", stream_type ()); 00061 } 00062 00063 // Return non-zero if EOF has been reached on this stream. 00064 00065 bool 00066 octave_istream::eof (void) const 00067 { 00068 return is && is->eof (); 00069 } 00070 00071 octave_stream 00072 octave_istream::create (std::istream *arg, const std::string& n) 00073 { 00074 return octave_stream (new octave_istream (arg, n)); 00075 } 00076 00077 // Return non-zero if EOF has been reached on this stream. 00078 00079 bool 00080 octave_ostream::eof (void) const 00081 { 00082 return os && os->eof (); 00083 } 00084 00085 octave_stream 00086 octave_ostream::create (std::ostream *arg, const std::string& n) 00087 { 00088 return octave_stream (new octave_ostream (arg, n)); 00089 }