Is there any documentation for this mini SDK? There are almost no comments to explain stuff. What is the filter_helper? Are all these test_item functions called by Foobar when various searches are performed?
[{POST_SNAPBACK}][/a]
Since this is your first plugin, make sure you check out the [a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=18138&view=findpost&p=178456]plugin development tutorial[/url] if you haven't already.
If you run the database search plugin in foobar and look at the last dropdown box on the bottom right, you'll notice these are all filters defined in filter_helper.cpp. So using filter_helper you can include your own filter in this box. Look at the code for the filter_match_exact class for an example of how to create your own filter. What you need to do (provided you inherit from the filter_match_string_base class) is override the test_item method. Here's a template to help you out:
class filter_match_blah : public dbsearch::filter_match_string_base
{
public:
virtual const char * get_name() {return "match blah";}
virtual bool test_item(unsigned n);
};
// called by dbsearch for each item to be tested, you return true to indicate a match
// (i.e., the current item should be displayed in the dbsearch window)
bool filter_match_blah::test_item(unsigned n)
{
if (pattern.is_empty()) return false;
string8 temp;
the_snapshot->format_title(n, temp, spec, 0);
if (temp.is_empty()) return false;
// decision code goes here
// do whatever you need to do to compare pattern (the string typed in the pattern box in dbsearch) to temp (the next item to be compared)
if (the_current_item_matches)
return true;
else
return false;
}
static primary_filter_factory<filter_match_blah> sailors_filter;
The last line is important, as it "registers" your new class with foobar (your code won't be executed without it). I hope this helps. I haven't compiled anything like this myself, so I may have messed something up...