22 #include <boost/regex.hpp>
29 boost::regex
config_regex(
"\\(config\\s(\\w+)\\s(\\w+)\\)");
30 boost::regex
position_regex(
"\\(position\\s(\\d+)\\s([\\d\\.\\-]+)\\s([\\d\\.\\-]+)\\)");
50 std::ifstream file(
"conf.phx", std::ifstream::in);
53 while (std::getline(file, line)) {
54 if (line.size() > 0 && line[0] ==
'#')
continue;
56 if (boost::regex_match(line.c_str(), match,
config_regex)) {
57 std::string config = std::string() + match[1];
58 if (config.compare(
"buffer_max_history") == 0) {
60 }
else if (config.compare(
"player_max_history") == 0) {
62 }
else if (config.compare(
"ball_max_history") == 0) {
64 }
else if (config.compare(
"commands_max_history") == 0) {
66 }
else if (config.compare(
"commands_precision") == 0) {
68 }
else if (config.compare(
"log_name") == 0) {
71 }
else if (boost::regex_match(line.c_str(), match,
logging_regex)) {
72 int number = atoi((std::string() + match[1]).c_str());
80 std::cerr <<
"Config::Config() -> error opening conf.phx file" << std::cerr;
125 std::ifstream file(filename.c_str(), std::ifstream::in);
128 while (std::getline(file, line)) {
129 if (line.size() > 0 && line[0] ==
'#')
continue;
132 int number = atoi((std::string() + match[1]).c_str());
133 double x = atof((std::string() + match[2]).c_str());
134 double y = atof((std::string() + match[3]).c_str());
138 }
else if (boost::regex_match(line.c_str(), match,
logging_regex)) {
139 int number = atoi((std::string() + match[1]).c_str());
143 }
else if (boost::regex_match(line.c_str(), match,
verbose_regex)) {
144 int number = atoi((std::string() + match[1]).c_str());
149 int number = atoi((std::string() + match[1]).c_str());
157 std::cerr <<
"Config::load() -> error opening " << filename <<
" file" << std::endl;
static int UNIFORM_NUMBER
static unsigned int BUFFER_MAX_HISTORY
Position The Position lorem Ipsum
static std::string LOG_NAME
boost::regex logging_regex("\\(logging\\s(\\d+)\\)")
boost::regex verbose_regex("\\(verbose\\s(\\d+)\\)")
static std::string TEAM_NAME
static unsigned int COMMANDS_MAX_HISTORY
static unsigned int PLAYER_MAX_HISTORY
boost::regex position_regex("\\(position\\s(\\d+)\\s([\\d\\.\\-]+)\\s([\\d\\.\\-]+)\\)")
boost::regex player_history_regex("\\(player_history\\s(\\d+)\\)")
static unsigned int COMMAND_PRECISION
boost::regex config_regex("\\(config\\s(\\w+)\\s(\\w+)\\)")
static bool PLAYER_HISTORY
static unsigned int BALL_MAX_HISTORY
static bool TRAINER_LOGGING