Class sh::search::SearchCriterionFactoryFromFunction

class sh::search::SearchCriterionFactoryFromFunction : public sh::search::SearchCriterionFactory

A search criterion factory implementation which uses some additional static methods in the sh::search::SearchCriterion subclasses for control.

This is the default search criterion factory. It is typically used indirectly by the ‘REGISTER_CRITERION_FACTORY’ macro from here.

Public Functions

SearchCriterionFactoryFromFunction(QString key, std::function<QString()> descriptionfctstd::function<void(std::shared_ptr<sh::search::SearchCriterion>, sh::ui::SearchPanelConfiguration*)> editorfct, std::function<void(sh::ui::SearchPanelConfiguration*, std::shared_ptr<sh::search::SearchCriterion>)> editorupdateconfigfct, std::function<std::shared_ptr<sh::search::SearchCriterion>(std::shared_ptr<sh::search::SearchCriterionFactory>)> constructfct)
QString key()

Returns the string key for the associated search criterion class. .

QString description()

Returns the description string for the associated search criterion class. .

void editor(std::shared_ptr<sh::search::SearchCriterion> c, sh::ui::SearchPanelConfiguration *panelcfg)

Builds the search config ui in a search panel.

Takes the data from c and populates panelcfg with it.

void editorupdateconfig(sh::ui::SearchPanelConfiguration *panelcfg, std::shared_ptr<sh::search::SearchCriterion> c)

Updates own data with the content from the search config ui in a search panel.

Takes the data from panelcfg and updates c with it.

std::shared_ptr<SearchCriterion> construct()

Constructs an instance of the associated search criterion class. .

bool isVisibleFor(sh::filesystem::Operation *op, std::shared_ptr<sh::filesystem::FilesystemNode> node)

Checks if the associated search criterion class should be offered to the user for a given node. .

Private Members

QString _key
std::function<QString()> _descriptionfct
std::function<void(std::shared_ptr<sh::search::SearchCriterion>, sh::ui::SearchPanelConfiguration*)> _editorfct
std::function<void(sh::ui::SearchPanelConfiguration*, std::shared_ptr<sh::search::SearchCriterion>)> _editorupdateconfigfct
std::function< std::shared_ptr< sh::search::SearchCriterion >std::shared_ptr< sh::search::SearchCriterionFactory >)> _constructfct