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; }
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 ""; }
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; }
VectorXd Path::getCurvature(double s) const { const PathSegment* pathSegment = getPathSegment(s); return pathSegment->getCurvature(s); }
VectorXd Path::getTangent(double s) const { const PathSegment* pathSegment = getPathSegment(s); return pathSegment->getTangent(s); }