TORCS  1.3.9
The Open Racing Car Simulator
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...
 
typedef struct StringBuffer_ StringBuffer
 The StringBuffer structure stores buffers of strings. More...
 
StringBufferNewStringBuffer (int length)
 Make a new stringbuffer. More...
 
void FreeStringBuffer (StringBuffer **s)
 Given a pointer to a stringbuffer pointer, free it and clear it. More...
 
StringBufferSetStringBufferLength (StringBuffer *s, unsigned int l)
 
char * strBaseName (char *filename)
 Returns the name of a file without leading pathname. More...
 
char * strRemoveSuffix (char *filename, char c='.')
 Returns a fresh copy of the name of a file without suffix. More...
 
char * strConcat (int n,...)
 Returns the concatenation n strings. More...
 
void message (const char *msg,...)
 Prints a message. More...
 
StringBufferread_string (FILE *f, StringBuffer *s)
 Reads a string dynamically. More...
 
char * string_copy (char *c)
 copies a string More...
 

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)

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,
  ... 
)

Prints a message.

Definition at line 78 of file string_utils.cpp.

◆ NewStringBuffer()

StringBuffer* NewStringBuffer ( int  length)

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 
)

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 
)

Definition at line 130 of file string_utils.cpp.

Here is the call graph for this function:

◆ strBaseName()

char* strBaseName ( char *  filename)

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,
  ... 
)

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)

copies a string

Definition at line 165 of file string_utils.cpp.

◆ strRemoveSuffix()

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

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.