예제 #1
0
    bool canHandle(HTTPMethod requestMethod, String requestUri) override  {
        if (_method != HTTP_ANY && _method != requestMethod) {
          return false;
        }

        String uri = removeSlashes(_uri);
        requestUri = removeSlashes(requestUri);
        String wildcardStr;
        wildcardStr += _wildcard;
        while (1) {
          String uPath = getPathSegment(uri);
          String ruPath = getPathSegment(requestUri);
          if (uPath != ruPath && uPath != wildcardStr) {
            return false;
          }
          uri = removeSlashes(removePathSegment(uri));
          requestUri = removeSlashes(removePathSegment(requestUri));
          if (!uri.length() && !requestUri.length()) {
            return true;
          }
          if (!uri.length() || !requestUri.length()) {
            return false;
          }
        }

        return true;
    }
예제 #2
0
String getWildCard(String requestUri, String wcUri, int n, char wildcard = '*') {
  wcUri = removeSlashes(wcUri);
  requestUri = removeSlashes(requestUri);
  String wildcardStr;
  wildcardStr += wildcard;
  int i = 0;
  while (1) {
    String uPath = getPathSegment(wcUri);
    String ruPath = getPathSegment(requestUri);
    if (uPath == wildcardStr) {
      if (i == n) {
        return ruPath;
      }
      i++;
    }
    wcUri = removeSlashes(removePathSegment(wcUri));
    requestUri = removeSlashes(removePathSegment(requestUri));
    if (!wcUri.length() && !requestUri.length()) {
      return "";
    }
    if (!wcUri.length() || !requestUri.length()) {
      return "";
    }
  }
  return "";
}
예제 #3
0
파일: FilePath.cpp 프로젝트: 8l/oovcde
int FilePath::discardLeadingRelSegments()
{
    int count = 0;
    bool didSeg = true;
    do
    {
        OovString seg = getPathSegment(0);
        if(seg.compare("..") == 0)
        {
            CHECKSIZE(__FILE__, __LINE__, size(), 3);
            pathStdStr().erase(0, 3);
            count++;
        }
        else if(seg.compare(".") == 0)
        {
            CHECKSIZE(__FILE__, __LINE__, size(), 2);
            pathStdStr().erase(0, 2);
        }
        else
        {
            didSeg = false;
        }
    } while(didSeg);
    return count;
}
예제 #4
0
파일: Path.cpp 프로젝트: a-price/dart
VectorXd Path::getCurvature(double s) const {
	const PathSegment* pathSegment = getPathSegment(s);
	return pathSegment->getCurvature(s);
}
예제 #5
0
파일: Path.cpp 프로젝트: a-price/dart
VectorXd Path::getTangent(double s) const {
	const PathSegment* pathSegment = getPathSegment(s);
	return pathSegment->getTangent(s);
}