move match_search_strings() function from plugin utils to PBD

This commit is contained in:
Paul Davis 2023-01-22 17:33:43 -07:00
parent 79033d8ee5
commit d982507085
3 changed files with 47 additions and 16 deletions

View file

@ -22,7 +22,7 @@
#include <list>
#include <string>
#include <boost/tokenizer.hpp>
#include "pbd/match.h"
#include "ardour/plugin.h"
#include "ardour/plugin_manager.h"
@ -37,21 +37,6 @@ setup_search_string (std::string& searchstr)
transform (searchstr.begin (), searchstr.end (), searchstr.begin (), ::toupper);
}
inline static bool
match_search_strings (std::string const& haystack, std::string const& needle)
{
boost::char_separator<char> sep (" ");
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
tokenizer t (needle, sep);
for (tokenizer::iterator ti = t.begin (); ti != t.end (); ++ti) {
if (haystack.find (*ti) == std::string::npos) {
return false;
}
}
return true;
}
struct PluginUIOrderSorter {
public:
bool operator() (ARDOUR::PluginInfoPtr a, ARDOUR::PluginInfoPtr b) const