1
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2002, 2005, 2006, |
|
4 2007 John W. Eaton |
1
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
1
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
1
|
21 |
|
22 */ |
|
23 |
383
|
24 #if !defined (octave_pager_h) |
|
25 #define octave_pager_h 1 |
1
|
26 |
3503
|
27 #include <iostream> |
5765
|
28 #include <sstream> |
1760
|
29 #include <string> |
|
30 |
2095
|
31 #ifdef HAVE_SYS_TYPES_H |
|
32 #include <sys/types.h> |
|
33 #endif |
|
34 |
|
35 class |
6109
|
36 OCTINTERP_API |
5765
|
37 octave_pager_buf : public std::stringbuf |
2095
|
38 { |
|
39 public: |
|
40 |
5765
|
41 octave_pager_buf (void) : std::stringbuf (), 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 |
6109
|
57 OCTINTERP_API |
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 |
6109
|
88 OCTINTERP_API |
5765
|
89 octave_diary_buf : public std::stringbuf |
2095
|
90 { |
|
91 public: |
|
92 |
5765
|
93 octave_diary_buf (void) : std::stringbuf () { } |
2095
|
94 |
|
95 protected: |
|
96 |
|
97 int sync (void); |
|
98 }; |
|
99 |
|
100 class |
6109
|
101 OCTINTERP_API |
3537
|
102 octave_diary_stream : public std::ostream |
2095
|
103 { |
|
104 protected: |
|
105 |
|
106 octave_diary_stream (void); |
|
107 |
|
108 public: |
|
109 |
|
110 ~octave_diary_stream (void); |
|
111 |
|
112 static octave_diary_stream& stream (void); |
|
113 |
|
114 private: |
|
115 |
|
116 static octave_diary_stream *instance; |
|
117 |
|
118 octave_diary_buf *db; |
|
119 |
|
120 // No copying! |
|
121 |
|
122 octave_diary_stream (const octave_diary_stream&); |
|
123 |
|
124 octave_diary_stream& operator = (const octave_diary_stream&); |
|
125 }; |
|
126 |
|
127 #define octave_stdout (octave_pager_stream::stream ()) |
|
128 |
|
129 #define octave_diary (octave_diary_stream::stream ()) |
|
130 |
6109
|
131 extern OCTINTERP_API void flush_octave_stdout (void); |
2095
|
132 |
1
|
133 #endif |
|
134 |
|
135 /* |
|
136 ;;; Local Variables: *** |
|
137 ;;; mode: C++ *** |
|
138 ;;; End: *** |
|
139 */ |