Welp, I need help. Boost.Python... trying to make it so my python code could swap languages at will... The following code throws a error: expected primary-expression before ')' token in the PythonSUpport.cpp line 10.
PythonSupport.cpp
#include <cmath>
#include <boost/python.hpp>
#include "Language.h"
using namespace twile;
using namespace boost::python;
BOOST_PYTHON_MODULE(twile) {
class_<Language>("Language").def("swapLanguage", &Language::swapLanguage(std::string));
}
Language.h
#ifndef LANGUAGE_H
#define LANGUAGE_H
#include <string>
#include <fstream>
#include <map>
#include <sstream>
namespace twile {
class Language
{
public:
Language();
void loadLanguage();
void swapLanguage(std::string to);
std::string
getLocalizedString(std::string definer);
protected:
private:
std::ifstream languageFileStream;
std::string language = "en_US";
std::map<std::string, std::string> languageSentences;
};
}
#endif // LANGUAGE_H
and Language.cpp
#include "Language.h"
using namespace twile;
using namespace std;
Language::Language()
{
//ctor
}
void Language::loadLanguage() {
std::string filePath;
languageFileStream.open(filePath.append("data/locale/").append(language).append("/locale.lang"));
if(!languageFileStream.is_open()) {
printf("Error, language file not found!\n");
}
std::string line;
while(std::getline(languageFileStream,line)) {
int equalPositon = line.find("=");
std::string key;
std::string value;
key = line.substr(0, equalPositon);
value = line.substr(equalPositon+1);
languageSentences[key] = value;
}
languageFileStream.close();
}
std::string Language::getLocalizedString(std::string definer) {
return languageSentences[definer];
}
void Language::swapLanguage(std::string to) {
language = to;
loadLanguage();
}
What the actual ** is wrong here?