KiCad PCB EDA Suite
selection_conditions.h File Reference
#include <functional>
#include <core/typeinfo.h>
#include <vector>
#include <tool/selection.h>

Go to the source code of this file.

Classes

class  SELECTION_CONDITIONS
 Class that groups generic conditions for selected items. More...
 

Typedefs

typedef std::function< bool(const SELECTION &)> SELECTION_CONDITION
 

Functor type that checks a specific condition for selected items.

More...
 
typedef bool(&) SELECTION_BOOL(const SELECTION &)
 Signature for a reference to a function that takes a SELECTION and returns a boolean. More...
 

Functions

SELECTION_CONDITION operator|| (const SELECTION_CONDITION &aConditionA, const SELECTION_CONDITION &aConditionB)
 
SELECTION_CONDITION operator && (const SELECTION_CONDITION &aConditionA, const SELECTION_CONDITION &aConditionB)
 
SELECTION_CONDITION operator! (const SELECTION_CONDITION &aCondition)
 
SELECTION_CONDITION operator|| (const SELECTION_CONDITION &aConditionA, SELECTION_BOOL aConditionB)
 
SELECTION_CONDITION operator|| (SELECTION_BOOL aConditionA, const SELECTION_CONDITION &aConditionB)
 
SELECTION_CONDITION operator && (const SELECTION_CONDITION &aConditionA, SELECTION_BOOL aConditionB)
 
SELECTION_CONDITION operator && (SELECTION_BOOL aConditionA, const SELECTION_CONDITION &aConditionB)
 

Typedef Documentation

◆ SELECTION_BOOL

typedef bool( &) SELECTION_BOOL(const SELECTION &)

Signature for a reference to a function that takes a SELECTION and returns a boolean.

This type is meant to be used to define logical operations between SELECTION_CONDITION functors and non-functor SELECTION_CONDITION-like functions. It should not be used in user code.

Definition at line 49 of file selection_conditions.h.

◆ SELECTION_CONDITION

typedef std::function<bool (const SELECTION&)> SELECTION_CONDITION

Functor type that checks a specific condition for selected items.

Definition at line 34 of file selection_conditions.h.

Function Documentation

◆ operator &&() [1/3]

SELECTION_CONDITION operator && ( const SELECTION_CONDITION aConditionA,
const SELECTION_CONDITION aConditionB 
)

Definition at line 163 of file selection_conditions.cpp.

165 {
166  return std::bind( &SELECTION_CONDITIONS::andFunc, aConditionA, aConditionB, _1 );
167 }
static bool andFunc(const SELECTION_CONDITION &aConditionA, const SELECTION_CONDITION &aConditionB, const SELECTION &aSelection)
Helper function used by operator&&

References SELECTION_CONDITIONS::andFunc().

◆ operator &&() [2/3]

SELECTION_CONDITION operator && ( const SELECTION_CONDITION aConditionA,
SELECTION_BOOL  aConditionB 
)

Definition at line 189 of file selection_conditions.cpp.

191 {
192  return std::bind( &SELECTION_CONDITIONS::andBoolFunc, aConditionA, std::ref( aConditionB ), _1 );
193 }
static bool andBoolFunc(const SELECTION_CONDITION &aConditionA, SELECTION_BOOL &aConditionB, const SELECTION &aSelection)
Helper function used by operator&&

References SELECTION_CONDITIONS::andBoolFunc().

◆ operator &&() [3/3]

SELECTION_CONDITION operator && ( SELECTION_BOOL  aConditionA,
const SELECTION_CONDITION aConditionB 
)

Definition at line 195 of file selection_conditions.cpp.

197 {
198  return aConditionB && aConditionA;
199 }

◆ operator!()

SELECTION_CONDITION operator! ( const SELECTION_CONDITION aCondition)

Definition at line 170 of file selection_conditions.cpp.

171 {
172  return std::bind( &SELECTION_CONDITIONS::notFunc, aCondition, _1 );
173 }
static bool notFunc(const SELECTION_CONDITION &aCondition, const SELECTION &aSelection)
Helper function used by operator!

References SELECTION_CONDITIONS::notFunc().

◆ operator||() [1/3]

SELECTION_CONDITION operator|| ( const SELECTION_CONDITION aConditionA,
const SELECTION_CONDITION aConditionB 
)

Definition at line 156 of file selection_conditions.cpp.

158 {
159  return std::bind( &SELECTION_CONDITIONS::orFunc, aConditionA, aConditionB, _1 );
160 }
static bool orFunc(const SELECTION_CONDITION &aConditionA, const SELECTION_CONDITION &aConditionB, const SELECTION &aSelection)
Helper function used by operator||

References SELECTION_CONDITIONS::orFunc().

◆ operator||() [2/3]

SELECTION_CONDITION operator|| ( const SELECTION_CONDITION aConditionA,
SELECTION_BOOL  aConditionB 
)

Definition at line 176 of file selection_conditions.cpp.

178 {
179  return std::bind( &SELECTION_CONDITIONS::orBoolFunc, aConditionA, std::ref( aConditionB ), _1 );
180 }
static bool orBoolFunc(const SELECTION_CONDITION &aConditionA, SELECTION_BOOL &aConditionB, const SELECTION &aSelection)
Helper function used by operator||

References SELECTION_CONDITIONS::orBoolFunc().

◆ operator||() [3/3]

SELECTION_CONDITION operator|| ( SELECTION_BOOL  aConditionA,
const SELECTION_CONDITION aConditionB 
)

Definition at line 182 of file selection_conditions.cpp.

184 {
185  return aConditionB || aConditionA;
186 }