Component index
Section index

Component loadfile


Search

Type

Function

Summary

Read a text file and process every lines

Description

void empty (LOADFILE_INFO &info)
void end (off_t filepos, LOADFILE_INFO &info)
void missing (const char *fname)
int oneline (const char *line, off_t filepos, int noline, LOADFILE_INFO &info)
void start (LOADFILE_INFO &info)

Examples

sample / loadfile component

Prototypes

int loadfile (SSTREAM &ss, bool strip)

Instead of walking a file, it receives a SSTREAM object, which can be anything. Return the number of line processed otherwise.

int loadfile (const char *fname, bool strip)

return -1 if any errors. Return the number of line processed otherwise.

int loadfile (CONFIG_FILE &cfg, bool strip)

return -1 if any errors. Return the number of line processed otherwise.

Functags

void empty (LOADFILE_INFO &info) Optional

Called when the file is empty

void end (off_t filepos, LOADFILE_INFO &info) Optional

Called after the last line has been processed

void missing (const char *fname) Optional

Called if the file is missing

int oneline (const char *line, off_t filepos, int noline, LOADFILE_INFO &info) Mandatory

Called for every line in the file

Line are striped (at the end) or not, based on the loadfile prototype used.

void start (LOADFILE_INFO &info) Optional

Called when the file is not empty, before the first line is processed