ESO Recipe Execution Tool  3.13
Classes | Functions
Array of Strings

Classes

struct  er_stringarray_t
 

Functions

er_stringarray_ter_stringarray_new (void)
 Creates a new er_stringarray. More...
 
void er_stringarray_resize (er_stringarray_t *csa, int size)
 Resizes a er_stringarray. More...
 
void er_stringarray_delete (er_stringarray_t *csa)
 Deletes a er_stringarray. More...
 
char * er_stringarray_get (er_stringarray_t *csa, int indx)
 Get a reference to the string at position index. More...
 
void er_stringarray_set (er_stringarray_t *csa, const char *instring, int indx)
 Sets position index in stringarray to a copy of the string given. More...
 
void er_stringarray_append (er_stringarray_t *csa, const char *instring)
 Adds a copy to given string at end of stringarray. More...
 
void er_stringarray_remove (er_stringarray_t *csa, int indx)
 Removes a string at position index. More...
 
int er_stringarray_present (er_stringarray_t *csa, int indx)
 Checks whether there is a string present at position index. More...
 
int er_stringarray_size (er_stringarray_t *csa)
 Returns current size aka capacity of stringarray. More...
 
void er_stringarray_print (er_stringarray_t *csa)
 Prints a stringarray to standardformat. More...
 

Detailed Description

This module provides a collection of functions that create, manipulate and destroy arrays of character strings.

Function Documentation

void er_stringarray_append ( er_stringarray_t csa,
const char *  instring 
)

Adds a copy to given string at end of stringarray.

Parameters
csaStringarray to operate on
instringString to store

Stores a copy to instring at the last position in csa.

void er_stringarray_delete ( er_stringarray_t csa)

Deletes a er_stringarray.

Parameters
csaStringarray to delete

Deletes all information stored in a er_stringarray. All strings contained in it are deleted. All memory associated with csa is properly deallocated.

char* er_stringarray_get ( er_stringarray_t csa,
int  indx 
)

Get a reference to the string at position index.

Parameters
csaStringarray to operate on
indxPosition in Stringarray

Returns A reference to the string stored at position indx in csa.

er_stringarray_t* er_stringarray_new ( void  )

Creates a new er_stringarray.

Returns
A newly allocated er_stringarray
int er_stringarray_present ( er_stringarray_t csa,
int  indx 
)

Checks whether there is a string present at position index.

Parameters
csaStringarray to operate on
indxPosition in stringarray
Returns
1 if there is, 0 if there is not.
void er_stringarray_print ( er_stringarray_t csa)

Prints a stringarray to standardformat.

Parameters
csaStringarray to operate on

The format is "index : stringcontents".

void er_stringarray_remove ( er_stringarray_t csa,
int  indx 
)

Removes a string at position index.

Parameters
csaStringarray to operate on
indxPosition in stringarray

Removes a string at position indx. Effectively creates a 'hole' in the stringarray.

void er_stringarray_resize ( er_stringarray_t csa,
int  size 
)

Resizes a er_stringarray.

Parameters
csaStringarray to resize
sizeNew size of string array

Resizes the stringarray so it can can contain size strings. If the new size is equal to the old size nothing happens. If the new size is less, all strings at the far side of the new size are properly deleted and the er_stringarray is shrunk to the new size. If the new size is larger than old size the array is grown to the new size, all string present are kept.

void er_stringarray_set ( er_stringarray_t csa,
const char *  instring,
int  indx 
)

Sets position index in stringarray to a copy of the string given.

Parameters
csaStringarray to operate on
instringString to store
indxPosition in Stringarray

Stores a copy of instring at position indx in csa.

int er_stringarray_size ( er_stringarray_t csa)

Returns current size aka capacity of stringarray.

Parameters
csaStringarray to operate on
Returns
Maximum number of strings the array can store