mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 16:03:24 +00:00
COMMON: Add a way to specify default section name for simple sectionless .ini files
This commit is contained in:
parent
148cd5f28d
commit
fb05242d36
@ -72,6 +72,7 @@ bool INIFile::loadFromStream(SeekableReadStream &stream) {
|
||||
KeyValue kv;
|
||||
String comment;
|
||||
int lineno = 0;
|
||||
section.name = _defaultSectionName;
|
||||
|
||||
// TODO: Detect if a section occurs multiple times (or likewise, if
|
||||
// a key occurs multiple times inside one section).
|
||||
@ -297,6 +298,9 @@ void INIFile::renameSection(const String &oldName, const String &newName) {
|
||||
// - merge the two sections "oldName" and "newName"
|
||||
}
|
||||
|
||||
void INIFile::setDefaultSectionName(const String &name) {
|
||||
_defaultSectionName = name;
|
||||
}
|
||||
|
||||
bool INIFile::hasKey(const String &key, const String §ion) const {
|
||||
if (!isValidName(key)) {
|
||||
|
@ -105,6 +105,8 @@ public:
|
||||
void removeSection(const String §ion);
|
||||
void renameSection(const String &oldName, const String &newName);
|
||||
|
||||
void setDefaultSectionName(const String &name); ///< sets initial section name for section-less ini files
|
||||
|
||||
bool hasKey(const String &key, const String §ion) const;
|
||||
bool getKey(const String &key, const String §ion, String &value) const;
|
||||
void setKey(const String &key, const String §ion, const String &value);
|
||||
@ -118,6 +120,7 @@ public:
|
||||
void allowNonEnglishCharacters();
|
||||
|
||||
private:
|
||||
String _defaultSectionName;
|
||||
SectionList _sections;
|
||||
bool _allowNonEnglishCharacters;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user