00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGTextBuffer
00013 #define ROOT_TGTextBuffer
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ROOT_TString
00028 #include "TString.h"
00029 #endif
00030
00031
00032 class TGTextBuffer {
00033
00034 private:
00035 TString *fBuffer;
00036
00037 protected:
00038 TGTextBuffer(const TGTextBuffer& tb): fBuffer(tb.fBuffer) { }
00039 TGTextBuffer& operator=(const TGTextBuffer& tb)
00040 {if(this!=&tb) fBuffer=tb.fBuffer; return *this;}
00041
00042 public:
00043 TGTextBuffer(): fBuffer(new TString) { }
00044 TGTextBuffer(Int_t length): fBuffer(new TString(length)) { }
00045 virtual ~TGTextBuffer() { delete fBuffer; }
00046
00047 UInt_t GetTextLength() const { return fBuffer->Length(); }
00048 UInt_t GetBufferLength() const { return fBuffer->Capacity(); }
00049 const char *GetString() const { return fBuffer->Data(); }
00050
00051 void AddText(Int_t pos, const char *text) { fBuffer->Insert(pos, text); }
00052 void AddText(Int_t pos, const char *text, Int_t length) { fBuffer->Insert(pos, text, length); }
00053 void RemoveText(Int_t pos, Int_t length) { fBuffer->Remove(pos, length); }
00054 void Clear() { fBuffer->Remove(0, fBuffer->Length()); }
00055
00056 ClassDef(TGTextBuffer,0)
00057 };
00058
00059 #endif