liblcf
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ini.cpp File Reference
#include <cstdio>
#include <cctype>
#include <cstring>
#include "ini.h"
+ Include dependency graph for ini.cpp:

Go to the source code of this file.

Macros

#define MAX_LINE   200
 
#define MAX_SECTION   50
 
#define MAX_NAME   50
 

Functions

static unsigned char * rstrip (unsigned char *s)
 
static char * lskip (const unsigned char *s)
 
static char * find_char_or_comment (const unsigned char *s, char c)
 
static char * strncpy0 (char *dest, const char *src, size_t size)
 
int ini_parse (const char *filename, int(*handler)(void *, const char *, const char *, const char *), void *user)
 

Macro Definition Documentation

#define MAX_LINE   200

Definition at line 41 of file ini.cpp.

Referenced by ini_parse().

#define MAX_NAME   50

Definition at line 43 of file ini.cpp.

Referenced by ini_parse().

#define MAX_SECTION   50

Definition at line 42 of file ini.cpp.

Referenced by ini_parse().

Function Documentation

static char* find_char_or_comment ( const unsigned char *  s,
char  c 
)
static
Returns
pointer to first char c or ';' comment in given string, or pointer to null at end of string if neither found. ';' must be prefixed by a whitespace character to register as a comment.

Definition at line 73 of file ini.cpp.

Referenced by ini_parse().

+ Here is the caller graph for this function:

int ini_parse ( const char *  filename,
int(*)(void *, const char *, const char *, const char *)  handler,
void *  user 
)

Definition at line 94 of file ini.cpp.

References find_char_or_comment(), lskip(), MAX_LINE, MAX_NAME, MAX_SECTION, rstrip(), and strncpy0().

Referenced by INIReader::INIReader().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char* lskip ( const unsigned char *  s)
static
Returns
pointer to first non-whitespace char in given string.

Definition at line 61 of file ini.cpp.

Referenced by ini_parse().

+ Here is the caller graph for this function:

static unsigned char* rstrip ( unsigned char *  s)
static

Strip whitespace chars off end of given string, in place.

Returns
s.

Definition at line 50 of file ini.cpp.

Referenced by ini_parse().

+ Here is the caller graph for this function:

static char* strncpy0 ( char *  dest,
const char *  src,
size_t  size 
)
static

Version of strncpy that ensures dest (size bytes) is null-terminated.

Definition at line 86 of file ini.cpp.

Referenced by ini_parse().

+ Here is the caller graph for this function: