diff options
author | alberth <alberth@openttd.org> | 2011-03-03 20:53:09 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2011-03-03 20:53:09 +0000 |
commit | 722296e79747610b7822c07f2edd908563456d92 (patch) | |
tree | 5abad466c49bbae08ee041eef2a2773d884c8267 /src/ini_type.h | |
parent | d19a9f5df5ca670857ae82ae8e02e065a0035974 (diff) | |
download | openttd-722296e79747610b7822c07f2edd908563456d92.tar.xz |
(svn r22168) -Codechange: Move ini file IO and file error reporting to virtual functions.
Diffstat (limited to 'src/ini_type.h')
-rw-r--r-- | src/ini_type.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ini_type.h b/src/ini_type.h index 2bb4fea27..b84f7adf6 100644 --- a/src/ini_type.h +++ b/src/ini_type.h @@ -61,6 +61,22 @@ struct IniLoadFile { void RemoveGroup(const char *name); void LoadFromDisk(const char *filename); + + /** + * Open the INI file. + * @param filename Name of the INI file. + * @param size [out] Size of the opened file. + * @return File handle of the opened file, or \c NULL. + */ + virtual FILE *OpenFile(const char *filename, size_t *size) = 0; + + /** + * Report an error about the file contents. + * @param pre Prefix text of the \a buffer part. + * @param buffer Part of the file with the error. + * @param post Suffix text of the \a buffer part. + */ + virtual void ReportFileError(const char * const pre, const char * const buffer, const char * const post) = 0; }; /** Ini file that supports both loading and saving. */ @@ -68,6 +84,9 @@ struct IniFile : IniLoadFile { IniFile(const char * const *list_group_names = NULL); bool SaveToDisk(const char *filename); + + virtual FILE *OpenFile(const char *filename, size_t *size); + virtual void ReportFileError(const char * const pre, const char * const buffer, const char * const post); }; #endif /* INI_TYPE_H */ |