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 |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
20 |
|
21 */ |
|
22 |
383
|
23 #if !defined (octave_pager_h) |
|
24 #define octave_pager_h 1 |
1
|
25 |
3503
|
26 #include <iostream> |
1760
|
27 #include <string> |
|
28 |
4051
|
29 #include "lo-sstream.h" |
|
30 |
2095
|
31 #ifdef HAVE_SYS_TYPES_H |
|
32 #include <sys/types.h> |
|
33 #endif |
|
34 |
|
35 class |
4051
|
36 octave_pager_buf : public STRINGSTREAMBUF |
2095
|
37 { |
|
38 public: |
|
39 |
4051
|
40 octave_pager_buf (void) |
|
41 : STRINGSTREAMBUF (), diary_skip (0) { } |
2095
|
42 |
3477
|
43 void flush_current_contents_to_diary (void); |
|
44 |
3756
|
45 void set_diary_skip (void); |
|
46 |
2095
|
47 protected: |
|
48 |
|
49 int sync (void); |
3756
|
50 |
|
51 private: |
|
52 |
|
53 size_t diary_skip; |
2095
|
54 }; |
|
55 |
|
56 class |
3537
|
57 octave_pager_stream : public std::ostream |
2095
|
58 { |
|
59 protected: |
|
60 |
|
61 octave_pager_stream (void); |
|
62 |
|
63 public: |
|
64 |
|
65 ~octave_pager_stream (void); |
|
66 |
3477
|
67 void flush_current_contents_to_diary (void); |
|
68 |
3756
|
69 void set_diary_skip (void); |
|
70 |
2095
|
71 static octave_pager_stream& stream (void); |
|
72 |
|
73 private: |
|
74 |
|
75 static octave_pager_stream *instance; |
|
76 |
|
77 octave_pager_buf *pb; |
|
78 |
|
79 // No copying! |
|
80 |
|
81 octave_pager_stream (const octave_pager_stream&); |
|
82 |
|
83 octave_pager_stream& operator = (const octave_pager_stream&); |
|
84 }; |
1
|
85 |
2095
|
86 class |
4051
|
87 octave_diary_buf : public STRINGSTREAMBUF |
2095
|
88 { |
|
89 public: |
|
90 |
4051
|
91 octave_diary_buf (void) : STRINGSTREAMBUF () { } |
2095
|
92 |
|
93 protected: |
|
94 |
|
95 int sync (void); |
|
96 }; |
|
97 |
|
98 class |
3537
|
99 octave_diary_stream : public std::ostream |
2095
|
100 { |
|
101 protected: |
|
102 |
|
103 octave_diary_stream (void); |
|
104 |
|
105 public: |
|
106 |
|
107 ~octave_diary_stream (void); |
|
108 |
|
109 static octave_diary_stream& stream (void); |
|
110 |
|
111 private: |
|
112 |
|
113 static octave_diary_stream *instance; |
|
114 |
|
115 octave_diary_buf *db; |
|
116 |
|
117 // No copying! |
|
118 |
|
119 octave_diary_stream (const octave_diary_stream&); |
|
120 |
|
121 octave_diary_stream& operator = (const octave_diary_stream&); |
|
122 }; |
|
123 |
|
124 #define octave_stdout (octave_pager_stream::stream ()) |
|
125 |
|
126 #define octave_diary (octave_diary_stream::stream ()) |
|
127 |
|
128 extern void flush_octave_stdout (void); |
|
129 |
1
|
130 #endif |
|
131 |
|
132 /* |
|
133 ;;; Local Variables: *** |
|
134 ;;; mode: C++ *** |
|
135 ;;; End: *** |
|
136 */ |