]> git.mxchange.org Git - simgear.git/commitdiff
Substring search of package name/description.
authorJames Turner <zakalawe@mac.com>
Sun, 1 Jun 2014 10:28:10 +0000 (11:28 +0100)
committerJames Turner <zakalawe@mac.com>
Sun, 1 Jun 2014 10:28:10 +0000 (11:28 +0100)
Note this only searches the current locale, should potentially also
search the default locale too.

simgear/package/Package.cxx

index 7ad13f02383bfd993c057b2688427b7e8202d0d6..fd0b6af12c7ef1e1a3a0ed0bf5065612d1240551 100644 (file)
@@ -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