PageRenderTime 15ms CodeModel.GetById 8ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 0ms

/TeXmacs-1.0.7.11-src/src/System/Files/tm_ostream.hpp

#
C++ Header | 73 lines | 49 code | 13 blank | 11 comment | 1 complexity | bc93d825bff0003c9d2953000b1072f4 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, MPL-2.0-no-copyleft-exception
 1
 2/******************************************************************************
 3* MODULE     : tm_ostream.hpp
 4* DESCRIPTION: Output stream class
 5* COPYRIGHT  : (C) 2009  David MICHEL
 6*******************************************************************************
 7* This software falls under the GNU general public license version 3 or later.
 8* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
 9* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10******************************************************************************/
11
12#ifndef OUT_STREAM_HPP
13#define OUT_STREAM_HPP
14
15//#include "url.hpp"
16#include <cstdio>
17class string;
18
19class tm_ostream {
20  FILE *file;
21  string *buf;
22  bool is_w;
23  bool is_mine;
24  bool is_buf;
25
26  static tm_ostream private_cout;
27  static tm_ostream private_cerr;
28
29  tm_ostream (const tm_ostream&);
30  tm_ostream& operator= (const tm_ostream&);
31
32public:
33  static tm_ostream& cout;
34  static tm_ostream& cerr;
35
36  tm_ostream ();
37  tm_ostream (char*);
38  tm_ostream (FILE*);
39  ~tm_ostream ();
40
41  bool open ();
42//  bool open (url);
43  bool open (char*);
44  bool open (FILE*);
45  bool is_writable () const;
46  bool is_buffered () const;
47  void flush ();
48  void close ();
49  void buffer ();
50  string unbuffer ();
51
52  tm_ostream& operator << (bool);
53  tm_ostream& operator << (char);
54  tm_ostream& operator << (short);
55  tm_ostream& operator << (unsigned short);
56  tm_ostream& operator << (int);
57  tm_ostream& operator << (unsigned int);
58  tm_ostream& operator << (long);
59  tm_ostream& operator << (unsigned long);
60  tm_ostream& operator << (long long int);
61  tm_ostream& operator << (unsigned long long int);
62  tm_ostream& operator << (float);
63  tm_ostream& operator << (double);
64  tm_ostream& operator << (long double);
65  tm_ostream& operator << (const char*);
66
67  bool operator == (tm_ostream&);
68};
69
70extern tm_ostream& cout;
71extern tm_ostream& cerr;
72
73#endif // defined OUT_STREAM_HPP