1
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
1
|
21 |
|
22 */ |
|
23 |
383
|
24 #if !defined (octave_pager_h) |
|
25 #define octave_pager_h 1 |
1
|
26 |
3503
|
27 #include <iostream> |
1760
|
28 #include <string> |
|
29 |
4051
|
30 #include "lo-sstream.h" |
|
31 |
2095
|
32 #ifdef HAVE_SYS_TYPES_H |
|
33 #include <sys/types.h> |
|
34 #endif |
|
35 |
|
36 class |
4051
|
37 octave_pager_buf : public STRINGSTREAMBUF |
2095
|
38 { |
|
39 public: |
|
40 |
4051
|
41 octave_pager_buf (void) |
|
42 : STRINGSTREAMBUF (), diary_skip (0) { } |
2095
|
43 |
3477
|
44 void flush_current_contents_to_diary (void); |
|
45 |
3756
|
46 void set_diary_skip (void); |
|
47 |
2095
|
48 protected: |
|
49 |
|
50 int sync (void); |
3756
|
51 |
|
52 private: |
|
53 |
|
54 size_t diary_skip; |
2095
|
55 }; |
|
56 |
|
57 class |
3537
|
58 octave_pager_stream : public std::ostream |
2095
|
59 { |
|
60 protected: |
|
61 |
|
62 octave_pager_stream (void); |
|
63 |
|
64 public: |
|
65 |
|
66 ~octave_pager_stream (void); |
|
67 |
3477
|
68 void flush_current_contents_to_diary (void); |
|
69 |
3756
|
70 void set_diary_skip (void); |
|
71 |
2095
|
72 static octave_pager_stream& stream (void); |
|
73 |
|
74 private: |
|
75 |
|
76 static octave_pager_stream *instance; |
|
77 |
|
78 octave_pager_buf *pb; |
|
79 |
|
80 // No copying! |
|
81 |
|
82 octave_pager_stream (const octave_pager_stream&); |
|
83 |
|
84 octave_pager_stream& operator = (const octave_pager_stream&); |
|
85 }; |
1
|
86 |
2095
|
87 class |
4051
|
88 octave_diary_buf : public STRINGSTREAMBUF |
2095
|
89 { |
|
90 public: |
|
91 |
4051
|
92 octave_diary_buf (void) : STRINGSTREAMBUF () { } |
2095
|
93 |
|
94 protected: |
|
95 |
|
96 int sync (void); |
|
97 }; |
|
98 |
|
99 class |
3537
|
100 octave_diary_stream : public std::ostream |
2095
|
101 { |
|
102 protected: |
|
103 |
|
104 octave_diary_stream (void); |
|
105 |
|
106 public: |
|
107 |
|
108 ~octave_diary_stream (void); |
|
109 |
|
110 static octave_diary_stream& stream (void); |
|
111 |
|
112 private: |
|
113 |
|
114 static octave_diary_stream *instance; |
|
115 |
|
116 octave_diary_buf *db; |
|
117 |
|
118 // No copying! |
|
119 |
|
120 octave_diary_stream (const octave_diary_stream&); |
|
121 |
|
122 octave_diary_stream& operator = (const octave_diary_stream&); |
|
123 }; |
|
124 |
|
125 #define octave_stdout (octave_pager_stream::stream ()) |
|
126 |
|
127 #define octave_diary (octave_diary_stream::stream ()) |
|
128 |
|
129 extern void flush_octave_stdout (void); |
|
130 |
1
|
131 #endif |
|
132 |
|
133 /* |
|
134 ;;; Local Variables: *** |
|
135 ;;; mode: C++ *** |
|
136 ;;; End: *** |
|
137 */ |