Example #1
0
 void Path::makePath(const std::string &path, const InArgs &in) {
   const char *current = path.c_str();
   const char *end = current + path.length();
   InArgs::const_iterator itInArg = in.begin();
   while (current != end) {
     if (*current == '[') {
       ++current;
       if (*current == '%')
         addPathInArg(path, in, itInArg, PathArgument::kindIndex);
       else {
         Value::UInt index = 0;
         for (; current != end && *current >= '0' && *current <= '9'; ++current)
           index = index * 10 + Value::UInt(*current - '0');
         args_.push_back(index);
       }
       if (current == end || *current++ != ']')
         invalidPath(path, int(current - path.c_str()));
     } else if (*current == '%') {
       addPathInArg(path, in, itInArg, PathArgument::kindKey);
       ++current;
     } else if (*current == '.') {
       ++current;
     } else {
       const char *beginName = current;
       while (current != end && !strchr("[.", *current))
         ++current;
       args_.push_back(std::string(beginName, current));
     }
   }
 }