Mercurial > octave
annotate libinterp/corefcn/oct-iostrm.cc @ 25054:6652d3823428 stable
maint: Update copyright dates in all source files.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 30 Mar 2018 09:19:05 -0400 |
parents | 194eb4bd202b |
children | cb1606f78f6b |
rev | line source |
---|---|
2081 | 1 /* |
2 | |
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
3 Copyright (C) 1996-2018 John W. Eaton |
2081 | 4 |
5 This file is part of Octave. | |
6 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
2081 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
2081 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
2081 | 20 |
21 */ | |
22 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
24 # include "config.h" |
2081 | 25 #endif |
26 | |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
27 #include <iostream> |
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
28 |
2081 | 29 #include "error.h" |
30 #include "oct-iostrm.h" | |
31 | |
32 // Position a stream at OFFSET relative to ORIGIN. | |
33 | |
34 int | |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
35 octave_base_iostream::seek (off_t, int) |
2081 | 36 { |
37 invalid_operation (); | |
38 return -1; | |
39 } | |
40 | |
41 // Return current stream position. | |
42 | |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
43 off_t |
4797 | 44 octave_base_iostream::tell (void) |
2081 | 45 { |
46 invalid_operation (); | |
47 return -1; | |
48 } | |
49 | |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
50 // Return nonzero if EOF has been reached on this stream. |
2081 | 51 |
52 bool | |
53 octave_base_iostream::eof (void) const | |
54 { | |
55 invalid_operation (); | |
56 return false; | |
57 } | |
58 | |
59 void | |
60 octave_base_iostream::invalid_operation (void) const | |
61 { | |
20938
aac911d8847b
choose correct error function in stream classes
John W. Eaton <jwe@octave.org>
parents:
20931
diff
changeset
|
62 // Note: use ::error to get error from error.h which halts operation. |
2081 | 63 ::error ("%s: invalid operation", stream_type ()); |
64 } | |
65 | |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 // Return nonzero if EOF has been reached on this stream. |
3342 | 67 |
68 bool | |
69 octave_istream::eof (void) const | |
70 { | |
71 return is && is->eof (); | |
72 } | |
73 | |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
74 octave::stream |
4587 | 75 octave_istream::create (std::istream *arg, const std::string& n) |
3340 | 76 { |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
77 return octave::stream (new octave_istream (arg, n)); |
3340 | 78 } |
79 | |
18812
9ac2357f19bc
doc: Replace "non-zero" with "nonzero" to match existing usage.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
80 // Return nonzero if EOF has been reached on this stream. |
3342 | 81 |
82 bool | |
83 octave_ostream::eof (void) const | |
84 { | |
85 return os && os->eof (); | |
86 } | |
87 | |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
88 octave::stream |
4587 | 89 octave_ostream::create (std::ostream *arg, const std::string& n) |
3340 | 90 { |
23059
b98ebcd7f11c
move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
91 return octave::stream (new octave_ostream (arg, n)); |
3340 | 92 } |