exip  Alpha 0.5.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
include/stringManipulate.h File Reference
#include "procTypes.h"
#include "errorHandle.h"

Go to the source code of this file.

Functions

errorCode allocateStringMemory (CharType **str, Index UCSchars)
 Allocate a memory for a string with UCSchars number of UCS characters It depends on the representation of the characters. More...
 
errorCode allocateStringMemoryManaged (CharType **str, Index UCSchars, AllocList *memList)
 Allocate a memory for a string with UCSchars number of UCS characters It depends on the representation of the characters. More...
 
errorCode writeCharToString (String *str, uint32_t code_point, Index *writerPosition)
 Writes a UCS [ISO/IEC 10646] code point to a string It depends on the representation of the characters. More...
 
uint32_t readCharFromString (const String *str, Index *readerPosition)
 Returns the UCS [ISO/IEC 10646] code point at particular index from a String. More...
 
void getEmptyString (String *emptyStr)
 Creates an empty string. More...
 
boolean isStringEmpty (const String *str)
 Checks if an string is empty. More...
 
errorCode asciiToString (const char *inStr, String *outStr, AllocList *memList, boolean clone)
 Transform a NULL terminated string of ASCII chars to String allocating memory for the CharType*. More...
 
boolean stringEqual (const String str1, const String str2)
 Tests if two strings are equal. More...
 
int stringCompare (const String str1, const String str2)
 Compare two strings lexicographically. More...
 
boolean stringEqualToAscii (const String str1, const char *str2)
 Checks if a String string and ASCII string are equal. More...
 
errorCode cloneString (const String *src, String *newStr)
 Makes a copy of the string in a new location. More...
 
errorCode cloneStringManaged (const String *src, String *newStr, AllocList *memList)
 Makes a copy of the string in a new location. More...
 
Index getIndexOfChar (const String *src, CharType sCh)
 Returns the index of the first occurrence of a character in a string. More...
 
errorCode stringToInteger (const String *src, int *number)
 Converts a string to int representation. More...
 
errorCode stringToInt64 (const String *src, int64_t *number)
 Converts a string to int64 representation. More...
 
void printString (const String *inStr)
 Prints out a String Used for debugging purposes. More...
 

Function Documentation

errorCode allocateStringMemory ( CharType **  str,
Index  UCSchars 
)
Parameters
[in,out]stra pointer to the uninitialized string
[in]UCScharsthe number of characters (as described by UCS [ISO/IEC 10646])
Returns
Error handling code

Definition at line 23 of file ASCII_stringManipulate.c.

errorCode allocateStringMemoryManaged ( CharType **  str,
Index  UCSchars,
AllocList memList 
)
Parameters
[in,out]stra pointer to the uninitialized string
[in]UCScharsthe number of characters (as described by UCS [ISO/IEC 10646])
[in,out]memListA list storing the memory allocations
Returns
Error handling code

Definition at line 31 of file ASCII_stringManipulate.c.

errorCode asciiToString ( const char *  inStr,
String outStr,
AllocList memList,
boolean  clone 
)
Parameters
[in]inStrASCII stream
[in,out]outStrresulted string
[in,out]memListA list storing the memory allocations
[in]cloneBoolean indicating if outStr should reuse the memory allocated for inStr if possible. FALSE - if String implementation allows it - do not allocate new memory for the string TRUE - always allocate fresh memory for outStr and copy inStr there
Returns
Error handling code

Definition at line 64 of file ASCII_stringManipulate.c.

errorCode cloneString ( const String src,
String newStr 
)
Parameters
[in]srcthe string to be copied
[in]newStrwill point to the newly allocated memory with scr->CharType* copied there
Returns
Error handling code

Definition at line 155 of file ASCII_stringManipulate.c.

errorCode cloneStringManaged ( const String src,
String newStr,
AllocList memList 
)
Parameters
[in]srcthe string to be copied
[in]newStrwill point to the newly allocated memory with scr->CharType* copied there
[in,out]memListA list storing the memory allocations
Returns
Error handling code

Definition at line 167 of file ASCII_stringManipulate.c.

void getEmptyString ( String emptyStr)
Parameters
[in,out]emptyStrempty string

Definition at line 51 of file ASCII_stringManipulate.c.

Index getIndexOfChar ( const String src,
CharType  sCh 
)
Parameters
[in]srcthe source string
[in]sCha character that is searched
Returns
the index of first occurrence; INDEX_MAX if not found

Definition at line 179 of file ASCII_stringManipulate.c.

boolean isStringEmpty ( const String str)
Parameters
[in]strstring to check
Returns
FALSE if not empty, TRUE if empty

Definition at line 57 of file ASCII_stringManipulate.c.

void printString ( const String inStr)
Parameters
[in]inStrInput string to be printed

Definition at line 272 of file ASCII_stringManipulate.c.

uint32_t readCharFromString ( const String str,
Index readerPosition 
)
Parameters
[in]strstring
[in,out]readerPosition,:[in] The position that marks the beginning of the character to be read [out] The position of the next character to be passed to a subsequent calls to readCharFromString
Returns
UCS code point

Definition at line 148 of file ASCII_stringManipulate.c.

int stringCompare ( const String  str1,
const String  str2 
)
Parameters
[in]str1string to compare
[in]str2string to compare
Returns
0 when the strings are equal; negative int when str1<str2; positive when str1>str2

Definition at line 122 of file ASCII_stringManipulate.c.

boolean stringEqual ( const String  str1,
const String  str2 
)
Parameters
[in]str1string to compare
[in]str2string to compare
Returns
TRUE if the strings are equal, FALSE - otherwise

Definition at line 88 of file ASCII_stringManipulate.c.

boolean stringEqualToAscii ( const String  str1,
const char *  str2 
)
Parameters
[in]str1string to compare
[in]str2null terminated string to compare
Returns
TRUE if the strings are equal, FALSE - otherwise

Definition at line 106 of file ASCII_stringManipulate.c.

errorCode stringToInt64 ( const String src,
int64_t number 
)

Only 10-base representation

Parameters
[in]srcthe source string
[out]numberthe int64 representation of the string
Returns
Error handling code

Definition at line 216 of file ASCII_stringManipulate.c.

errorCode stringToInteger ( const String src,
int *  number 
)

Only 10-base representation

Parameters
[in]srcthe source string
[out]numberthe int representation of the string
Returns
Error handling code

Definition at line 191 of file ASCII_stringManipulate.c.

errorCode writeCharToString ( String str,
uint32_t  code_point,
Index writerPosition 
)

The memory needed for str should be allocated before the invocation of this function

Parameters
[in,out]strstring to be written on
[in]code_pointUCS [ISO/IEC 10646] code point
[in,out]writerPosition,:[in] the index of the next CharType to be written i.e. str->str + *writerPosition is a pointer to the beginning of the next character position where the character with Code Point code_point will be written. [out] the next writerPosition used for any subsequent call to writeCharToString
Returns
Error handling code

Definition at line 42 of file ASCII_stringManipulate.c.