string-type.h File Reference

Contains the definition of the String. More...

#include <stdlib.h>
Include dependency graph for string-type.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  String
 Dynamic string handler. More...
 

Typedefs

typedef struct String String
 Dynamic string handler. More...
 

Functions

String strInit (char *str)
 Transforms a char* to a string. The char* MUST be a nul terminated array allocated with malloc. More...
 
unsigned int strLength (String *str)
 Returns the current string length. More...
 
void strPush (String *str, char c)
 Adds a character at the end of the string. More...
 
void strPushStr (String *str, char *str2)
 Add a string at the end of the current string. More...
 
char * strDuplicate (char *str)
 Create a perfect copy of the string given. Used when a malloc created string is needed. More...
 

Detailed Description

Contains the definition of the String.

Author
Bastien Philip (ebatsin)
Gaël Foppolo (gaelfoppolo)

Typedef Documentation

typedef struct String String

Dynamic string handler.

Allows to work on string an perform additions to the string without having to care about memory management and reallocations

Function Documentation

char* strDuplicate ( char *  str)

Create a perfect copy of the string given. Used when a malloc created string is needed.

Parameters
strThe original string
Returns
A new string created with malloc

Here is the caller graph for this function:

String strInit ( char *  str)

Transforms a char* to a string. The char* MUST be a nul terminated array allocated with malloc.

Parameters
strThe original string (the original is used, no copy is performed)
Returns
The newly created string structure
Author
Bastien Philip (ebatsin)
Gaël Foppolo (gaelfoppolo)

Here is the caller graph for this function:

unsigned int strLength ( String str)

Returns the current string length.

Parameters
strThe string of which the length is returned
Returns
The length of the string

Here is the caller graph for this function:

void strPush ( String str,
char  c 
)

Adds a character at the end of the string.

Parameters
strThe string at the end of which the char is added
cThe char to be added

Here is the caller graph for this function:

void strPushStr ( String str,
char *  str2 
)

Add a string at the end of the current string.

Parameters
strThe string at the end of which the second string is added
str2The string to be added (need to be nul terminated)

Here is the caller graph for this function: