summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2014-06-22 17:21:45 +0200
committerPierre Bourdon <delroth@gmail.com>2014-06-22 17:21:45 +0200
commit5dff5773398fab79ca60a0fad4aa90abf683d366 (patch)
tree466db879b91b173e783dc4c524ad237d37c60f4d /Source/Core/Common
parent86d64553910c438031e2e8359f871d31f1caa12b (diff)
parentf05d3f6e5d6da8be530c0cd4ffaaec0382240ec5 (diff)
Merge pull request #500 from lioncash/ini
Use only section-based ini reading.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/IniFile.cpp55
-rw-r--r--Source/Core/Common/IniFile.h27
2 files changed, 2 insertions, 80 deletions
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp
index 642835ac90..6159c2897d 100644
--- a/Source/Core/Common/IniFile.cpp
+++ b/Source/Core/Common/IniFile.cpp
@@ -436,61 +436,6 @@ bool IniFile::Save(const std::string& filename)
return File::RenameSync(temp, filename);
}
-bool IniFile::Get(const std::string& sectionName, const std::string& key, std::vector<std::string>* values)
-{
- Section *section = GetSection(sectionName);
- if (!section)
- return false;
- return section->Get(key, values);
-}
-
-bool IniFile::Get(const std::string& sectionName, const std::string& key, int* value, int defaultValue)
-{
- Section *section = GetSection(sectionName);
- if (!section) {
- *value = defaultValue;
- return false;
- } else {
- return section->Get(key, value, defaultValue);
- }
-}
-
-bool IniFile::Get(const std::string& sectionName, const std::string& key, u32* value, u32 defaultValue)
-{
- Section *section = GetSection(sectionName);
- if (!section) {
- *value = defaultValue;
- return false;
- } else {
- return section->Get(key, value, defaultValue);
- }
-}
-
-bool IniFile::Get(const std::string& sectionName, const std::string& key, bool* value, bool defaultValue)
-{
- Section *section = GetSection(sectionName);
- if (!section) {
- *value = defaultValue;
- return false;
- } else {
- return section->Get(key, value, defaultValue);
- }
-}
-
-bool IniFile::Get(const std::string& sectionName, const std::string& key, std::string* value, const std::string& defaultValue)
-{
- Section* section = GetSection(sectionName);
- if (!section) {
- if (&defaultValue != &NULL_STRING) {
- *value = defaultValue;
- }
- return false;
- }
- return section->Get(key, value, defaultValue);
-}
-
-
-
// Unit test. TODO: Move to the real unit test framework.
/*
int main()
diff --git a/Source/Core/Common/IniFile.h b/Source/Core/Common/IniFile.h
index 6e80611f1d..1d006b802f 100644
--- a/Source/Core/Common/IniFile.h
+++ b/Source/Core/Common/IniFile.h
@@ -95,34 +95,11 @@ public:
// Returns true if key exists in section
bool Exists(const std::string& sectionName, const std::string& key) const;
- // TODO: Get rid of these, in favor of the Section ones.
- void Set(const std::string& sectionName, const std::string& key, const std::string& newValue) {
- GetOrCreateSection(sectionName)->Set(key, newValue);
- }
- void Set(const std::string& sectionName, const std::string& key, int newValue) {
- GetOrCreateSection(sectionName)->Set(key, newValue);
- }
- void Set(const std::string& sectionName, const std::string& key, u32 newValue) {
- GetOrCreateSection(sectionName)->Set(key, newValue);
- }
- void Set(const std::string& sectionName, const std::string& key, bool newValue) {
- GetOrCreateSection(sectionName)->Set(key, newValue);
- }
- void Set(const std::string& sectionName, const std::string& key, const std::vector<std::string>& newValues) {
- GetOrCreateSection(sectionName)->Set(key, newValues);
- }
-
- // TODO: Get rid of these, in favor of the Section ones.
- bool Get(const std::string& sectionName, const std::string& key, int* value, int defaultValue = 0);
- bool Get(const std::string& sectionName, const std::string& key, u32* value, u32 defaultValue = 0);
- bool Get(const std::string& sectionName, const std::string& key, bool* value, bool defaultValue = false);
- bool Get(const std::string& sectionName, const std::string& key, std::vector<std::string>* values);
- bool Get(const std::string& sectionName, const std::string& key, std::string* value, const std::string& defaultValue = NULL_STRING);
-
template<typename T> bool GetIfExists(const std::string& sectionName, const std::string& key, T value)
{
if (Exists(sectionName, key))
- return Get(sectionName, key, value);
+ return GetOrCreateSection(sectionName)->Get(key, value);
+
return false;
}