2012-03-30 18:59:44 +00:00
|
|
|
#ifndef MWINIIMPORTER_IMPORTER
|
|
|
|
#define MWINIIMPORTER_IMPORTER 1
|
|
|
|
|
2012-03-31 19:06:48 +00:00
|
|
|
#include <boost/iostreams/device/file.hpp>
|
|
|
|
#include <boost/iostreams/stream.hpp>
|
2012-03-30 18:59:44 +00:00
|
|
|
#include <string>
|
2012-03-30 20:58:54 +00:00
|
|
|
#include <map>
|
2012-03-31 19:06:48 +00:00
|
|
|
#include <vector>
|
2012-03-30 20:58:54 +00:00
|
|
|
#include <exception>
|
|
|
|
|
2012-03-30 18:59:44 +00:00
|
|
|
class MwIniImporter {
|
|
|
|
public:
|
2012-03-31 20:48:50 +00:00
|
|
|
typedef std::map<std::string, std::string> strmap;
|
|
|
|
typedef std::map<std::string, std::vector<std::string> > multistrmap;
|
|
|
|
|
2012-03-31 14:54:53 +00:00
|
|
|
MwIniImporter();
|
2012-03-30 20:58:54 +00:00
|
|
|
void setVerbose(bool verbose);
|
2012-03-31 20:48:50 +00:00
|
|
|
multistrmap loadIniFile(std::string filename);
|
|
|
|
multistrmap loadCfgFile(std::string filename);
|
|
|
|
void merge(multistrmap &cfg, multistrmap &ini);
|
2012-04-02 15:07:18 +00:00
|
|
|
void mergeFallback(multistrmap &cfg, multistrmap &ini);
|
2012-03-31 20:48:50 +00:00
|
|
|
void importGameFiles(multistrmap &cfg, multistrmap &ini);
|
|
|
|
void writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, multistrmap &cfg);
|
2012-03-30 18:59:44 +00:00
|
|
|
|
|
|
|
private:
|
2012-04-02 15:07:18 +00:00
|
|
|
void insertMultistrmap(multistrmap &cfg, std::string key, std::string value);
|
2012-03-31 21:15:33 +00:00
|
|
|
std::string numberToString(int n);
|
2012-03-30 20:58:54 +00:00
|
|
|
bool mVerbose;
|
2012-03-31 12:28:19 +00:00
|
|
|
strmap mMergeMap;
|
2012-04-02 15:07:18 +00:00
|
|
|
strmap mMergeFallback;
|
2012-03-30 18:59:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|