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> |
|
27 #include <strstream> |
1760
|
28 #include <string> |
|
29 |
2095
|
30 #ifdef HAVE_SYS_TYPES_H |
|
31 #include <sys/types.h> |
|
32 #endif |
|
33 |
|
34 class |
3523
|
35 octave_pager_buf : public std::strstreambuf |
2095
|
36 { |
|
37 public: |
|
38 |
3523
|
39 octave_pager_buf (int size = 0) : std::strstreambuf (size) { } |
2095
|
40 |
3477
|
41 void flush_current_contents_to_diary (void); |
|
42 |
2095
|
43 protected: |
|
44 |
|
45 int sync (void); |
|
46 }; |
|
47 |
|
48 class |
3537
|
49 octave_pager_stream : public std::ostream |
2095
|
50 { |
|
51 protected: |
|
52 |
|
53 octave_pager_stream (void); |
|
54 |
|
55 public: |
|
56 |
|
57 ~octave_pager_stream (void); |
|
58 |
3477
|
59 void flush_current_contents_to_diary (void); |
|
60 |
2095
|
61 static octave_pager_stream& stream (void); |
|
62 |
|
63 private: |
|
64 |
|
65 static octave_pager_stream *instance; |
|
66 |
|
67 octave_pager_buf *pb; |
|
68 |
|
69 // No copying! |
|
70 |
|
71 octave_pager_stream (const octave_pager_stream&); |
|
72 |
|
73 octave_pager_stream& operator = (const octave_pager_stream&); |
|
74 }; |
1
|
75 |
2095
|
76 class |
3523
|
77 octave_diary_buf : public std::strstreambuf |
2095
|
78 { |
|
79 public: |
|
80 |
3523
|
81 octave_diary_buf (int size = 0) : std::strstreambuf (size) { } |
2095
|
82 |
|
83 protected: |
|
84 |
|
85 int sync (void); |
|
86 }; |
|
87 |
|
88 class |
3537
|
89 octave_diary_stream : public std::ostream |
2095
|
90 { |
|
91 protected: |
|
92 |
|
93 octave_diary_stream (void); |
|
94 |
|
95 public: |
|
96 |
|
97 ~octave_diary_stream (void); |
|
98 |
|
99 static octave_diary_stream& stream (void); |
|
100 |
|
101 private: |
|
102 |
|
103 static octave_diary_stream *instance; |
|
104 |
|
105 octave_diary_buf *db; |
|
106 |
|
107 // No copying! |
|
108 |
|
109 octave_diary_stream (const octave_diary_stream&); |
|
110 |
|
111 octave_diary_stream& operator = (const octave_diary_stream&); |
|
112 }; |
|
113 |
|
114 #define octave_stdout (octave_pager_stream::stream ()) |
|
115 |
|
116 #define octave_diary (octave_diary_stream::stream ()) |
|
117 |
|
118 extern void flush_octave_stdout (void); |
|
119 |
1
|
120 #endif |
|
121 |
|
122 /* |
|
123 ;;; Local Variables: *** |
|
124 ;;; mode: C++ *** |
|
125 ;;; End: *** |
|
126 */ |