X11workbench Toolkit  1.0

'base class' structure for TEXT_OBJECT More...

#include <text_object.h>

Data Fields

unsigned long nArraySize
 allocated size of aLines array
 
unsigned long nEntries
 number of entries currently in the array - call WBCheckReAllocTextBuffer() before increasing
 
unsigned int nMaxCol
 The maximum column number for any line, rounded up by 'DEFAULT_TAB_WIDTH'.
 
unsigned int nMinMaxCol
 The 'smallest maximum' recorded in 'aLineCache'.
 
unsigned long aLineCache [TEXT_BUFFER_LINE_CACHE_SIZE]
 An array of line indices, sorted longest to least, for the 'longest lines'.
 
unsigned int aLineCacheLen [TEXT_BUFFER_LINE_CACHE_SIZE]
 The actual line lengths associated with 'aLineCache' (zero if unused)
 
char * aLines [2]
 array of 'lines'. each pointer is suballocated via WBAlloc()
 

Detailed Description

'base class' structure for TEXT_OBJECT

'base class' structure for TEXT_OBJECT

typedef struct s_text_buffer
{
unsigned long nArraySize; // allocated size of aLines array
unsigned long nEntries; // number of entries currently in the array
// cached information
unsigned int nMaxCol; // The maximum column number for any line, rounded up by 'DEFAULT_TAB_WIDTH'
unsigned int nMinMaxCol; // The 'smallest maximum' recorded in 'aLineCache'
unsigned long aLineCache[TEXT_BUFFER_LINE_CACHE_SIZE];
// An array of line indices, sorted longest to least, for the 'longest lines'
unsigned int aLineCacheLen[TEXT_BUFFER_LINE_CACHE_SIZE];
// The actual line lengths associated with 'aLineCache' (zero if unused)
char * aLines[2]; // array of 'lines' suballocated via WBAlloc()
};
typedef struct s_text_buffer TEXT_BUFFER;

The structure is assumed to have a variable length array 'aLines' at the end, which extends beyond the length of the base structure. 'nArraySize' indicates the maximum size of this array, and 'nEntries' indicates the (contiguous) actual size of the array, starting at element [0].
This is a simple array structure, and to insert a line in the middle you will need to use 'memmove()' following a call to WBCheckReAllocTextBuffer(), and then re-assign 'nEntries' as needed. New entries must be allocated via 'WBAlloc()'.
To allocate a new structure, call WBAllocTextBuffer(). To free an allocated structure, call WBFreeTextBuffer().
The 'cached information' data members are maintained internally. You should not alter them. You can re-evaluate them at any time by calling WBTextBufferLineChange() and WBTextBufferRefreshCache()

Definition at line 1087 of file text_object.h.


The documentation for this struct was generated from the following file: