Logo ROOT   6.18/05
Reference Guide
TGTextViewStream.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2
3/*************************************************************************
4 * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_TGTextViewStream
12#define ROOT_TGTextViewStream
13
14//////////////////////////////////////////////////////////////////////////
15// //
16// TGTextViewStream //
17// //
18// A TGTextViewStream is a text viewer widget. It is a specialization //
19// of TGTextView and std::ostream, and it uses a TGTextViewStreamBuf, //
20// who inherits from std::streambuf, allowing to stream text directly //
21// to the text view in a cout-like fashion //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "TGTextView.h"
26#include <vector>
27#include <streambuf>
28#include <iostream>
29
30#if defined (R__WIN32) && defined (__MAKECINT__)
31typedef basic_streambuf<char, char_traits<char> > streambuf;
32#endif
33
34class TGTextViewStreamBuf : public std::streambuf
35{
36private:
38 std::vector<char> fLinebuffer;
39
40protected:
41 std::vector<char> fInputbuffer;
42 typedef std::char_traits<char> traits;
43 virtual int overflow(int = traits::eof());
44
45public:
48
49 ClassDef(TGTextViewStreamBuf, 0) // Specialization of std::streambuf
50};
51
52
53class TGTextViewostream : public TGTextView, public std::ostream
54{
55protected:
57
58public:
59 TGTextViewostream(const TGWindow* parent = 0, UInt_t w = 1, UInt_t h = 1,
60 Int_t id = -1, UInt_t sboptions = 0,
62 TGTextViewostream(const TGWindow *parent, UInt_t w, UInt_t h,
63 TGText *text, Int_t id, UInt_t sboptions, ULong_t back);
64 TGTextViewostream(const TGWindow *parent, UInt_t w, UInt_t h,
65 const char *string, Int_t id, UInt_t sboptions,
66 ULong_t back);
67 virtual ~TGTextViewostream() { }
68
69 ClassDef(TGTextViewostream, 0) // Specialization of TGTextView and std::ostream
70};
71
72#endif
ULong_t Pixel_t
Definition: GuiTypes.h:39
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
unsigned long ULong_t
Definition: RtypesCore.h:51
#define ClassDef(name, id)
Definition: Rtypes.h:326
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:691
virtual int overflow(int=traits::eof())
Method called to put a character into the controlled output sequence without changing the current pos...
std::vector< char > fLinebuffer
std::char_traits< char > traits
TGTextViewStreamBuf(TGTextView *textview)
TGTextViewStreamBuf constructor.
virtual ~TGTextViewStreamBuf()
std::vector< char > fInputbuffer
TGTextView * fTextView
virtual ~TGTextViewostream()
TGTextViewostream(const TGWindow *parent=0, UInt_t w=1, UInt_t h=1, Int_t id=-1, UInt_t sboptions=0, Pixel_t back=TGTextView::GetWhitePixel())
TGTextViewostream constructor.
TGTextViewStreamBuf fStreambuffer
Definition: TGText.h:67
TText * text