GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pager.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2017 John W. Eaton
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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_pager_h)
24 #define octave_pager_h 1
25 
26 #include "octave-config.h"
27 
28 #include <iosfwd>
29 #include <sstream>
30 #include <string>
31 
32 #include <sys/types.h>
33 
34 class
36 octave_pager_buf : public std::stringbuf
37 {
38 public:
39 
40  octave_pager_buf (void) : std::stringbuf (), diary_skip (0) { }
41 
42  void flush_current_contents_to_diary (void);
43 
44  void set_diary_skip (void);
45 
46 protected:
47 
48  int sync (void);
49 
50 private:
51 
52  size_t diary_skip;
53 };
54 
55 class
57 octave_pager_stream : public std::ostream
58 {
59 protected:
60 
61  octave_pager_stream (void);
62 
63 public:
64 
65  ~octave_pager_stream (void);
66 
67  static void flush_current_contents_to_diary (void);
68 
69  static void set_diary_skip (void);
70 
71  static std::ostream& stream (void);
72 
73  static void reset (void);
74 
75 private:
76 
77  void do_flush_current_contents_to_diary (void);
78 
79  void do_set_diary_skip (void);
80 
81  void do_reset (void);
82 
84 
85  static bool instance_ok (void);
86 
87  static void cleanup_instance (void) { delete instance; instance = 0; }
88 
90 
91  // No copying!
92 
94 
96 };
97 
98 class
100 octave_diary_buf : public std::stringbuf
101 {
102 public:
103 
104  octave_diary_buf (void) : std::stringbuf () { }
105 
106 protected:
107 
108  int sync (void);
109 };
110 
111 class
113 octave_diary_stream : public std::ostream
114 {
115 protected:
116 
117  octave_diary_stream (void);
118 
119 public:
120 
121  ~octave_diary_stream (void);
122 
123  static std::ostream& stream (void);
124 
125  static void reset (void);
126 
127 private:
128 
129  void do_reset (void);
130 
132 
133  static bool instance_ok (void);
134 
135  static void cleanup_instance (void) { delete instance; instance = 0; }
136 
138 
139  // No copying!
140 
142 
144 };
145 
146 #define octave_stdout (octave_pager_stream::stream ())
147 
148 #define octave_diary (octave_diary_stream::stream ())
149 
150 extern OCTINTERP_API void flush_octave_stdout (void);
151 
152 #endif
workspace_element operator=(const workspace_element &ws_elt)
size_t diary_skip
Definition: pager.h:52
STL namespace.
static void cleanup_instance(void)
Definition: pager.h:135
static octave_diary_stream * instance
Definition: pager.h:131
octave_pager_buf(void)
Definition: pager.h:40
octave_pager_buf * pb
Definition: pager.h:89
#define OCTINTERP_API
Definition: mexproto.h:69
static octave_pager_stream * instance
Definition: pager.h:83
static void cleanup_instance(void)
Definition: pager.h:87
octave_diary_buf * db
Definition: pager.h:137
OCTINTERP_API void flush_octave_stdout(void)
Definition: pager.cc:454
octave_diary_buf(void)
Definition: pager.h:104