Skip to content

Commit

Permalink
technical corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
swick committed Mar 31, 2012
1 parent b7635b3 commit ceedae4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
18 changes: 15 additions & 3 deletions apps/mwiniimporter/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
#include <boost/iostreams/stream.hpp>
#include <iostream>

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<std::string, std::string>(map[i][0], map[i][1]));
}
}

void MwIniImporter::setVerbose(bool verbose) {
mVerbose = verbose;
}
Expand Down Expand Up @@ -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<std::string, std::string>(section + ":" + line.substr(0,pos), line.substr(pos+1)));
}

return map;
Expand Down Expand Up @@ -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<std::string, std::string>(line.substr(0,pos), line.substr(pos+1)));
}

return map;
Expand All @@ -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<std::string, std::string>(it->first, iniIt->second));
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions apps/mwiniimporter/importer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@


typedef std::map<std::string, std::string> strmap;
#define STRPAIR std::make_pair<std::string, std::string>

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);
Expand Down

0 comments on commit ceedae4

Please sign in to comment.