TStrList

List of ancestors:
TObj
Files:
strlist.h, strlist.cpp

Desc. & Idea Warnings Methods Attributes Operators Specials

 

Abstract  Abstract

Virtual  Virtual Overridden  Overridden
Key, Important  Key, Important Constructor  Constructor Destructor  Destructor
Methods beginning with Get or Set (get/set) are usually intended to access Attributes of same name (exceptions will be marked).

 

Description

TStrList maintain  a list of strings (including the order).

Title

 

Warnings

 

Title

 

Methods

Public:

Key, Important uint Append(const char *Line)
Key, Important BOOL Change(uint pos, const char *Line)
Key, Important void Clear()
Key, Important BOOL Delete(uint pos)
Key, Important uint GetCount() {return Count;}
Overridden uint GetSerSize(BOOL subclass=FALSE)
Key, Important uint Insert(uint pos,const char *Line)
void Save(char *FileName)
void Save(FILE *outf)
Overridden uint Serialize(BYTE **rawbytes,BOOL subclass=FALSE)
Key, ImportantConstructor TStrList()
Constructor TStrList(BYTE** raw,uint length,BOOL subclass)
Key, ImportantConstructor TStrList(TStrList &Pattern)
Destructor ~TStrList()

Protected:

BOOL Access(uint pos)

Private:

Title


uint Append(const char *Line)

Inserts the specified string at the end of the list..

Arguments:

Line....The string to be inserted.

Section Title


BOOL Change(uint pos, const char *Line)

Try to change the string at pos position. The old one is freed. If the pos is out of bounds nothing happens. The file is opened in rewrite mode. After the save the file is closed.

Arguments:

pos.....position, where the string should be changed
Line.....the new string

Returns:

TRUE if the change was successful
FALSE if the pos was outside the bounds

Section Title


void Clear()

Deletes all strings in the list.

Section Title


BOOL Delete(uint pos)

Deletes the string at the specified position. All strings at higher positions are moved.

Arguments:

pos....the position to be deleted

Returns:

TRUE....if the deletions was successful
FALSE....if the pos is out of bounds

Section Title


uint Insert(uint pos,const char *Line)

Inserts the specified string at the specified position. All following strings are moved. If pos is out of bounds the string is appended.
Eye.gif (947 bytes)Append

Arguments:

pos....position the string should be inserted at
Line...the string

Returns:

the position the string was inserted at

Section Title


void Save(char *FileName)

Saves the strings in the list to the specified file. Each string in the list is written to a separate line in the file.
Eye.gif (947 bytes)void Save(FILE *outf)

Arguments:

FileName....the name of the file

Section Title


void Save(FILE *outf)

Saves the strings in the list into the specified file. Each string in the list is written to a separate line in the file. The FILE should be opened as a text file.
Eye.gif (947 bytes)void Save(char *FileName)

Arguments:

outf.....pointer to the opened file

Section Title


TStrList()

Constructor. Creates an empty list.

Section Title


TStrList(BYTE** raw,uint length,BOOL subclass)

Deserialization.Eye.gif (947 bytes)TObj::TObj(BYTE** raw,uint length,BOOL subclass)

Section Title


TStrList(TStrList &Pattern)

Copy constructor. All strings are copied.

Arguments:

Pattern.....the pattern list

Section Title


~TStrList()

Destructor. All strings in the list are freed.

Section Title


BOOL Access(uint pos)

Try to set  the CurIndex and the Cur at the  specified position.

Arguments:

pos...position to be accessed

Returns:

TRUE...if the access was successful
FALSE...otherwise

Section Title


 

Attributes

Public:
Protected:

uint Count
TStrItem *Cur
uint CurIndex
TStrItem *First
TStrItem *Last

Private:

Title


 

uint Count

Number of strings in the list. (Added empty lines are also counted.)

Section Title


TStrItem *Cur

Pointer to a currently active item. Used to access the string.

Section Title


uint CurIndex

Index of the currently selected item..

Section Title


TStrItem *First

Pointer to the first item of the list..

Section Title


TStrItem *Last

Pointer to the last item of the list.

Section Title




Operators

Public:

Key, Important char *operator [] (uint index)
Key, Important TStrList &operator = (TStrList &Pattern)

Protected:
Private:

Title


char *operator [] (uint index)

Returns the string form the particular position. If the index is out of bounds empty string is returned.

Arguments:

index....the required position

Returns:

the string on the particular position

Section Title


TStrList &operator = (TStrList &Pattern)

Deletes all the existing strings and adds all strings from the pattern.

Arguments:

Pattern....Pattern to take the strings from.

Returns:

the modified TStrList

Section Title





Specials

The strings are copied not just the pointer taken.

Title