From c3670b211ff012af391d5f7c8e3d257ac88831b0 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 1 Jun 2014 11:28:10 +0100 Subject: [PATCH] Substring search of package name/description. Note this only searches the current locale, should potentially also search the default locale too. --- simgear/package/Package.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/simgear/package/Package.cxx b/simgear/package/Package.cxx index 7ad13f02..fd0b6af1 100644 --- a/simgear/package/Package.cxx +++ b/simgear/package/Package.cxx @@ -66,7 +66,24 @@ bool Package::matches(const SGPropertyNode* aFilter) const return false; } } - + + // substring search of name, description + if (strcmp(c->getName(), "name") == 0) { + std::string n(c->getStringValue()); + size_t pos = name().find(n); + if (pos == std::string::npos) { + return false; + } + } + + if (strcmp(c->getName(), "description") == 0) { + std::string n(c->getStringValue()); + size_t pos = description().find(n); + if (pos == std::string::npos) { + return false; + } + } + SG_LOG(SG_GENERAL, SG_WARN, "unknown filter term:" << c->getName()); } // of filter props iteration -- 2.39.5