Logo ROOT  
Reference Guide
TGTextBuffer.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 05/05/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGTextBuffer
13#define ROOT_TGTextBuffer
14
15
16#include "TString.h"
17
18
20
21private:
23
24 TGTextBuffer(const TGTextBuffer&) = delete;
26
27public:
29 TGTextBuffer(Int_t length): fBuffer(length) {}
30 virtual ~TGTextBuffer() {}
31
32 UInt_t GetTextLength() const { return fBuffer.Length(); }
33 UInt_t GetBufferLength() const { return fBuffer.Capacity(); }
34 const char *GetString() const { return fBuffer.Data(); }
35
36 void AddText(Int_t pos, const char *text) { fBuffer.Insert(pos, text); }
37 void AddText(Int_t pos, const char *text, Int_t length) { fBuffer.Insert(pos, text, length); }
38 void RemoveText(Int_t pos, Int_t length) { fBuffer.Remove(pos, length); }
39 void Clear() { fBuffer.Remove(0, fBuffer.Length()); }
40
41 ClassDef(TGTextBuffer,0) // Text buffer used by widgets like TGTextEntry, etc.
42};
43
44#endif
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
#define ClassDef(name, id)
Definition: Rtypes.h:325
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Definition: TGTextBuffer.h:19
UInt_t GetBufferLength() const
Definition: TGTextBuffer.h:33
void AddText(Int_t pos, const char *text)
Definition: TGTextBuffer.h:36
void AddText(Int_t pos, const char *text, Int_t length)
Definition: TGTextBuffer.h:37
const char * GetString() const
Definition: TGTextBuffer.h:34
void RemoveText(Int_t pos, Int_t length)
Definition: TGTextBuffer.h:38
TString fBuffer
Definition: TGTextBuffer.h:22
TGTextBuffer(const TGTextBuffer &)=delete
TGTextBuffer & operator=(const TGTextBuffer &)=delete
virtual ~TGTextBuffer()
Definition: TGTextBuffer.h:30
UInt_t GetTextLength() const
Definition: TGTextBuffer.h:32
TGTextBuffer(Int_t length)
Definition: TGTextBuffer.h:29
void Clear()
Definition: TGTextBuffer.h:39
Basic string class.
Definition: TString.h:136
Ssiz_t Length() const
Definition: TString.h:410
TString & Insert(Ssiz_t pos, const char *s)
Definition: TString.h:649
const char * Data() const
Definition: TString.h:369
Ssiz_t Capacity() const
Definition: TString.h:357
TString & Remove(Ssiz_t pos)
Definition: TString.h:673
TText * text