From ceedae4a1af3c155f31221376ac9ef66c3e9dca8 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Sat, 31 Mar 2012 16:54:53 +0200 Subject: [PATCH] technical corrections --- apps/mwiniimporter/importer.cpp | 18 +++++++++++++++--- apps/mwiniimporter/importer.hpp | 5 +---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index 041712b21..09088774b 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -3,6 +3,18 @@ #include #include +MwIniImporter::MwIniImporter() { + const char *map[][2] = + { + { "fps", "General:Show FPS" }, + { 0, 0 } + }; + + for(int i=0; map[i][0]; i++) { + mMergeMap.insert(std::make_pair(map[i][0], map[i][1])); + } +} + void MwIniImporter::setVerbose(bool verbose) { mVerbose = verbose; } @@ -34,7 +46,7 @@ strmap MwIniImporter::loadIniFile(std::string filename) { continue; } - map.insert(STRPAIR(section + ":" + line.substr(0,pos), line.substr(pos+1))); + map.insert(std::make_pair(section + ":" + line.substr(0,pos), line.substr(pos+1))); } return map; @@ -68,7 +80,7 @@ strmap MwIniImporter::loadCfgFile(std::string filename) { continue; } - map.insert(STRPAIR(line.substr(0,pos), line.substr(pos+1))); + map.insert(std::make_pair(line.substr(0,pos), line.substr(pos+1))); } return map; @@ -81,7 +93,7 @@ void MwIniImporter::merge(strmap &cfg, strmap &ini) { if((iniIt = ini.find(it->second)) != ini.end()) { cfg.erase(it->first); if(!this->specialMerge(it->first, it->second, cfg, ini)) { - cfg.insert(STRPAIR(it->first, iniIt->second)); + cfg.insert(std::make_pair(it->first, iniIt->second)); } } } diff --git a/apps/mwiniimporter/importer.hpp b/apps/mwiniimporter/importer.hpp index d0034a13d..ad5aaacde 100644 --- a/apps/mwiniimporter/importer.hpp +++ b/apps/mwiniimporter/importer.hpp @@ -7,14 +7,11 @@ typedef std::map strmap; -#define STRPAIR std::make_pair class MwIniImporter { public: - MwIniImporter() { - mMergeMap.insert(STRPAIR("fps", "General:Show FPS")); - }; + MwIniImporter(); void setVerbose(bool verbose); strmap loadIniFile(std::string filename); strmap loadCfgFile(std::string filename);