EObjects

TEString

Constructors:
  

 TEString() - creates a new instance of the string
 TEString(const TEString &E)
 TEString(char *S)
 TEString(char C)

Function

return value

parameters

 

operator []

char &

int index

An index operator to work with data of the string

Data

char *

 

The function returns the pointer to the data of the object. You can use it as a normal string, for example to pass to the printf function: printf("\r\n%s", EString.Data();

Delete

void

int index
int count

Deletes specified portion of the string

Double(),

double

 

Returns a numerical representation of the string

FirstIndexOf

int

char C
int pos=-1

 

IndexOf

int

const TEString &SubString

 

Insert

void

char c
int pos
int count

Insert functions

Insert

void

char c
int pos

 

Insert

void

TEString S
int pos

 

Int int   Returns a numerical representation of the string
IsNumber bool   Returns true if all the characters of the string are numbers or '.' or ',';

LastIndexOf

int

char C
int pos=-1

Return the position of a character or substring. The Last and FirstIndexOf can take an extra parameter which specifies the position from which the search should be started. The functions return -1 if failed.

Length()

int

 

Returns the length of the string

LowerCase

TEString

 

 

operator !=

bool

TEString &S

 

operator !=

bool

const char *S

 

operator +

TEString

const TEString &C

 

operator +

TEString

const char *C

 

operator +=

void

double S

A set of operators to make the string operation easier

operator +=

void

const TEString &S

 

operator +=

void 

const char *S

 

operator +=

void 

char C

 

operator +=

void 

int S

 

operator <<

void

TIniStream *S

Loads the content of the string from a stream

operator =

void

const TEString &S

 

operator =

void

const char *S

 

operator =

void 

char C

 

operator =

void

int S

 

operator =

void

double S

 

operator ==

bool

const TEString &S

Equality operators

operator ==

bool

const char *S

 

operator >>

void

TIniStream *S

Saves the content of the string to a stream

SetCapacity

void

int Cap

Reallocates the memory occupied by the string to to the specified size. Use this option when a possible length of the string can be estimated

SetIncrement

void

int Inc

The default increment equals to four, which means that if you add characters to the string, then each four characters it will reallocate memory. Use this option when a routine operations are performed on a string. See also SetLength and SetCapacity.

SetLength

void

int s

Works like SetCapacity, but the length of the string changes to the specified value

static CommonString

TEString

const TEString &A
const  TEString &B

If two strings have the same beginning, then the function returns a common string

static FormatString

void

TEString &S
int count
bool Right
const TEString &Char

Adds a number of Char to the S string in order to make its length equal to the count. The Chars are added from left or from right as specified. Note that for example when an HTML string is being formatted, Char can be equal to ";&nbsp". The count parameter works is used so that the length of the Char string is considered equal to 1.

static RemoveChars

TEString

const TEString &S
char C

Removes all characters from the string and returns a new instance of the string

static RemoveMultiSpaces

TEString

const TEString &S
bool RemoveTrailing=true

Cleans the string up and returns "clean" copy and returns

static Strtok

void

const TEString &St
char Sep
TEStringList *L

 

static  FormatFloat

TEString

int NumberOfDigits
double v
bool Exponent=false

Returns a string representation of a floating point number. Use the NumberOfDigits and Exponent to specify the string appearance

static  Strtok

TEStringList*

const TEString &Str
char Sep

Separates a string into a list of strings using the Sep character. Note that the list returned by the function has to be deleted after use. An alternative call to the function takes a list instead.


SubString

TEString

int index
int count

Return a substring of current string. Note that SubString takes the starting index and the length, not the index of the end. Usually it is more convenient to use SubStringFrom and To.

SubStringFrom

TEString

int index

 

SubStringTo

TEString

int index

 

UpperCase

TEString

 

Return a copy of the string in upper case

 

TListSort

 

Constructor

TListSort()

Function

returns

arguments

This class encapsulates an object to perform sorting using more complex procedures than simple comparison of two items. Although you need to write a new class to do sorting using this object, it is beneficial, as it removes the necessity to  use global data and more object-oriented in this sense.

Compare

int void *I,
void *I1
Compares two values passed to the object.

 

TEList

 

Constructor

TEList()

Function

returns

arguments

 

Add

void

TEList &E

Adds the content of E to the end of the list

Add

void

void *

Adds an new item at the and of the list

Assign

void

TEList &E

Copies the content of the E list to the list, previous content will be lost

Clear

void

 

Sets the Count property of the list to 0

Count

int

 

Returns current quantity of elements in the list

Delete

void

int index

Dleteas the item at the index position

IndexOf

int

void *Data

Return the index of the Data or -1 if the object is not in the lsit

Insert

void

int index
void *D

Inserts a new item at the index position

Item

void * &

int index

An alternative to the [] operator. Returns the pointer to the object at the index position. You can also assign to the item

operator []

void * &

int index

Returns the pointer to the object at the index position

Pack

void

 

Removes NULL pointers from the list

Remove

void

const void *O

Removes O from the list. In order to improve the performance, if a subsequent removal operations are required, please assign values of the object being removed to NULL in the list and when the iteration is completed, call to the Pack method.

SetCapacity

void

int v

Reallocates the memory occupied by the list to fit at least v members

SetCount

void

int v

Reallocates the memory occupied by the list to fit at least v members without the reallocation of memory and sets the Count property to v. Use the option when you know the how many items are going to be placed in the list.

SetIncrement

void

int v

The default increment equals to four, which means that if after each four new items added to thel  its it will reallocate memory. Use this option when a routine operations are performed on a list. See also SetCount and SetCapacity.

Sort

void

ListSort v

Sorts the list using quick-sort algorithm

Sort

void

TListSort *v

Sorts the list using quick-sort algorithm

Swap void int i,
int j
Swaps the position of two elements

typedef int (*ListSort)(const void *I1, const void *I2) 

The comparison function used in the sort method. Returns 0 if the items are equal, -1 if I1 is less than I2 and +1 otherwise

 

TEStringList

 

Constructor

TEStringList()

Function

returns

arguments

 

Add

void

TEStringList *S

Adds the content of the S list to current list

Add

void

const TEString &S

Adds a new string to the list

Add

void

const char *S

--//--

AddObject

void

const TEString &S
void *Object

Adds a new string and an objects associated with it to the list

Assign

void

TEStringList *S

Empties the list and copies the content of the S list

Clear()

void

 

Empties the content of the list

Count()

int

 

Returns current quantity of strings in the list

DataSort

void

ListSort *S

Sorts the list by comparing the objects using the S function.  Note that the void* passed to the function are of the TEStrListData type.

DataSort

void

TListSort *S

Sorts the list by comparing the objects using the S object. Note that the void* passed to the Compare function are of the TEStrListData type.

Delete

void

int Index

Deletes a string (and the object) at specified position

IndexOf

int

const TEString &C

Returns index of a given string or -1 if the string is not in the list

IndexOf

int

void *Data

Returns index of a given object or -1 if the object is not in the list

Insert

void

int index
const TEString &S

Inserts a new string to the list at the index position

InsertObject

void

int index
const TEString &S
void *Object

Inserts a new string and an objects associated with it to the list at the index position

LoadFromFile

bool

const TEString &F

Loads the list form a file

Object

void *&

int Index

A function to access an object at the index position

Object

void *&

const TEString &Name

The function finds the first instance of the Name string in the list and returns the object associated with the string.

operator []

TEString &

int Index

An operator to access the strings of the list

operator <<

void

TIniStream *S

Loads the content of the list from a stream

operator >>

void

TIniStream *S

Saves the content of the list to a stream

SaveToFile

bool

const TEString &F

Saves the list to a file

SetCount

void

int Count

Expands or shrinks the list. If the list is expanded, the new items are initialised with NULL pointers for objects and empty strings.

Sort()

void

 

Sorts the list by comparing the strings

String(int i)

TEString &

int Index

A function to access a string at the index position

Text()

TEString

const TEString &Sep

Returns the content of the list in a string. The items are separated by Sep. For example use Sep = "<br>" for an HTML strings.

 

TETable

Constructors

 

 

 TETable()
TETable(int RowCnt, int ColCnt)

Function

return value

parameters

 

AddCol

void

const TEString & Caption

Add a new column at the end of the table and assigns its caption to the Caption

AddRow

TEStringList *

const TEString &Caption

Add a new row at the end of the table and assigns its caption to the Caption

Clear

void

 

Empties the content of the table

ColCount

int

 

Returns current number of rows

ColIndex

int

const TEString &Caption

Returns the index of a column with captions equals to N

ColName

TEString &

int index

Returns a reference to the column name at the index position

CreateHTMLList

void

TEStringList &L
const TEString &Title
bool ColNames
bool RowNames

Creates an HTML table and puts it to the L. ColNames and RowNames specify if the the column and row names should be included in the table.

EmptyCol

void

int index
bool EmptyCaption

Empties the content of a specified column. Set EmptyCaption to true to empty the column caption as well.

EmptyContent

void

bool EmptyCaptions

Empties the content of the table. Set EmptyCaptions to true to empty row and column captions as well.

EmptyRow

void

int index
bool EmptyCaption

Empties the content of a specified row. Set EmptyCaption to true to empty the row caption as well.

Find

bool

const TEString &What
int &row
int &col

Find a string in the table and assigns row and col  to the index of the string. If the string is found returns true and  false otherwise

FindCol

bool

const TEString &What
int &col

Find a string in a specified column col  and assigns col to the row in where the string was located (if the string is found). If the string is found returns true and  false otherwise

FindRow

bool

const TEString &What
int &row

Find a string in a specified row row  and assigns row to the column in where the string was located (if the string is found). If the string is found returns true and  false otherwise

InsertCol

void

nt index
const TEString &Caption

Inserts a column with specified caption at the index  position

InsertRow

TEStringList *

nt index
const TEString &Caption

Inserts a row with specified caption at  the index  position

operator []

TEStringList &

int index

Returns a row at the index position. If the table is static, you can use Table[i][j] to access the strings of the table, otherwise use different syntax.

Resize

void

int RowCnt
int ColCnt

Resizes the table. The function does not empty the content of the table, to do so use the EmptyContent function

Row

TEStringList *

int index

Returns a row at the index position. Use String and Object functions of the tEStringList to access the strings and objects of the table.

RowCount

int

 

Returns current number of rows

RowIndex

int

const TEString &Caption

Returns the index of a row with captions equals to N

RowName

TEString &

int index

Returns a reference to the column name at the index position

SetColCount

void

int

Resizes the table

SetRowCount

void

int

Resizes the table

 

TEStream

 

Constructor

 

 

TEStream()

Function

returns

arguments

 

Data

char *

 

Returns the pointer to memory containing data

LoadFromFile

bool

const TEString &F

Loads the stream from a file

Position

int

 

Returns current position, from where read/write operations are executed

Read

int

void *Data
int Count

Read Count bytes to Data from the stream and returns updated value of the Position

SaveToFile

bool

const TEString &F

Saves the stream to file

SetCapacity

void

int v

Reallocates the memory available for writing data without further reallocation

SetPosition

void

int pos

Sets current position from where read/write operations start to pos

Size

int

 

Returns current size of the stream

Write

int

void *Data
int Count

Writes Count bytes of Data to the stream and returns updated value of the Position

 

TIniStream implements TEStream and adds new operators for read/write operations. The operators include the majority of scalar types (bool, char, short int, int, long int, float and double). Some additional functionality includes the possibility to swap the content of a stream to a temporary file

 

TEStack

 

Constructor

 

 

TEStack

Function

return value

parameters

 

Capacity

int

 

Returns the number of the strings in the stack

Clear

void

 

Empties the content of the stack

Empty

bool

 

Returns true if the stack is empty and false otherwise

LoadFromExpression

int

const TEString &Exp

Was created for an internal use by the Symmetry Parser procedure; however could be useful for something else: the procedure goes along the Exp and finds arithmetic operators. All the strings separated by arithmetic operators are put into the stack alongside with the separating operators. The function returns the number of operators.

Pop

TEString Val

 

Removes and returns the string from the top of the stack

Push

void

const TEString &Val

Puts a string at the top of the stack

 

struct TEStrListData
{
    TEString String;
    void *Data;
};

© Oleg V. Dolomanov, 2004
Last Updated 2004.05.15