rllib
1
|
#include <rlinifile.h>
Classes | |
struct | _rlSection_ |
struct | _rlSectionName_ |
Public Member Functions | |
rlIniFile () | |
virtual | ~rlIniFile () |
int | read (const char *filename) |
int | write (const char *filename) |
const char * | filename () |
const char * | text (const char *section, const char *name) |
void | setText (const char *section, const char *name, const char *text) |
int | printf (const char *section, const char *name, const char *format,...) |
void | remove (const char *section) |
void | remove (const char *section, const char *name) |
const char * | firstSection () |
const char * | nextSection () |
const char * | firstName (const char *section) |
const char * | nextName (const char *section) |
void | setDefaultSection (const char *section) |
const char * | defaultSection () |
const char * | i18n (const char *tag, const char *default_text="") |
const char * | tr (const char *txt) |
Private Types | |
typedef struct rlIniFile::_rlSectionName_ | rlSectionName |
typedef struct rlIniFile::_rlSection_ | rlSection |
Private Member Functions | |
void | copyIdentifier (char *buf, const char *line) |
void | copyName (char *buf, const char *line) |
void | copyParam (char *buf, const char *line) |
void | deleteSectionNames (rlSection *section) |
Private Attributes | |
rlSection * | _firstSection |
int | currentSection |
int | currentName |
rlString | fname |
rlString | default_section |
class for INI files as known from Windows.
Definition at line 25 of file rlinifile.h.
|
private |
|
private |
rlIniFile::rlIniFile | ( | ) |
Definition at line 29 of file rlinifile.cpp.
|
virtual |
Definition at line 39 of file rlinifile.cpp.
|
private |
Definition at line 70 of file rlinifile.cpp.
|
private |
Definition at line 82 of file rlinifile.cpp.
|
private |
Definition at line 99 of file rlinifile.cpp.
const char * rlIniFile::defaultSection | ( | ) |
Definition at line 488 of file rlinifile.cpp.
|
private |
Definition at line 53 of file rlinifile.cpp.
const char * rlIniFile::filename | ( | ) |
Definition at line 203 of file rlinifile.cpp.
const char * rlIniFile::firstName | ( | const char * | section | ) |
Definition at line 436 of file rlinifile.cpp.
const char * rlIniFile::firstSection | ( | ) |
Definition at line 411 of file rlinifile.cpp.
const char * rlIniFile::i18n | ( | const char * | tag, |
const char * | default_text = "" |
||
) |
Use this method for translating text within your application.
Example: ini->setDefaultSection("german"); printf("german_text=%s\n", ini->i18n("text1","This is text1") );
Definition at line 493 of file rlinifile.cpp.
const char * rlIniFile::nextName | ( | const char * | section | ) |
Definition at line 455 of file rlinifile.cpp.
const char * rlIniFile::nextSection | ( | ) |
Definition at line 417 of file rlinifile.cpp.
int rlIniFile::printf | ( | const char * | section, |
const char * | name, | ||
const char * | format, | ||
... | |||
) |
Definition at line 343 of file rlinifile.cpp.
int rlIniFile::read | ( | const char * | filename | ) |
Definition at line 116 of file rlinifile.cpp.
void rlIniFile::remove | ( | const char * | section | ) |
Definition at line 356 of file rlinifile.cpp.
void rlIniFile::remove | ( | const char * | section, |
const char * | name | ||
) |
Definition at line 378 of file rlinifile.cpp.
void rlIniFile::setDefaultSection | ( | const char * | section | ) |
Definition at line 483 of file rlinifile.cpp.
void rlIniFile::setText | ( | const char * | section, |
const char * | name, | ||
const char * | text | ||
) |
Definition at line 234 of file rlinifile.cpp.
const char * rlIniFile::text | ( | const char * | section, |
const char * | name | ||
) |
Definition at line 208 of file rlinifile.cpp.
const char * rlIniFile::tr | ( | const char * | txt | ) |
Use this method for translating text within your application.
Example:
#define TR(txt) d->translator.tr(txt)
typedef struct // (todo: define your data structure here) { rlIniFile translator; } DATA;
static int slotInit(PARAM *p, DATA *d) { if(p == NULL || d == NULL) return -1; d->translator.read("text.ini"); d->translator.setDefaultSection("DEUTSCH"); printf("test1=%s\n", TR("umlaute")); printf("test2=%s\n", TR("Xumlaute")); d->translator.setDefaultSection("ENGLISH"); printf("test1=%s\n", TR("umlaute")); printf("test2=%s\n", TR("Xumlaute")); }
With text.ini: [DEUTSCH] hello=Hallo world=Welt umlaute=äöüß
[ENGLISH] hello=Hello world=World umlaute=german_umlaute=äöüß
Definition at line 500 of file rlinifile.cpp.
int rlIniFile::write | ( | const char * | filename | ) |
Definition at line 172 of file rlinifile.cpp.
|
private |
Definition at line 108 of file rlinifile.h.
|
private |
Definition at line 109 of file rlinifile.h.
|
private |
Definition at line 109 of file rlinifile.h.
|
private |
Definition at line 111 of file rlinifile.h.
|
private |
Definition at line 110 of file rlinifile.h.