liblcf
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.

Classes

struct  ini_parse_string_ctx
 

Macros

#define MAX_SECTION   50
 
#define MAX_NAME   50
 
#define HANDLER(u, s, n, v)   handler(u, s, n, v)
 

Functions

static char * rstrip (char *s)
 
static char * lskip (const char *s)
 
static char * find_chars_or_comment (const char *s, const char *chars)
 
static char * strncpy0 (char *dest, const char *src, size_t size)
 
int ini_parse_stream (ini_reader reader, void *stream, ini_handler handler, void *user)
 
int ini_parse_file (FILE *file, ini_handler handler, void *user)
 
int ini_parse (const char *filename, ini_handler handler, void *user)
 
static char * ini_reader_string (char *str, int num, void *stream)
 
int ini_parse_string (const char *string, ini_handler handler, void *user)
 

Macro Definition Documentation

◆ HANDLER

#define HANDLER (   u,
  s,
  n,
 
)    handler(u, s, n, v)

◆ MAX_NAME

#define MAX_NAME   50

Definition at line 49 of file ini.cpp.

◆ MAX_SECTION

#define MAX_SECTION   50

Definition at line 48 of file ini.cpp.

Function Documentation

◆ find_chars_or_comment()

static char* find_chars_or_comment ( const char *  s,
const char *  chars 
)
static

Definition at line 77 of file ini.cpp.

References INI_INLINE_COMMENT_PREFIXES.

Referenced by ini_parse_stream().

+ Here is the caller graph for this function:

◆ ini_parse()

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

Definition at line 245 of file ini.cpp.

References ini_parse_file().

Referenced by INIReader::INIReader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ini_parse_file()

int ini_parse_file ( FILE *  file,
ini_handler  handler,
void *  user 
)

Definition at line 239 of file ini.cpp.

References ini_parse_stream().

Referenced by ini_parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ini_parse_stream()

int ini_parse_stream ( ini_reader  reader,
void *  stream,
ini_handler  handler,
void *  user 
)

Definition at line 103 of file ini.cpp.

References find_chars_or_comment(), HANDLER, INI_INITIAL_ALLOC, INI_MAX_LINE, INI_START_COMMENT_PREFIXES, lskip(), MAX_NAME, MAX_SECTION, rstrip(), and strncpy0().

Referenced by ini_parse_file(), ini_parse_string(), and INIReader::INIReader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ini_parse_string()

int ini_parse_string ( const char *  string,
ini_handler  handler,
void *  user 
)

Definition at line 286 of file ini.cpp.

References ini_parse_stream(), ini_reader_string(), ini_parse_string_ctx::num_left, and ini_parse_string_ctx::ptr.

+ Here is the call graph for this function:

◆ ini_reader_string()

static char* ini_reader_string ( char *  str,
int  num,
void *  stream 
)
static

Definition at line 260 of file ini.cpp.

References ini_parse_string_ctx::num_left, and ini_parse_string_ctx::ptr.

Referenced by ini_parse_string().

+ Here is the caller graph for this function:

◆ lskip()

static char* lskip ( const char *  s)
static

Definition at line 67 of file ini.cpp.

Referenced by ini_parse_stream().

+ Here is the caller graph for this function:

◆ rstrip()

static char* rstrip ( char *  s)
static

Definition at line 58 of file ini.cpp.

Referenced by ini_parse_stream().

+ Here is the caller graph for this function:

◆ strncpy0()

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

Definition at line 95 of file ini.cpp.

Referenced by ini_parse_stream().

+ Here is the caller graph for this function: