Mercurial > hg > octave-nkf
annotate src/pager.h @ 12583:bb29b58e650c release-3-4-x
abandon release-3-4-x branch in favor of workflow using stable and default branches and merging stable to default periodically
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 08 Apr 2011 09:06:04 -0400 |
parents | fd0a3ac60b0e |
children | c053740eb2aa |
rev | line source |
---|---|
1 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1993-2011 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1 | 20 |
21 */ | |
22 | |
383 | 23 #if !defined (octave_pager_h) |
24 #define octave_pager_h 1 | |
1 | 25 |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
26 #include <iosfwd> |
5765 | 27 #include <sstream> |
1760 | 28 #include <string> |
29 | |
2095 | 30 #include <sys/types.h> |
31 | |
32 class | |
6109 | 33 OCTINTERP_API |
5765 | 34 octave_pager_buf : public std::stringbuf |
2095 | 35 { |
36 public: | |
37 | |
5765 | 38 octave_pager_buf (void) : std::stringbuf (), diary_skip (0) { } |
2095 | 39 |
3477 | 40 void flush_current_contents_to_diary (void); |
41 | |
3756 | 42 void set_diary_skip (void); |
43 | |
2095 | 44 protected: |
45 | |
46 int sync (void); | |
3756 | 47 |
48 private: | |
49 | |
50 size_t diary_skip; | |
2095 | 51 }; |
52 | |
53 class | |
6109 | 54 OCTINTERP_API |
3537 | 55 octave_pager_stream : public std::ostream |
2095 | 56 { |
57 protected: | |
58 | |
59 octave_pager_stream (void); | |
60 | |
61 public: | |
62 | |
63 ~octave_pager_stream (void); | |
64 | |
3477 | 65 void flush_current_contents_to_diary (void); |
66 | |
3756 | 67 void set_diary_skip (void); |
68 | |
2095 | 69 static octave_pager_stream& stream (void); |
70 | |
71 private: | |
72 | |
73 static octave_pager_stream *instance; | |
74 | |
75 octave_pager_buf *pb; | |
76 | |
77 // No copying! | |
78 | |
79 octave_pager_stream (const octave_pager_stream&); | |
80 | |
81 octave_pager_stream& operator = (const octave_pager_stream&); | |
82 }; | |
1 | 83 |
2095 | 84 class |
6109 | 85 OCTINTERP_API |
5765 | 86 octave_diary_buf : public std::stringbuf |
2095 | 87 { |
88 public: | |
89 | |
5765 | 90 octave_diary_buf (void) : std::stringbuf () { } |
2095 | 91 |
92 protected: | |
93 | |
94 int sync (void); | |
95 }; | |
96 | |
97 class | |
6109 | 98 OCTINTERP_API |
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 | |
6109 | 128 extern OCTINTERP_API void flush_octave_stdout (void); |
2095 | 129 |
1 | 130 #endif |