Gui::SelectionFilter Class Reference

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_BlockAst
 
std::string Errors
 
std::string Filter
 

Friends

class SelectionSingleton
 

Detailed Description

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"

Constructor & Destructor Documentation

◆ SelectionFilter() [1/2]

SelectionFilter::SelectionFilter ( const char *  filter)

Constructs a SelectionFilter object.

References setFilter().

◆ SelectionFilter() [2/2]

SelectionFilter::SelectionFilter ( const std::string &  filter)

References setFilter().

◆ ~SelectionFilter()

SelectionFilter::~SelectionFilter ( )
virtual

Member Function Documentation

◆ addError()

void SelectionFilter::addError ( const char *  e)

References Errors.

◆ getFilter()

const std::string & Gui::SelectionFilter::getFilter ( void  ) const

◆ isValid()

bool Gui::SelectionFilter::isValid ( void  ) const

true if a valid filter is set

◆ match()

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().

◆ parse()

◆ setFilter()

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().

◆ test()

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().

Friends And Related Function Documentation

◆ SelectionSingleton

friend class SelectionSingleton
friend

Member Data Documentation

◆ Ast

std::shared_ptr<Node_Block> Gui::SelectionFilter::Ast
protected

Referenced by match(), parse(), setFilter(), and test().

◆ Errors

std::string Gui::SelectionFilter::Errors
protected

Referenced by addError(), parse(), and setFilter().

◆ Filter

std::string Gui::SelectionFilter::Filter
protected

◆ Result

std::vector<std::vector<SelectionObject> > Gui::SelectionFilter::Result

The documentation for this class was generated from the following files: