| 4016 | } |
| 4017 | |
| 4018 | void Path::makePath(const JSONCPP_STRING& path, const InArgs& in) { |
| 4019 | const char* current = path.c_str(); |
| 4020 | const char* end = current + path.length(); |
| 4021 | InArgs::const_iterator itInArg = in.begin(); |
| 4022 | while (current != end) { |
| 4023 | if (*current == '[') { |
| 4024 | ++current; |
| 4025 | if (*current == '%') |
| 4026 | addPathInArg(path, in, itInArg, PathArgument::kindIndex); |
| 4027 | else { |
| 4028 | ArrayIndex index = 0; |
| 4029 | for (; current != end && *current >= '0' && *current <= '9'; ++current) |
| 4030 | index = index * 10 + ArrayIndex(*current - '0'); |
| 4031 | args_.push_back(index); |
| 4032 | } |
| 4033 | if (current == end || *++current != ']') |
| 4034 | invalidPath(path, int(current - path.c_str())); |
| 4035 | } else if (*current == '%') { |
| 4036 | addPathInArg(path, in, itInArg, PathArgument::kindKey); |
| 4037 | ++current; |
| 4038 | } else if (*current == '.' || *current == ']') { |
| 4039 | ++current; |
| 4040 | } else { |
| 4041 | const char* beginName = current; |
| 4042 | while (current != end && !strchr("[.", *current)) |
| 4043 | ++current; |
| 4044 | args_.push_back(JSONCPP_STRING(beginName, current)); |
| 4045 | } |
| 4046 | } |
| 4047 | } |
| 4048 | |
| 4049 | void Path::addPathInArg(const JSONCPP_STRING& /*path*/, |
| 4050 | const InArgs& in, |