00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _RL_INI_FILE_H_
00017 #define _RL_INI_FILE_H_
00018
00019 #include "rldefine.h"
00020 #include "rlstring.h"
00021
00025 class rlIniFile
00026 {
00027 public:
00028 rlIniFile();
00029 virtual ~rlIniFile();
00030 int read(const char *filename);
00031 int write(const char *filename);
00032 const char *filename();
00033 const char *text(const char *section, const char *name);
00034 void setText(const char *section, const char *name, const char *text);
00035 int printf(const char *section, const char *name, const char *format, ...);
00036 void remove(const char *section);
00037 void remove(const char *section, const char *name);
00038 const char *firstSection();
00039 const char *nextSection();
00040 const char *firstName(const char *section);
00041 const char *nextName(const char *section);
00042 void setDefaultSection(const char *section);
00043 const char *defaultSection();
00051 const char *i18n(const char *tag, const char *default_text);
00052 private:
00053 typedef struct _rlSectionName_
00054 {
00055 _rlSectionName_ *nextName;
00056 char *name;
00057 char *param;
00058 }rlSectionName;
00059
00060 typedef struct _rlSection_
00061 {
00062 _rlSection_ *nextSection;
00063 rlSectionName *firstName;
00064 char *name;
00065 }rlSection;
00066
00067 void copyIdentifier(char *buf, const char *line);
00068 void copyName(char *buf, const char *line);
00069 void copyParam(char *buf, const char *line);
00070 void deleteSectionNames(rlSection *section);
00071 rlSection *_firstSection;
00072 int currentSection, currentName;
00073 rlString fname;
00074 rlString default_section;
00075 };
00076
00077 #endif