TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
string_utils.h File Reference

Some simple functions for string operations. More...

#include <stdio.h>
#include <stdlib.h>
#include <learning/learn_debug.h>
Include dependency graph for string_utils.h:

Go to the source code of this file.

Classes

struct  StringBuffer_
 The StringBuffer structure stores buffers of strings. More...

Typedefs

typedef struct StringBuffer_ StringBuffer
 The StringBuffer structure stores buffers of strings.

Functions

StringBuffer * NewStringBuffer (int length)
 Make a new stringbuffer.
void FreeStringBuffer (StringBuffer **s)
 Given a pointer to a stringbuffer pointer, free it and clear it.
StringBuffer * SetStringBufferLength (StringBuffer *s, unsigned int l)
char * strBaseName (char *filename)
 Returns the name of a file without leading pathname.
char * strRemoveSuffix (char *filename, char c='.')
 Returns a fresh copy of the name of a file without suffix.
char * strConcat (int n,...)
 Returns the concatenation n strings.
void message (const char *msg,...)
 Prints a message.
StringBuffer * read_string (FILE *f, StringBuffer *s)
 Reads a string dynamically.
char * string_copy (char *c)
 copies a string

Detailed Description

Some simple functions for string operations.

Author
Samy Bengio (bengi.nosp@m.o@id.nosp@m.iap.c.nosp@m.h)
Johnny Mariethoz (Johnn.nosp@m.y.Ma.nosp@m.rieth.nosp@m.oz@i.nosp@m.diap..nosp@m.ch)
Ronan Collobert (collo.nosp@m.ber@.nosp@m.iro.u.nosp@m.mont.nosp@m.real..nosp@m.ca)
Christos Dimitrakakis (dimit.nosp@m.rak@.nosp@m.idiap.nosp@m..ch)

Definition in file string_utils.h.

Typedef Documentation

◆ StringBuffer

typedef struct StringBuffer_ StringBuffer

The StringBuffer structure stores buffers of strings.

Function Documentation

◆ FreeStringBuffer()

void FreeStringBuffer ( StringBuffer ** s)
extern

Given a pointer to a stringbuffer pointer, free it and clear it.

Definition at line 156 of file string_utils.cpp.

◆ message()

void message ( const char * msg,
... )
extern

Prints a message.

Definition at line 78 of file string_utils.cpp.

◆ NewStringBuffer()

StringBuffer * NewStringBuffer ( int length)
extern

Make a new stringbuffer.

Definition at line 143 of file string_utils.cpp.

Here is the call graph for this function:

◆ read_string()

StringBuffer * read_string ( FILE * f,
StringBuffer * s )
extern

Reads a string dynamically.

Definition at line 93 of file string_utils.cpp.

Here is the call graph for this function:

◆ SetStringBufferLength()

StringBuffer * SetStringBufferLength ( StringBuffer * s,
unsigned int l )
extern

Definition at line 130 of file string_utils.cpp.

Here is the call graph for this function:

◆ strBaseName()

char * strBaseName ( char * filename)
extern

Returns the name of a file without leading pathname.

(It's not a new string, but a pointer in the given string)

Definition at line 25 of file string_utils.cpp.

◆ strConcat()

char * strConcat ( int n,
... )
extern

Returns the concatenation n strings.

The strings are the parameters given after n You have to free the memory!

Definition at line 49 of file string_utils.cpp.

◆ string_copy()

char * string_copy ( char * c)
extern

copies a string

Definition at line 165 of file string_utils.cpp.

◆ strRemoveSuffix()

char * strRemoveSuffix ( char * filename,
char c = '.' )
extern

Returns a fresh copy of the name of a file without suffix.

(Trailing chars after c) You have to free the memory!

Definition at line 30 of file string_utils.cpp.