| 178 | |
| 179 | template <typename T, typename U> |
| 180 | void assign_tables ( |
| 181 | T& c, |
| 182 | const std::string& name, |
| 183 | const U& val |
| 184 | ) |
| 185 | { |
| 186 | if (name.size() == 0) |
| 187 | { |
| 188 | c.val = val; |
| 189 | c.table.clear(); |
| 190 | return; |
| 191 | } |
| 192 | |
| 193 | const std::string::size_type pos = name.find_first_of("."); |
| 194 | std::string first = name.substr(0,pos); |
| 195 | std::string last; |
| 196 | if (pos != std::string::npos) |
| 197 | last = name.substr(pos+1); |
| 198 | |
| 199 | if (c.table.is_in_domain(first)) |
| 200 | { |
| 201 | assign_tables(*c.table[first], last, val); |
| 202 | } |
| 203 | else |
| 204 | { |
| 205 | std::unique_ptr<T> temp (new T); |
| 206 | temp->val = c.val; |
| 207 | assign_tables(*temp, last, val); |
| 208 | c.table.add(first,temp); |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | // ---------------------------------------------------------------------------------------- |
| 213 |
no test coverage detected