MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / addCollectionFilter

Method addCollectionFilter

external/ImGuiFileDialog/ImGuiFileDialog.cpp:1268–1291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1266}
1267
1268void IGFD::FilterInfos::addCollectionFilter(const std::string& vFilter, const bool vIsRegex) {
1269 if (!vIsRegex) {
1270 auto _count_dots = Utils::GetCharCountInString(vFilter, '.');
1271 if (_count_dots > IGFD::FilterInfos::count_dots) {
1272 IGFD::FilterInfos::count_dots = _count_dots;
1273 }
1274 if (vFilter.find('*') != std::string::npos) {
1275 const auto& regex_string = transformAsteriskBasedFilterToRegex(vFilter);
1276 addCollectionFilter(regex_string, true);
1277 return;
1278 }
1279 filters.try_add(vFilter);
1280 filters_optimized.try_add(Utils::LowerCaseString(vFilter));
1281 } else {
1282 try {
1283 auto rx = std::regex(vFilter);
1284 filters.try_add(vFilter);
1285 filters_regex.emplace_back(rx);
1286 } catch (std::exception& e) {
1287 const std::string msg = "IGFD : The regex \"" + vFilter + "\" parsing was failed with msg : " + e.what();
1288 throw IGFDException(msg.c_str());
1289 }
1290 }
1291}
1292
1293void IGFD::FilterInfos::clear() {
1294 title.clear();

Callers 1

ParseFiltersMethod · 0.80

Calls 5

IGFDExceptionClass · 0.85
try_addMethod · 0.80
whatMethod · 0.80
c_strMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected