diff options
author | alberth <alberth@openttd.org> | 2011-03-03 20:50:24 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2011-03-03 20:50:24 +0000 |
commit | d19a9f5df5ca670857ae82ae8e02e065a0035974 (patch) | |
tree | b255320cccd5f987d03f0900186b7c5159ef2cc0 /src/ini_type.h | |
parent | b74de9ff7223b4402abdc1e0e8aad68a5187009e (diff) | |
download | openttd-d19a9f5df5ca670857ae82ae8e02e065a0035974.tar.xz |
(svn r22167) -Codechange: Extract IniLoadFile base class for loading ini files out of IniFile.
Diffstat (limited to 'src/ini_type.h')
-rw-r--r-- | src/ini_type.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ini_type.h b/src/ini_type.h index b89a77b56..2bb4fea27 100644 --- a/src/ini_type.h +++ b/src/ini_type.h @@ -40,27 +40,33 @@ struct IniGroup { char *name; ///< name of group char *comment; ///< comment for group - IniGroup(struct IniFile *parent, const char *name, size_t len = 0); + IniGroup(struct IniLoadFile *parent, const char *name, size_t len = 0); ~IniGroup(); IniItem *GetItem(const char *name, bool create); void Clear(); }; -/** The complete ini file. */ -struct IniFile { +/** Ini file that only supports loading. */ +struct IniLoadFile { IniGroup *group; ///< the first group in the ini IniGroup **last_group; ///< the last group in the ini char *comment; ///< last comment in file const char * const *list_group_names; ///< NULL terminated list with group names that are lists - IniFile(const char * const *list_group_names = NULL); - ~IniFile(); + IniLoadFile(const char * const *list_group_names = NULL); + virtual ~IniLoadFile(); IniGroup *GetGroup(const char *name, size_t len = 0); void RemoveGroup(const char *name); void LoadFromDisk(const char *filename); +}; + +/** Ini file that supports both loading and saving. */ +struct IniFile : IniLoadFile { + IniFile(const char * const *list_group_names = NULL); + bool SaveToDisk(const char *filename); }; |