summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorKarroffel <therzog@mail.de>2017-11-03 14:33:19 +0100
committerKarroffel <therzog@mail.de>2017-11-03 14:33:19 +0100
commit38d56c8351838fce3005ab92440c4c2320d92b0f (patch)
treea6a4ae24cd389f825f019330c50f415c04cdc7c4 /core/io
parentc880302754352dce1e44bf00bf9b1ac20e71cd1d (diff)
make ConfigFile use OrderedHashMap
Diffstat (limited to 'core/io')
-rw-r--r--core/io/config_file.cpp16
-rw-r--r--core/io/config_file.h3
2 files changed, 10 insertions, 9 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index daa6b01d6e..b5d41bacbb 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -75,7 +75,7 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V
} else {
if (!values.has(p_section)) {
- values[p_section] = Map<String, Variant>();
+ values[p_section] = OrderedHashMap<String, Variant>();
}
values[p_section][p_key] = p_value;
@@ -106,7 +106,7 @@ bool ConfigFile::has_section_key(const String &p_section, const String &p_key) c
void ConfigFile::get_sections(List<String> *r_sections) const {
- for (const Map<String, Map<String, Variant> >::Element *E = values.front(); E; E = E->next()) {
+ for (const Map<String, OrderedHashMap<String, Variant> >::Element *E = values.front(); E; E = E->next()) {
r_sections->push_back(E->key());
}
}
@@ -114,8 +114,8 @@ void ConfigFile::get_section_keys(const String &p_section, List<String> *r_keys)
ERR_FAIL_COND(!values.has(p_section));
- for (const Map<String, Variant>::Element *E = values[p_section].front(); E; E = E->next()) {
- r_keys->push_back(E->key());
+ for (OrderedHashMap<String, Variant>::ConstElement E = values[p_section].front(); E; E = E.next()) {
+ r_keys->push_back(E.key());
}
}
@@ -135,17 +135,17 @@ Error ConfigFile::save(const String &p_path) {
return err;
}
- for (Map<String, Map<String, Variant> >::Element *E = values.front(); E; E = E->next()) {
+ for (Map<String, OrderedHashMap<String, Variant> >::Element *E = values.front(); E; E = E->next()) {
if (E != values.front())
file->store_string("\n");
file->store_string("[" + E->key() + "]\n\n");
- for (Map<String, Variant>::Element *F = E->get().front(); F; F = F->next()) {
+ for (OrderedHashMap<String, Variant>::Element F = E->get().front(); F; F = F.next()) {
String vstr;
- VariantWriter::write_to_string(F->get(), vstr);
- file->store_string(F->key() + "=" + vstr + "\n");
+ VariantWriter::write_to_string(F.get(), vstr);
+ file->store_string(F.key() + "=" + vstr + "\n");
}
}
diff --git a/core/io/config_file.h b/core/io/config_file.h
index 8ed8a069e4..2be196faa2 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -30,13 +30,14 @@
#ifndef CONFIG_FILE_H
#define CONFIG_FILE_H
+#include "core/ordered_hash_map.h"
#include "reference.h"
class ConfigFile : public Reference {
GDCLASS(ConfigFile, Reference);
- Map<String, Map<String, Variant> > values;
+ Map<String, OrderedHashMap<String, Variant> > values;
PoolStringArray _get_sections() const;
PoolStringArray _get_section_keys(const String &p_section) const;