A TGText is a multi line text buffer.
It allows the text to be loaded from file, saved to file and edited. It is used in the TGTextEdit widget. Single line text is handled by TGTextBuffer and the TGTextEntry widget.
Public Member Functions | |
TGText () | |
Create default (empty) text buffer. | |
TGText (const char *string) | |
Create text buffer and initialize with single line string. | |
TGText (TGText *text) | |
Create text buffer and initialize with other text buffer. | |
virtual | ~TGText () |
Destroy text buffer. | |
Bool_t | AddText (TGText *text) |
Add another text buffer to this buffer. | |
Bool_t | Append (const char *fn) |
Append buffer to file fn. | |
TString | AsString () |
Returns content as ROOT string. | |
Bool_t | BreakLine (TGLongPosition pos) |
Break line at position pos. Returns false if pos is not valid. | |
void | Clear () |
Clear text buffer. | |
Long_t | ColCount () const |
Bool_t | DelChar (TGLongPosition pos) |
Delete character at specified position pos. | |
Bool_t | DelLine (ULong_t pos) |
Delete specified row. Returns false if row does not exist. | |
Bool_t | DelText (TGLongPosition start, TGLongPosition end) |
Delete text between start and end positions. | |
char | GetChar (TGLongPosition pos) |
Get character a position pos. If character not valid return -1. | |
TGTextLine * | GetCurrentLine () const |
const char * | GetFileName () const |
char * | GetLine (TGLongPosition pos, ULong_t length) |
Return string at position pos. | |
Long_t | GetLineLength (Long_t row) |
Get length of specified line. Returns -1 if row does not exist. | |
Long_t | GetLongestLine () const |
Bool_t | InsChar (TGLongPosition pos, char c) |
Insert character c at the specified position pos. | |
Bool_t | InsLine (ULong_t row, const char *string) |
Insert string before specified position. | |
Bool_t | InsText (TGLongPosition ins_pos, TGText *src, TGLongPosition start_src, TGLongPosition end_src) |
Insert src text from start_src to end_src into text at position ins_pos. | |
Bool_t | InsText (TGLongPosition pos, const char *buf) |
Insert single line at specified position. | |
virtual TClass * | IsA () const |
Bool_t | IsSaved () const |
Bool_t | Load (const char *fn, Long_t startpos=0, Long_t length=-1) |
Load text from file fn. | |
Bool_t | LoadBuffer (const char *txtbuf) |
Load a 0 terminated buffer. Lines will be split at ' '. | |
Bool_t | Replace (TGLongPosition start, const char *oldText, const char *newText, Bool_t direction, Bool_t caseSensitive) |
Replace oldText by newText. Returns false if nothing replaced. | |
void | ReTab (Long_t row) |
Redo all tabs in a line. Needed after a new tab is inserted. | |
Long_t | RowCount () const |
Bool_t | Save (const char *fn) |
Save text buffer to file fn. | |
Bool_t | Search (TGLongPosition *foundPos, TGLongPosition start, const char *searchString, Bool_t direction, Bool_t caseSensitive) |
Search for string searchString starting at the specified position going in forward (direction = true) or backward direction. | |
virtual void | Streamer (TBuffer &) |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Protected Member Functions | |
TGText (const TGText &) | |
copy constructor | |
void | Init () |
Common initialization method. | |
void | LongestLine () |
Set fLongestLine. | |
TGText & | operator= (const TGText &) |
assignment operator | |
Bool_t | SetCurrentRow (Long_t row) |
Make specified row the current row. | |
Protected Attributes | |
Long_t | fColCount |
number of columns in current line | |
TGTextLine * | fCurrent |
current line | |
Long_t | fCurrentRow |
current row number | |
TString | fFilename |
name of opened file ("" if open buffer) | |
TGTextLine * | fFirst |
first line of text | |
Bool_t | fIsSaved |
false if text needs to be saved | |
Long_t | fLongestLine |
length of longest line | |
Long_t | fRowCount |
number of rows | |
#include <TGText.h>
|
protected |
copy constructor
Definition at line 316 of file TGText.cxx.
TGText::TGText | ( | ) |
Create default (empty) text buffer.
Definition at line 363 of file TGText.cxx.
TGText::TGText | ( | TGText * | text | ) |
Create text buffer and initialize with other text buffer.
Definition at line 371 of file TGText.cxx.
TGText::TGText | ( | const char * | string | ) |
Create text buffer and initialize with single line string.
Definition at line 385 of file TGText.cxx.
|
virtual |
Destroy text buffer.
Definition at line 397 of file TGText.cxx.
Add another text buffer to this buffer.
Definition at line 911 of file TGText.cxx.
Bool_t TGText::Append | ( | const char * | fn | ) |
Append buffer to file fn.
Definition at line 651 of file TGText.cxx.
TString TGText::AsString | ( | ) |
Returns content as ROOT string.
Definition at line 1238 of file TGText.cxx.
Bool_t TGText::BreakLine | ( | TGLongPosition | pos | ) |
Break line at position pos. Returns false if pos is not valid.
Definition at line 1008 of file TGText.cxx.
|
static |
|
inlinestaticconstexpr |
void TGText::Clear | ( | ) |
Clear text buffer.
Definition at line 406 of file TGText.cxx.
|
inlinestatic |
Bool_t TGText::DelChar | ( | TGLongPosition | pos | ) |
Delete character at specified position pos.
Definition at line 691 of file TGText.cxx.
Delete specified row. Returns false if row does not exist.
Definition at line 964 of file TGText.cxx.
Bool_t TGText::DelText | ( | TGLongPosition | start, |
TGLongPosition | end | ||
) |
Delete text between start and end positions.
Returns false in case of failure (start and end not being within bounds).
Definition at line 736 of file TGText.cxx.
char TGText::GetChar | ( | TGLongPosition | pos | ) |
Get character a position pos. If character not valid return -1.
Definition at line 723 of file TGText.cxx.
|
inline |
char * TGText::GetLine | ( | TGLongPosition | pos, |
ULong_t | length | ||
) |
Return string at position pos.
Returns 0 in case pos is not valid. The returned string must be deleted by the user.
Definition at line 997 of file TGText.cxx.
Get length of specified line. Returns -1 if row does not exist.
Definition at line 1043 of file TGText.cxx.
|
protected |
Common initialization method.
Definition at line 349 of file TGText.cxx.
Bool_t TGText::InsChar | ( | TGLongPosition | pos, |
char | c | ||
) |
Insert character c at the specified position pos.
Definition at line 707 of file TGText.cxx.
Insert string before specified position.
Returns false if insertion failed.
Definition at line 928 of file TGText.cxx.
Bool_t TGText::InsText | ( | TGLongPosition | ins_pos, |
TGText * | src, | ||
TGLongPosition | start_src, | ||
TGLongPosition | end_src | ||
) |
Insert src text from start_src to end_src into text at position ins_pos.
Returns false in case of failure (start_src, end_src out of range for src, and ins_pos out of range for this).
Definition at line 785 of file TGText.cxx.
Bool_t TGText::InsText | ( | TGLongPosition | pos, |
const char * | buffer | ||
) |
Insert single line at specified position.
Return false in case position is out of bounds.
Definition at line 888 of file TGText.cxx.
|
inlinevirtual |
Load text from file fn.
Startpos is the begin from where to load the file and length is the number of characters to read from the file.
Definition at line 431 of file TGText.cxx.
Bool_t TGText::LoadBuffer | ( | const char * | txtbuf | ) |
Load a 0 terminated buffer. Lines will be split at '
'.
Definition at line 513 of file TGText.cxx.
|
protected |
Set fLongestLine.
Definition at line 1220 of file TGText.cxx.
assignment operator
Definition at line 331 of file TGText.cxx.
Bool_t TGText::Replace | ( | TGLongPosition | start, |
const char * | oldText, | ||
const char * | newText, | ||
Bool_t | direction, | ||
Bool_t | caseSensitive | ||
) |
Replace oldText by newText. Returns false if nothing replaced.
Definition at line 1197 of file TGText.cxx.
void TGText::ReTab | ( | Long_t | row | ) |
Redo all tabs in a line. Needed after a new tab is inserted.
Definition at line 1087 of file TGText.cxx.
Bool_t TGText::Save | ( | const char * | fn | ) |
Save text buffer to file fn.
Definition at line 610 of file TGText.cxx.
Bool_t TGText::Search | ( | TGLongPosition * | foundPos, |
TGLongPosition | start, | ||
const char * | searchString, | ||
Bool_t | direction, | ||
Bool_t | caseSensitive | ||
) |
Search for string searchString starting at the specified position going in forward (direction = true) or backward direction.
Returns true if found and foundPos is set accordingly.
Definition at line 1143 of file TGText.cxx.
Make specified row the current row.
Returns false if row does not exist. In which case fCurrent is not changed or set to the last valid line.
Definition at line 1055 of file TGText.cxx.
|
virtual |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |