Selection filter definition This class builds up a type/count tree out of a string to test very fast a selection or object/subelement type against it. More...
#include <SelectionFilter.h>
Public Member Functions | |
void | addError (const char *e) |
const std::string & | getFilter () const |
bool | isValid (void) const |
true if a valid filter is set More... | |
bool | match (void) |
Test to current selection This method tests the current selection set against the filter and returns true if the described object(s) are selected. More... | |
SelectionFilter (const char *filter) | |
Constructs a SelectionFilter object. More... | |
SelectionFilter (const std::string &filter) | |
void | setFilter (const char *filter) |
Set a new filter string. More... | |
bool | test (App::DocumentObject *pObj, const char *sSubName) |
Test objects This method tests if a given object is described in the filter. More... | |
virtual | ~SelectionFilter () |
Public Attributes | |
std::vector< std::vector< SelectionObject > > | Result |
Protected Member Functions | |
bool | parse (void) |
Protected Attributes | |
std::shared_ptr< Node_Block > | Ast |
std::string | Errors |
std::string | Filter |
Friends | |
class | SelectionSingleton |
Selection filter definition This class builds up a type/count tree out of a string to test very fast a selection or object/subelement type against it.
Example strings are: "SELECT Part::Feature SUBELEMENT Edge", "SELECT Robot::RobotObject", "SELECT Robot::RobotObject COUNT 1..5"
SelectionFilter::SelectionFilter | ( | const char * | filter | ) |
Constructs a SelectionFilter object.
References setFilter().
SelectionFilter::SelectionFilter | ( | const std::string & | filter | ) |
References setFilter().
|
virtual |
void SelectionFilter::addError | ( | const char * | e | ) |
References Errors.
const std::string & Gui::SelectionFilter::getFilter | ( | void | ) | const |
bool Gui::SelectionFilter::isValid | ( | void | ) | const |
true if a valid filter is set
bool SelectionFilter::match | ( | void | ) |
Test to current selection This method tests the current selection set against the filter and returns true if the described object(s) are selected.
References Ast, Gui::SelectionSingleton::getSelectionEx(), Result, and Gui::Selection().
Referenced by Gui::TaskView::TaskWatcherPython::shouldShow(), Gui::TaskView::TaskWatcherCommands::shouldShow(), and RobotGui::TaskWatcherRobot::shouldShow().
|
protected |
void SelectionFilter::setFilter | ( | const char * | filter | ) |
Set a new filter string.
References Ast, Errors, Filter, and parse().
Referenced by SelectionFilter(), and Gui::TaskView::TaskWatcherPython::TaskWatcherPython().
bool SelectionFilter::test | ( | App::DocumentObject * | pObj, |
const char * | sSubName | ||
) |
Test objects This method tests if a given object is described in the filter.
If SubName is not NULL the Subelement gets also tested.
References Ast, DraftVecUtils::find(), Base::Persistence::getTypeId(), and Base::Type::isDerivedFrom().
Referenced by Gui::SelectionFilterGate::allow().
|
friend |
|
protected |
Referenced by match(), parse(), setFilter(), and test().
|
protected |
Referenced by addError(), parse(), and setFilter().
|
protected |
Referenced by parse(), setFilter(), and Gui::TaskView::TaskWatcherPython::shouldShow().
std::vector<std::vector<SelectionObject> > Gui::SelectionFilter::Result |
Referenced by match(), and RobotGui::TaskWatcherRobot::shouldShow().