| 1606 | } |
| 1607 | |
| 1608 | void Path::makePath(const JSONCPP_STRING& path, const InArgs& in) { |
| 1609 | const char* current = path.c_str(); |
| 1610 | const char* end = current + path.length(); |
| 1611 | auto itInArg = in.begin(); |
| 1612 | while (current != end) { |
| 1613 | if (*current == '[') { |
| 1614 | ++current; |
| 1615 | if (*current == '%') |
| 1616 | addPathInArg(path, in, itInArg, PathArgument::kindIndex); |
| 1617 | else { |
| 1618 | ArrayIndex index = 0; |
| 1619 | for (; current != end && *current >= '0' && *current <= '9'; ++current) |
| 1620 | index = index * 10 + ArrayIndex(*current - '0'); |
| 1621 | args_.push_back(index); |
| 1622 | } |
| 1623 | if (current == end || *++current != ']') |
| 1624 | invalidPath(path, int(current - path.c_str())); |
| 1625 | } else if (*current == '%') { |
| 1626 | addPathInArg(path, in, itInArg, PathArgument::kindKey); |
| 1627 | ++current; |
| 1628 | } else if (*current == '.' || *current == ']') { |
| 1629 | ++current; |
| 1630 | } else { |
| 1631 | const char* beginName = current; |
| 1632 | while (current != end && !strchr("[.", *current)) |
| 1633 | ++current; |
| 1634 | args_.push_back(JSONCPP_STRING(beginName, current)); |
| 1635 | } |
| 1636 | } |
| 1637 | } |
| 1638 | |
| 1639 | void Path::addPathInArg(const JSONCPP_STRING& /*path*/, |
| 1640 | const InArgs& in, |