/*this function takes a pointer to an orderedSet, a pointer to a root, a function pointer and an argument pointer, and calls operateFilter on every element in the tree that root points to, in increasing order*/ static void setFilter(struct orderedSet *s2, struct node *root, int (*predicate)(void *arg, const char* c), void *arg) { if (root != 0) { /*make sure root exists*/ if(root->child[LEFT]) { /*if left child exists --> recursively call on it*/ setFilter(s2, root->child[LEFT], predicate, arg); } operateFilter(s2, root, predicate, arg); /*call operate filter on current node*/ if(root->child[RIGHT]) { /*if right child exists --> recursively call on it*/ setFilter(s2, root->child[RIGHT], predicate, arg); } } }
void FilterPanose::operate() { QList<FontDBResult> dbresult( FMFontDb::DB()->getValues( FMFontDb::Panose ) ); QList<FontItem*> fil; int paramIdx(vData[Param].toInt()); int val(vData[Value].toInt()); int fv(0); for(int i(0); i < dbresult.count() ; ++i) { QStringList pl(dbresult[i].second.split(":")); fv = pl[paramIdx].toInt(); if(fv == val) fil << dbresult[i].first; } operateFilter(fil); }