Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGTextBuffer.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gui:$Id$
0002 // Author: Fons Rademakers   05/05/98
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGTextBuffer
0013 #define ROOT_TGTextBuffer
0014 
0015 #include "TString.h"
0016 
0017 class TGTextBuffer {
0018 
0019 private:
0020    TString    fBuffer;
0021 
0022    TGTextBuffer(const TGTextBuffer&) = delete;
0023    TGTextBuffer& operator=(const TGTextBuffer&) = delete;
0024 
0025 public:
0026    TGTextBuffer() : fBuffer() {}
0027    TGTextBuffer(Int_t length): fBuffer(length) {}
0028    virtual ~TGTextBuffer() {}
0029 
0030    UInt_t GetTextLength() const { return fBuffer.Length(); }
0031    UInt_t GetBufferLength() const { return fBuffer.Capacity(); }
0032    const char *GetString() const { return fBuffer.Data(); }
0033 
0034    void AddText(Int_t pos, const char *text) { fBuffer.Insert(pos, text); }
0035    void AddText(Int_t pos, const char *text, Int_t length) { fBuffer.Insert(pos, text, length); }
0036    void RemoveText(Int_t pos, Int_t length) { fBuffer.Remove(pos, length); }
0037    void Clear() { fBuffer.Remove(0, fBuffer.Length()); }
0038 
0039    ClassDef(TGTextBuffer,0)  // Text buffer used by widgets like TGTextEntry, etc.
0040 };
0041 
0042 #endif