| 3916 | } |
| 3917 | |
| 3918 | void Path::makePath(const std::string& path, const InArgs& in) { |
| 3919 | const char* current = path.c_str(); |
| 3920 | const char* end = current + path.length(); |
| 3921 | InArgs::const_iterator itInArg = in.begin(); |
| 3922 | while (current != end) { |
| 3923 | if (*current == '[') { |
| 3924 | ++current; |
| 3925 | if (*current == '%') |
| 3926 | addPathInArg(path, in, itInArg, PathArgument::kindIndex); |
| 3927 | else { |
| 3928 | ArrayIndex index = 0; |
| 3929 | for (; current != end && *current >= '0' && *current <= '9'; ++current) |
| 3930 | index = index * 10 + ArrayIndex(*current - '0'); |
| 3931 | args_.push_back(index); |
| 3932 | } |
| 3933 | if (current == end || *current++ != ']') |
| 3934 | invalidPath(path, int(current - path.c_str())); |
| 3935 | } else if (*current == '%') { |
| 3936 | addPathInArg(path, in, itInArg, PathArgument::kindKey); |
| 3937 | ++current; |
| 3938 | } else if (*current == '.') { |
| 3939 | ++current; |
| 3940 | } else { |
| 3941 | const char* beginName = current; |
| 3942 | while (current != end && !strchr("[.", *current)) |
| 3943 | ++current; |
| 3944 | args_.push_back(std::string(beginName, current)); |
| 3945 | } |
| 3946 | } |
| 3947 | } |
| 3948 | |
| 3949 | void Path::addPathInArg(const std::string& /*path*/, |
| 3950 | const InArgs& in, |