static bool ubip_read_conf_file(std::string filename) { std::ifstream in(filename.c_str()); if (in.is_open() == false) { std::cout << "Error reading " << filename << std::endl; return false; } std::string line; while(getline(in, line)) { std::string::size_type i = line.find_first_not_of ( " \t\n\v" ); if (i != std::string::npos && line[i] == '#') continue; // Process non-comment line boost::tokenizer<> token_list(line); boost::tokenizer<>::iterator token=token_list.begin(); std::string step = *token++; std::string identity = *token++; std::string slocation = *token++; while(token != token_list.end()) { slocation += " " + *token++; } _users_locations[step + ":" + identity] = slocation; } return true; }
static bool ubip_read_conf_file(std::string filename) { std::ifstream in(filename.c_str()); if (in.is_open() == false) { std::cout << "Error reading " << filename << std::endl; return false; } std::string line; while(getline(in, line)) { std::string::size_type i = line.find_first_not_of ( " \t\n\v" ); if (i != std::string::npos && line[i] == '#') continue; // Process non-comment line boost::tokenizer<> token_list(line); /* for(boost::tokenizer<>::iterator beg=token_list.begin(); beg!=token_list.end();++beg) { std::cout << *beg << "\n"; }*/ boost::tokenizer<>::iterator token=token_list.begin(); std::string step = *token++; std::string identity = *token++; std::string latitude = *token++; std::string longitude = *token++; std::string altitude = *token++; _users_locations[step + ":" + identity] = sphysical_location(atoi(latitude.c_str()),atoi(longitude.c_str()),atoi(altitude.c_str())); } return true; }
static t_token *s_token_recognizer(const char *s) { const t_token *list = token_list(); while (list && list->op) { if (ft_strncmp(s, list->op, list->len) == 0) return ((t_token *)list); list++; } return (NULL); }