50{
51 boost::char_separator<char> const args_sep(";");
52 boost::char_separator<char> const fields_sep("=");
53 boost::char_separator<char> const white_spaces("\t ");
54
55 dom_map_type dom_map;
56
57 while (
map.peek() != EOF) {
58 std::string line;
60
61 std::string::size_type const pound = line.find('#');
62
63 if (pound != std::string::npos) {
64 line = line.substr(0, pound);
65 }
66
67 boost::algorithm::trim(line);
68 boost::tokenizer<boost::char_separator<char> > tok(line, args_sep);
69
70 BOOST_FOREACH(std::string s, tok) {
71 boost::algorithm::trim(s);
72 boost::tokenizer<boost::char_separator<char> > fields(s, fields_sep);
73 typedef boost::tokenizer<boost::char_separator<char> >::iterator Iter;
74
75 Iter it = fields.begin();
76
77 std::string s_domid = *it;
78 boost::algorithm::trim(s_domid);
79 uint32_t
const domid =
getDomId(s_domid);
80
81 ++it;
82 if (it != fields.end()) {
83 std::string name = *it;
84 boost::algorithm::trim(name);
85
86 dom_map.insert(std::make_pair(domid, name));
87 } else {
88 throw std::runtime_error("Error: malformed assignment");
89 }
90 }
91 }
92
93 return dom_map;
94}
uint32_t getDomId(std::string const &s_domid)
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.