Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:06

0001 // @(#)root/gui:$Id$
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_TGTextViewStream
0012 #define ROOT_TGTextViewStream
0013 
0014 
0015 #include "TGTextView.h"
0016 #include <vector>
0017 #include <streambuf>
0018 #include <iostream>
0019 
0020 #if defined (R__WIN32) && defined (__MAKECINT__)
0021 typedef basic_streambuf<char, char_traits<char> > streambuf;
0022 #endif
0023 
0024 class TGTextViewStreamBuf : public std::streambuf
0025 {
0026 private:
0027    TGTextView *fTextView;
0028    std::vector<char> fLinebuffer;
0029 
0030 protected:
0031    std::vector<char> fInputbuffer;
0032    typedef std::char_traits<char> traits;
0033    int overflow(int = traits::eof()) override;
0034 
0035 public:
0036    TGTextViewStreamBuf(TGTextView *textview);
0037    ~TGTextViewStreamBuf() override {}
0038 
0039    ClassDef(TGTextViewStreamBuf, 0) // Specialization of std::streambuf
0040 };
0041 
0042 
0043 class TGTextViewostream : public TGTextView, public std::ostream
0044 {
0045 protected:
0046    TGTextViewStreamBuf fStreambuffer;
0047 
0048 public:
0049    TGTextViewostream(const TGWindow* parent = nullptr, UInt_t w = 1, UInt_t h = 1,
0050                      Int_t id = -1, UInt_t sboptions = 0,
0051                      Pixel_t back = TGTextView::GetWhitePixel());
0052    TGTextViewostream(const TGWindow *parent, UInt_t w, UInt_t h,
0053                      TGText *text, Int_t id, UInt_t sboptions, ULong_t back);
0054    TGTextViewostream(const TGWindow *parent, UInt_t w, UInt_t h,
0055                      const char *string, Int_t id, UInt_t sboptions,
0056                      ULong_t back);
0057    ~TGTextViewostream() override {}
0058 
0059    ClassDefOverride(TGTextViewostream, 0) // Specialization of TGTextView and std::ostream
0060 };
0061 
0062 #endif