rllib  1
rlinifile.h
Go to the documentation of this file.
1 /***************************************************************************
2  rlinifile.h - description
3  -------------------
4  begin : Tue Jan 02 2001
5  copyright : (C) 2001 by R. Lehrig
6  email : lehrig@t-online.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as *
13  * published by the Free Software Foundation *
14  * *
15  ***************************************************************************/
16 #ifndef _RL_INI_FILE_H_
17 #define _RL_INI_FILE_H_
18 
19 #include "rldefine.h"
20 #include "rlstring.h"
21 
25 class rlIniFile
26 {
27 public:
28  rlIniFile();
29  virtual ~rlIniFile();
30  int read(const char *filename);
31  int write(const char *filename);
32  const char *filename();
33  const char *text(const char *section, const char *name);
34  void setText(const char *section, const char *name, const char *text);
35  int printf(const char *section, const char *name, const char *format, ...);
36  void remove(const char *section);
37  void remove(const char *section, const char *name);
38  const char *firstSection();
39  const char *nextSection();
40  const char *firstName(const char *section);
41  const char *nextName(const char *section);
42  void setDefaultSection(const char *section);
43  const char *defaultSection();
51  const char *i18n(const char *tag, const char *default_text="");
88  const char *tr(const char *txt);
89 private:
90  typedef struct _rlSectionName_
91  {
93  char *name;
94  char *param;
96 
97  typedef struct _rlSection_
98  {
101  char *name;
102  }rlSection;
103 
104  void copyIdentifier(char *buf, const char *line);
105  void copyName(char *buf, const char *line);
106  void copyParam(char *buf, const char *line);
107  void deleteSectionNames(rlSection *section);
112 };
113 
114 int rlSetTranslator(const char *language, const char *inifile=NULL);
115 #ifndef SWIGPYTHON
116 const char *rltranslate(const char *txt, char **mytext=NULL);
117 const char *rltranslate2(const char *section, const char *txt, char **mytext=NULL);
118 #define rltr(txt) rltranslate(txt)
119 
120 #ifdef pvtr
121 #undef pvtr
122 #endif
123 #define pvtr(txt) rltranslate2(p->lang_section,txt,&p->mytext2)
124 #endif
125 
126 #endif
virtual ~rlIniFile()
Definition: rlinifile.cpp:39
void copyName(char *buf, const char *line)
Definition: rlinifile.cpp:82
const char * nextSection()
Definition: rlinifile.cpp:417
const char * tr(const char *txt)
Definition: rlinifile.cpp:500
const char * i18n(const char *tag, const char *default_text="")
Definition: rlinifile.cpp:493
const char * text(const char *section, const char *name)
Definition: rlinifile.cpp:208
void copyIdentifier(char *buf, const char *line)
Definition: rlinifile.cpp:70
struct rlIniFile::_rlSectionName_ rlSectionName
int read(const char *filename)
Definition: rlinifile.cpp:116
int currentSection
Definition: rlinifile.h:109
const char * rltranslate(const char *txt, char **mytext=NULL)
Definition: rlinifile.cpp:545
const char * rltranslate2(const char *section, const char *txt, char **mytext=NULL)
Definition: rlinifile.cpp:553
void deleteSectionNames(rlSection *section)
Definition: rlinifile.cpp:53
void setText(const char *section, const char *name, const char *text)
Definition: rlinifile.cpp:234
int currentName
Definition: rlinifile.h:109
void copyParam(char *buf, const char *line)
Definition: rlinifile.cpp:99
const char * firstSection()
Definition: rlinifile.cpp:411
rlString fname
Definition: rlinifile.h:110
rlSectionName * firstName
Definition: rlinifile.h:100
const char * defaultSection()
Definition: rlinifile.cpp:488
const char * filename()
Definition: rlinifile.cpp:203
void setDefaultSection(const char *section)
Definition: rlinifile.cpp:483
_rlSection_ * nextSection
Definition: rlinifile.h:99
_rlSectionName_ * nextName
Definition: rlinifile.h:92
int rlSetTranslator(const char *language, const char *inifile=NULL)
Definition: rlinifile.cpp:512
rlSection * _firstSection
Definition: rlinifile.h:108
int printf(const char *section, const char *name, const char *format,...)
Definition: rlinifile.cpp:343
struct rlIniFile::_rlSection_ rlSection
const char * nextName(const char *section)
Definition: rlinifile.cpp:455
const char * firstName(const char *section)
Definition: rlinifile.cpp:436
rlString default_section
Definition: rlinifile.h:111
int write(const char *filename)
Definition: rlinifile.cpp:172