Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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//////////////////////////////////////////////////////////////////////////
17// //
18// TGTextBuffer //
19// //
20// A text buffer is used in several widgets, like TGTextEntry, //
21// TGFileDialog, etc. It is a little wrapper around the powerful //
22// TString class and used for single line texts. For multi line texts //
23// use TGText. //
24// //
25//////////////////////////////////////////////////////////////////////////
26
27#include "TString.h"
28
29
31
32private:
34
35 TGTextBuffer(const TGTextBuffer&) = delete;
37
38public:
40 TGTextBuffer(Int_t length): fBuffer(length) {}
41 virtual ~TGTextBuffer() {}
42
43 UInt_t GetTextLength() const { return fBuffer.Length(); }
44 UInt_t GetBufferLength() const { return fBuffer.Capacity(); }
45 const char *GetString() const { return fBuffer.Data(); }
46
47 void AddText(Int_t pos, const char *text) { fBuffer.Insert(pos, text); }
48 void AddText(Int_t pos, const char *text, Int_t length) { fBuffer.Insert(pos, text, length); }
49 void RemoveText(Int_t pos, Int_t length) { fBuffer.Remove(pos, length); }
50 void Clear() { fBuffer.Remove(0, fBuffer.Length()); }
51
52 ClassDef(TGTextBuffer,0) // Text buffer used by widgets like TGTextEntry, etc.
53};
54
55#endif
#define ClassDef(name, id)
Definition Rtypes.h:325
UInt_t GetBufferLength() const
void AddText(Int_t pos, const char *text)
void AddText(Int_t pos, const char *text, Int_t length)
const char * GetString() const
void RemoveText(Int_t pos, Int_t length)
TString fBuffer
TGTextBuffer(const TGTextBuffer &)=delete
TGTextBuffer & operator=(const TGTextBuffer &)=delete
virtual ~TGTextBuffer()
UInt_t GetTextLength() const
TGTextBuffer(Int_t length)
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