MCPcopy Create free account
hub / github.com/crawl/crawl / _database_find_keys

Function _database_find_keys

crawl-ref/source/database.cc:375–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375static vector<string> _database_find_keys(DBM *database,
376 const string &regex,
377 bool ignore_case,
378 db_find_filter filter = nullptr)
379{
380 text_pattern tpat(regex, ignore_case);
381 vector<string> matches;
382
383 datum dbKey = dbm_firstkey(database);
384
385 while (dbKey.dptr != nullptr)
386 {
387 string key((const char *)dbKey.dptr, dbKey.dsize);
388
389 if (tpat.matches(key)
390 && key.find("__") == string::npos
391 && (filter == nullptr || !(*filter)(key, "")))
392 {
393 matches.push_back(key);
394 }
395
396 dbKey = dbm_nextkey(database);
397 }
398
399 return matches;
400}
401
402static vector<string> _database_find_bodies(DBM *database,
403 const string &regex,

Callers 2

getLongDescKeysByRegexFunction · 0.85
getAllFAQKeysFunction · 0.85

Calls 5

dbm_firstkeyFunction · 0.85
dbm_nextkeyFunction · 0.85
matchesMethod · 0.45
findMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected