bool SBinetCookie::matchRequest(const char *domain, const char *path, const SWIutilLogger* logger) const { bool match = true; if (!matchDomain(_Domain.c_str(), domain, logger)) { match = false; } else if (!matchPath(_Path.c_str(), path, logger)) { match = false; } // TBD, if port was specified by the remote web server for the // cookie, the port must be included in the list of ports of the // cookie's port attribute. We aren't returning that information yet // so we don't even have a port stored in our cookies. if (logger && logger->DiagIsEnabled(MODULE_SBINET_COOKIE_TAGID)) { char expStr[64]; logger->Diag(MODULE_SBINET_COOKIE_TAGID, L"SBinetCookie::matchRequest", L"match: %s, (domain = '%S', path = '%S') compared to " L"(name = '%S', value = '%S', domain = '%S', " L"path = '%S', expires = %S (%d), secure = %s)", (match ? L"true" : L"false"), domain, path, _Name.c_str(), _Value.c_str(), _Domain.c_str(), _Path.c_str(), SBinetUtils::getTimeStampStr(_nExpires, expStr), _nExpires, (_fSecure ? L"true" : L"false")); } return match; }
void FindMovedImagesDialog::learnImage(const QString &filename, QMap<QString, ImageMatch> &matches, const QVector<ImagePath> &imagePaths) { QStringList newMatches; int bestScore = 1; // Find matching file paths by a binary search of the file name ImagePath path(filename); for (auto it = std::lower_bound(imagePaths.begin(), imagePaths.end(), path); it != imagePaths.end() && it->filenameUpperCase == path.filenameUpperCase; ++it) { int score = matchPath(filename, it->fullPath); if (score < bestScore) continue; if (score > bestScore) newMatches.clear(); newMatches.append(it->fullPath); bestScore = score; } // Add the new original filenames to the list of matches, if the score is higher than previously for (const QString &originalFilename: newMatches) { auto it = matches.find(originalFilename); if (it == matches.end()) matches.insert(originalFilename, { filename, bestScore }); else if (it->score < bestScore) *it = { filename, bestScore }; } }
vector<string> PackReader::findPaths(const std::string & search){ vector<string> found; for (map<string, File>::iterator it = files.begin(); it != files.end(); it++){ const string & path = (*it).first; if (matchPath(path, search)){ found.push_back(path); } } return found; }
/*! strip part of \a path if it matches * one of the paths in the Config_getList(STRIP_FROM_PATH) list */ DirDef *DirDef::mergeDirectoryInTree(const QCString &path) { //printf("DirDef::mergeDirectoryInTree(%s)\n",path.data()); int p=0,i=0; DirDef *dir=0; while ((i=path.find('/',p))!=-1) { QCString part=path.left(i+1); if (!matchPath(part,Config_getList(STRIP_FROM_PATH)) && (part!="/" && part!="//")) { dir=createNewDir(part); } p=i+1; } return dir; }
Results FindWords(const char * board, unsigned width, unsigned height) { Results results = {}; results.Score = 0; results.Count = 0; std::queue<BoardState> queue; std::unordered_set<std::string> foundWords; prepareSearch(queue, board, width, height); // process the queue while (!queue.empty()) { BoardState node = queue.front(); queue.pop(); char sym = board[node.nextIndex]; // only append the character if that path is correct if (node.visited_nodes[node.nextIndex] == empty) { node.word += sym; } // handle the 'q'-> 'qu' case by making a copy of current 'q' node, marking it and pushing it to the queue if (sym == 'q' && node.visited_nodes[node.nextIndex] == empty) { processQnode(node, queue); } node.visited_nodes[node.nextIndex] = used; // if we matched the word, we just add it to the results, but it may be a part of a longer word so continue match_t match = matchPath(node); if (node.word.length() >= MIN_WORD_SIZE && match == full_match) { foundWords.insert(node.word); } if (match == full_match || match == partial_match) { processNeighbourNodes(width, height, node, queue); } } combineResults(results, foundWords); return results; }
//------------------------------------------------------------------------------------- std::string Resmgr::matchPath(std::string path) { return matchPath(path.c_str()); }
bool UrlParser::removePath( const UrlComponent::Matcher &matcher, const UrlComponent::Validator &validator ) { std::vector<std::pair<UrlComponent*, UrlComponent*> > matches = matchPath( matcher ); return removePath( matches, validator ); }
//------------------------------------------------------------------------------------- std::string Resmgr::matchPath(const std::string& path) { return matchPath(path.c_str()); }