| 4251 | } |
| 4252 | |
| 4253 | void Path::makePath(const String &path, const InArgs &in) |
| 4254 | { |
| 4255 | const char *current = path.c_str(); |
| 4256 | const char *end = current + path.length(); |
| 4257 | auto itInArg = in.begin(); |
| 4258 | while (current != end) |
| 4259 | { |
| 4260 | if (*current == '[') |
| 4261 | { |
| 4262 | ++current; |
| 4263 | if (*current == '%') |
| 4264 | addPathInArg(path, in, itInArg, PathArgument::kindIndex); |
| 4265 | else |
| 4266 | { |
| 4267 | ArrayIndex index = 0; |
| 4268 | for (; current != end && *current >= '0' && *current <= '9'; ++current) |
| 4269 | index = index * 10 + ArrayIndex(*current - '0'); |
| 4270 | args_.push_back(index); |
| 4271 | } |
| 4272 | if (current == end || *++current != ']') |
| 4273 | invalidPath(path, int(current - path.c_str())); |
| 4274 | } |
| 4275 | else if (*current == '%') |
| 4276 | { |
| 4277 | addPathInArg(path, in, itInArg, PathArgument::kindKey); |
| 4278 | ++current; |
| 4279 | } |
| 4280 | else if (*current == '.' || *current == ']') |
| 4281 | { |
| 4282 | ++current; |
| 4283 | } |
| 4284 | else |
| 4285 | { |
| 4286 | const char *beginName = current; |
| 4287 | while (current != end && !strchr("[.", *current)) |
| 4288 | ++current; |
| 4289 | args_.push_back(String(beginName, current)); |
| 4290 | } |
| 4291 | } |
| 4292 | } |
| 4293 | |
| 4294 | void Path::addPathInArg(const String & /*path*/, const InArgs &in, InArgs::const_iterator &itInArg, |
| 4295 | PathArgument::Kind kind) |