| 1750 | } |
| 1751 | |
| 1752 | void Path::makePath(const StringContainer& path, const InArgs& in) { |
| 1753 | const char* current = path.c_str(); |
| 1754 | const char* end = current + path.length(); |
| 1755 | auto itInArg = in.begin(); |
| 1756 | while (current != end) { |
| 1757 | if (*current == '[') { |
| 1758 | ++current; |
| 1759 | if (*current == '%') |
| 1760 | addPathInArg(path, in, itInArg, PathArgument::kindIndex); |
| 1761 | else { |
| 1762 | ArrayIndex index = 0; |
| 1763 | for (; current != end && *current >= '0' && *current <= '9'; ++current) |
| 1764 | index = index * 10 + ArrayIndex(*current - '0'); |
| 1765 | args_.push_back(index); |
| 1766 | } |
| 1767 | if (current == end || *++current != ']') |
| 1768 | invalidPath(path, int(current - path.c_str())); |
| 1769 | } else if (*current == '%') { |
| 1770 | addPathInArg(path, in, itInArg, PathArgument::kindKey); |
| 1771 | ++current; |
| 1772 | } else if (*current == '.' || *current == ']') { |
| 1773 | ++current; |
| 1774 | } else { |
| 1775 | const char* beginName = current; |
| 1776 | while (current != end && !strchr("[.", *current)) |
| 1777 | ++current; |
| 1778 | args_.push_back(StringContainer(beginName, current)); |
| 1779 | } |
| 1780 | } |
| 1781 | } |
| 1782 | |
| 1783 | void Path::addPathInArg(const StringContainer& /*path*/, const InArgs& in, |
| 1784 | InArgs::const_iterator& itInArg, PathArgument::Kind kind) { |