Warning, file /include/root/TGText.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGText
0013 #define ROOT_TGText
0014
0015
0016 #include "TString.h"
0017
0018 #include "TGDimension.h"
0019
0020
0021 class TGTextLine {
0022
0023 friend class TGText;
0024
0025 protected:
0026 char *fString;
0027 ULong_t fLength;
0028 TGTextLine *fPrev;
0029 TGTextLine *fNext;
0030
0031 TGTextLine(const TGTextLine&);
0032 TGTextLine& operator=(const TGTextLine&);
0033
0034 public:
0035 TGTextLine();
0036 TGTextLine(TGTextLine *line);
0037 TGTextLine(const char *string);
0038 virtual ~TGTextLine();
0039
0040 void Clear();
0041 ULong_t GetLineLength() { return fLength; }
0042
0043 void DelText(ULong_t pos, ULong_t length);
0044 void InsText(ULong_t pos, const char *text);
0045 char *GetText(ULong_t pos, ULong_t length);
0046 char *GetText() const { return fString; }
0047 char *GetWord(ULong_t pos);
0048
0049 void DelChar(ULong_t pos);
0050 void InsChar(ULong_t pos, char character);
0051 char GetChar(ULong_t pos);
0052
0053 ClassDef(TGTextLine,0)
0054 };
0055
0056
0057 class TGText {
0058
0059 protected:
0060 TString fFilename;
0061 Bool_t fIsSaved;
0062 TGTextLine *fFirst;
0063 TGTextLine *fCurrent;
0064 Long_t fCurrentRow;
0065 Long_t fRowCount;
0066 Long_t fColCount;
0067 Long_t fLongestLine;
0068
0069 TGText(const TGText&);
0070 TGText& operator=(const TGText&);
0071
0072 void Init();
0073 Bool_t SetCurrentRow(Long_t row);
0074 void LongestLine();
0075
0076 public:
0077 TGText();
0078 TGText(TGText *text);
0079 TGText(const char *string);
0080 virtual ~TGText();
0081
0082 void Clear();
0083 Bool_t Load(const char *fn, Long_t startpos = 0, Long_t length = -1);
0084 Bool_t LoadBuffer(const char *txtbuf);
0085 Bool_t Save(const char *fn);
0086 Bool_t Append(const char *fn);
0087 Bool_t IsSaved() const { return fIsSaved; }
0088 const char *GetFileName() const { return fFilename.Data(); }
0089
0090 Bool_t DelChar(TGLongPosition pos);
0091 Bool_t InsChar(TGLongPosition pos, char c);
0092 char GetChar(TGLongPosition pos);
0093
0094 Bool_t DelText(TGLongPosition start, TGLongPosition end);
0095 Bool_t InsText(TGLongPosition pos, const char *buf);
0096 Bool_t InsText(TGLongPosition ins_pos, TGText *src, TGLongPosition start_src, TGLongPosition end_src);
0097 Bool_t AddText(TGText *text);
0098
0099 Bool_t DelLine(ULong_t pos);
0100 char *GetLine(TGLongPosition pos, ULong_t length);
0101 TString AsString();
0102 TGTextLine *GetCurrentLine() const { return fCurrent; }
0103 Bool_t BreakLine(TGLongPosition pos);
0104 Bool_t InsLine(ULong_t row, const char *string);
0105
0106 Long_t RowCount() const { return fRowCount; }
0107 Long_t ColCount() const { return fColCount; }
0108
0109 Long_t GetLineLength(Long_t row);
0110 Long_t GetLongestLine() const { return fLongestLine; }
0111
0112 void ReTab(Long_t row);
0113
0114 Bool_t Search(TGLongPosition *foundPos, TGLongPosition start, const char *searchString,
0115 Bool_t direction, Bool_t caseSensitive);
0116 Bool_t Replace(TGLongPosition start, const char *oldText, const char *newText,
0117 Bool_t direction, Bool_t caseSensitive);
0118
0119 ClassDef(TGText,0)
0120 };
0121
0122 #endif