Back to index

texmacs  1.0.7.15
tm_ostream.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : tm_ostream.hpp
00004 * DESCRIPTION: Output stream class
00005 * COPYRIGHT  : (C) 2009  David MICHEL
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef OUT_STREAM_HPP
00013 #define OUT_STREAM_HPP
00014 
00015 //#include "url.hpp"
00016 #include <cstdio>
00017 class string;
00018 
00019 class tm_ostream {
00020   FILE *file;
00021   string *buf;
00022   bool is_w;
00023   bool is_mine;
00024   bool is_buf;
00025 
00026   static tm_ostream private_cout;
00027   static tm_ostream private_cerr;
00028 
00029   tm_ostream (const tm_ostream&);
00030   tm_ostream& operator= (const tm_ostream&);
00031 
00032 public:
00033   static tm_ostream& cout;
00034   static tm_ostream& cerr;
00035 
00036   tm_ostream ();
00037   tm_ostream (char*);
00038   tm_ostream (FILE*);
00039   ~tm_ostream ();
00040 
00041   bool open ();
00042 //  bool open (url);
00043   bool open (char*);
00044   bool open (FILE*);
00045   bool is_writable () const;
00046   bool is_buffered () const;
00047   void flush ();
00048   void close ();
00049   void buffer ();
00050   string unbuffer ();
00051 
00052   tm_ostream& operator << (bool);
00053   tm_ostream& operator << (char);
00054   tm_ostream& operator << (short);
00055   tm_ostream& operator << (unsigned short);
00056   tm_ostream& operator << (int);
00057   tm_ostream& operator << (unsigned int);
00058   tm_ostream& operator << (long);
00059   tm_ostream& operator << (unsigned long);
00060   tm_ostream& operator << (long long int);
00061   tm_ostream& operator << (unsigned long long int);
00062   tm_ostream& operator << (float);
00063   tm_ostream& operator << (double);
00064   tm_ostream& operator << (long double);
00065   tm_ostream& operator << (const char*);
00066 
00067   bool operator == (tm_ostream&);
00068 };
00069 
00070 extern tm_ostream& cout;
00071 extern tm_ostream& cerr;
00072 
00073 #endif // defined OUT_STREAM_HPP