TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
string_utils.h
Go to the documentation of this file.
1// Copyright (C) 2004 Johnny Mariethoz (Johnny.Mariethoz@idiap.ch)
2// and Samy Bengio (bengio@idiap.ch)
3// and Ronan Collobert (collober@iro.umontreal.ca)
4// and Christos Dimitrakakis (dimitrak@idiap.ch)
5//
6// This file is based on code from Torch. Release II.
7/***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef STRING_UTILS_INC
17#define STRING_UTILS_INC
18
19#include <stdio.h>
20#include <stdlib.h>
21#include <learning/learn_debug.h>
22
34
35typedef struct StringBuffer_ {
36 char* c;
37 char* string;
38 unsigned int length;
40
43
45extern void FreeStringBuffer (StringBuffer** s);
46
47extern StringBuffer* SetStringBufferLength (StringBuffer* s, unsigned int l);
48
52extern char *strBaseName(char *filename);
53
57extern char *strRemoveSuffix(char *filename, char c='.');
58
63extern char *strConcat(int n, ...);
64
66extern void message(const char* msg, ...);
68extern StringBuffer* read_string (FILE* f, StringBuffer* s);
70extern char* string_copy (char* c);
72
73
74
75#endif
Scalar length(const Quaternion &q)
Definition Quaternion.h:193
char * strConcat(int n,...)
Returns the concatenation n strings.
char * string_copy(char *c)
copies a string
struct StringBuffer_ StringBuffer
The StringBuffer structure stores buffers of strings.
char * strRemoveSuffix(char *filename, char c='.')
Returns a fresh copy of the name of a file without suffix.
StringBuffer * read_string(FILE *f, StringBuffer *s)
Reads a string dynamically.
char * strBaseName(char *filename)
Returns the name of a file without leading pathname.
void message(const char *msg,...)
Prints a message.
void FreeStringBuffer(StringBuffer **s)
Given a pointer to a stringbuffer pointer, free it and clear it.
StringBuffer * NewStringBuffer(int length)
Make a new stringbuffer.
StringBuffer * SetStringBufferLength(StringBuffer *s, unsigned int l)
The StringBuffer structure stores buffers of strings.
char * string
This is the string.
unsigned int length
This is the buffer length.
char * c
This is the buffer.