Go to the source code of this file.
Data Structures | |
struct | StringArray |
Defines | |
#define | STRINGARRAY_VERSION "1.3.1" |
#define | STRINGARRAY_DATE "19-Dec-2003" |
#define | STRINGARRAY_STARTSIZEOFARRAY 50 |
This value sets the size of arrayOfStrings if a new structure StringArray is created. | |
Typedefs | |
typedef StringArray * | StringArray_Ptr |
A pointer to structure StringArray is assigned the name StringArrayPtr . | |
Functions | |
StringArray_Ptr | StringArray_create (void) |
Creates a StringArray structure. | |
StringArray_Ptr | StringArray_createWithSpecifiedArraySize (const int sizeOfArray) |
Creates a StringArray structure. | |
void | StringArray_destroy (StringArray_Ptr sAPtr) |
Destroys a structure StringArray. | |
void | StringArray_extend (const StringArray_Ptr sAPtr) |
Extends the array size of a structure StringArray. | |
void | StringArray_display (StringArray_Ptr sAPtr, FILE *outputStream) |
Displays a structure StringArray. | |
StringArray_Ptr | StringArray_copy (const StringArray_Ptr sAPtr) |
A deepcopy of sAPtr is returned. | |
void | StringArray_concatenate (const StringArray_Ptr sAPtrTarget, const StringArray_Ptr sAPtrSource) |
A copy of each string in sAPtrSource is added to sAPtrTarget . | |
void | StringArray_mapConcatenate (const StringArray_Ptr sAPtr, const char *source) |
source is added to each element (char*) of sAPtr . | |
int | StringArray_getNumberOfElements (const StringArray_Ptr sAPtr) |
Returns the number of elements of a structure StringArray. | |
int | StringArray_getSizeOfArray (const StringArray_Ptr sAPtr) |
Returns the size of the array arrayOfStrings of a structure StringArray. | |
void | StringArray_addElement (const StringArray_Ptr sAPtr, char *string) |
A char* is added to the structure StringArray. | |
char * | StringArray_getElement (const StringArray_Ptr sAPtr, const int index) |
The char* of the element with index index of structure StringArray is returned. | |
int | StringArray_removeElement (StringArray_Ptr sAPtr, const char *string) |
All elements of sAPtr that are identical to string are removed. |
This structure provides a fault-tolerant way to store several strings. Strings are stored in sequential order with the function StringArray_addElement. The individual elements are accessed via their index starting from zero. Therefore, the index of the element with the highest index number is one less than numberOfElements
.
The structure is created with StringArray_create, destroyed with StringArray_destroy and displayed with StringArray_display. The number of elements of a structure is returned by the function StringArray_getNumberOfElements, the size of the array arrayOfStrings
is returned by the function StringArray_getSizeOfArray. Strings are added by StringArray_addElement and the value of an element is obtained by StringArray_getElement. Elements that are identical to a given string can be removed with StringArray_removeElement.
If an element is accessed via StringArray_getElement and the index is higher than numberOfElements
- 1 (number of elements of this structure) the define IndexOutOfBoundsError is called and the program aborts.
The size of arrayOfStrings
can grow during the lifetime of a structure StringArray. When a structure StringArray is created with StringArray_create the initial size of arrayOfStrings
is set to STRINGARRAY_STARTSIZEOFARRAY. StringArray_addElement checks if numberOfElements
exceeds sizeOfArray
and, if necessary, resizes the string array automatically via StringArray_extend. As there is currently no function to remove elements arrayOfStrings
can not shrink during the lifetime of an instance of StringArray!
arrayOfStrings
. The char* is not copied and therefore must not be freed after the assignment! If StringArray_destroy is called the memory of all elements in arrayOfStrings
is freed automatically.arrayOfStrings
- array of char*numberOfElements
- number of elements in the structuresizeOfArray
- size of the array arrayOfStrings
02/09/2003 - v1.1.0 - Uli Fechner - major change: the size of the string array (arrayOfStrings
) can now grow during the lifetime of a structure StringArray; this is handled automatically by StringArray_addElement if numberOfElements
exceeds sizeOfArray
; added STRINGARRAY_STARTSIZEOFARRAY, StringArray_createWithSpecifiedArraySize and StringArray_extend; changes in StringArray_create and StringArray_addElement
08/09/2003 - v1.1.1 - Uli Fechner - small modification in the output format of StringArray_display
08/09/2003 - v1.2.0 - Uli Fechner - bugfix related to the extension of the array (StringArray_addElement and StringArray_extend); modified the headers of both functions
15/10/2003 - v1.2.1 - Uli Fechner - changed the define STRINGARRAY_STARTSIZEOFARRAY
10/12/2003 - v1.2.2 - Uli Fechner - added function StringArray_concatenate
17/12/2003 - v1.3.0 - Uli Fechner - added function StringArray_copy and StringArray_mapConcatenate
19/12/2003 - v1.3.1 - Uli Fechner - added function StringArray_removeElement \code
Definition in file stringArray.c.
|
Definition at line 3 of file stringArray.c. |
|
This value sets the size of
Definition at line 81 of file stringArray.c. Referenced by StringArray_create(). |
|
Definition at line 2 of file stringArray.c. |
|
A pointer to structure StringArray is assigned the name
Definition at line 71 of file stringArray.c. Referenced by readDataFromStream(), SmilesCompound_getStringArrayOfNames(), StringArray_copy(), StringArray_create(), StringArray_createWithSpecifiedArraySize(), and StringArray_removeElement(). |
|
A char* is added to the structure StringArray.
The char* is added to the array
Definition at line 404 of file stringArray.c. References StringArray::arrayOfStrings, StringArray::numberOfElements, StringArray::sizeOfArray, and StringArray_extend(). Referenced by readDataFromStream(), SmilesCompound_addName(), SmilesCompound_create(), SmilesCompound_setName(), StringArray_concatenate(), and StringArray_copy(). |
|
A copy of each string in
Definition at line 310 of file stringArray.c. References MemoryError, StringArray::numberOfElements, StringArray_addElement(), and StringArray_getElement(). Referenced by SmilesCompound_identical(). |
|
A deepcopy of
Definition at line 276 of file stringArray.c. References MemoryError, StringArray::numberOfElements, StringArray_addElement(), StringArray_create(), StringArray_getElement(), and StringArray_Ptr. Referenced by SmilesCompound_copy(), and StringArray_removeElement(). |
|
Creates a StringArray structure.
A StringArray structure is created. The size of the array
Definition at line 129 of file stringArray.c. References StringArray_createWithSpecifiedArraySize(), StringArray_Ptr, and STRINGARRAY_STARTSIZEOFARRAY. Referenced by readDataFromStream(), SmilesCompound_addName(), SmilesCompound_create(), SmilesCompound_setName(), and StringArray_copy(). |
|
Creates a StringArray structure.
A StringArray structure is created. The size of the array
Definition at line 144 of file stringArray.c. References StringArray::arrayOfStrings, MemoryError, StringArray::numberOfElements, StringArray::sizeOfArray, and StringArray_Ptr. Referenced by StringArray_create(). |
|
Destroys a structure StringArray.
The structure StringArray the pointer
Definition at line 175 of file stringArray.c. References AbortProgram, StringArray::arrayOfStrings, and StringArray::numberOfElements. Referenced by readDataFromStream(), SmilesCompound_create(), SmilesCompound_destroy(), SmilesCompound_setName(), SmilesCompound_setSmiles(), and StringArray_removeElement(). |
|
Displays a structure StringArray.
The structure StringArray the pointer
Definition at line 244 of file stringArray.c. References StringArray::arrayOfStrings, and StringArray::numberOfElements. Referenced by readDataFromStream(), and SmilesCompound_display(). |
|
Extends the array size of a structure StringArray.
The array size of the structure StringArray is enlarged (more exactly: its size is doubled). This function is automatically called by StringArray_addElement if
Definition at line 212 of file stringArray.c. References StringArray::arrayOfStrings, MemoryError, StringArray::numberOfElements, and StringArray::sizeOfArray. Referenced by StringArray_addElement(). |
|
The char* of the element with index
The value of the element with index
Definition at line 425 of file stringArray.c. References StringArray::arrayOfStrings, IndexOutOfBoundsError, and StringArray::numberOfElements. Referenced by main(), StringArray_concatenate(), StringArray_copy(), and StringArray_mapConcatenate(). |
|
Returns the number of elements of a structure StringArray.
The number of elements of the structure StringArray the pointer
Definition at line 370 of file stringArray.c. References StringArray::numberOfElements. Referenced by main(), readDataFromStream(), and SmilesCompound_display(). |
|
Returns the size of the array
The size of the array
Definition at line 384 of file stringArray.c. References StringArray::sizeOfArray. |
|
Definition at line 339 of file stringArray.c. References StringArray::arrayOfStrings, MemoryError, StringArray::numberOfElements, and StringArray_getElement(). |
|
All elements of
Elements that are identical to
Definition at line 444 of file stringArray.c. References StringArray::arrayOfStrings, StringArray::numberOfElements, StringArray_copy(), StringArray_destroy(), and StringArray_Ptr. Referenced by SmilesCompound_removeFromArrayOfNames(). |