KiCad PCB EDA Suite
TOOL_EVENT_LIST Class Reference

A list of TOOL_EVENTs, with overloaded || operators allowing for concatenating TOOL_EVENTs with little code. More...

#include <tool_event.h>

Public Types

typedef TOOL_EVENT value_type
 
typedef std::deque< TOOL_EVENT >::iterator iterator
 
typedef std::deque< TOOL_EVENT >::const_iterator const_iterator
 Default constructor. Creates an empty list. More...
 

Public Member Functions

 TOOL_EVENT_LIST ()
 Constructor for a list containing only one TOOL_EVENT. More...
 
 TOOL_EVENT_LIST (const TOOL_EVENT &aSingleEvent)
 y Copy an existing TOOL_EVENT_LIST More...
 
 TOOL_EVENT_LIST (const TOOL_EVENT_LIST &aEventList)=default
 
const std::string Format () const
 Function Format() Returns information about event in form of a human-readable string. More...
 
OPT< const TOOL_EVENT & > Matches (const TOOL_EVENT &aEvent) const
 
void Add (const TOOL_EVENT &aEvent)
 Add a tool event to the list. More...
 
iterator begin ()
 
iterator end ()
 
const_iterator cbegin () const
 
const_iterator cend () const
 
int size () const
 
void clear ()
 
TOOL_EVENT_LISToperator= (const TOOL_EVENT_LIST &aEventList)
 
TOOL_EVENT_LISToperator= (const TOOL_EVENT &aEvent)
 
TOOL_EVENT_LISToperator|| (const TOOL_EVENT &aEvent)
 
TOOL_EVENT_LISToperator|| (const TOOL_EVENT_LIST &aEvent)
 

Private Attributes

std::deque< TOOL_EVENTm_events
 

Detailed Description

A list of TOOL_EVENTs, with overloaded || operators allowing for concatenating TOOL_EVENTs with little code.

Definition at line 575 of file tool_event.h.

Member Typedef Documentation

◆ const_iterator

Default constructor. Creates an empty list.

Definition at line 580 of file tool_event.h.

◆ iterator

Definition at line 579 of file tool_event.h.

◆ value_type

Definition at line 578 of file tool_event.h.

Constructor & Destructor Documentation

◆ TOOL_EVENT_LIST() [1/3]

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( )
inline

Constructor for a list containing only one TOOL_EVENT.

Definition at line 583 of file tool_event.h.

◆ TOOL_EVENT_LIST() [2/3]

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( const TOOL_EVENT aSingleEvent)
inline

y Copy an existing TOOL_EVENT_LIST

Definition at line 587 of file tool_event.h.

References m_events.

◆ TOOL_EVENT_LIST() [3/3]

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( const TOOL_EVENT_LIST aEventList)
default

Member Function Documentation

◆ Add()

void TOOL_EVENT_LIST::Add ( const TOOL_EVENT aEvent)
inline

Add a tool event to the list.

Parameters
aEventis the tool event to be added.

Definition at line 619 of file tool_event.h.

620  {
621  m_events.push_back( aEvent );
622  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

Referenced by operator||(), and operator||().

◆ begin()

iterator TOOL_EVENT_LIST::begin ( )
inline

Definition at line 624 of file tool_event.h.

625  {
626  return m_events.begin();
627  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

◆ cbegin()

const_iterator TOOL_EVENT_LIST::cbegin ( ) const
inline

Definition at line 634 of file tool_event.h.

635  {
636  return m_events.begin();
637  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

◆ cend()

const_iterator TOOL_EVENT_LIST::cend ( ) const
inline

Definition at line 639 of file tool_event.h.

640  {
641  return m_events.end();
642  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

◆ clear()

void TOOL_EVENT_LIST::clear ( )
inline

Definition at line 649 of file tool_event.h.

650  {
651  m_events.clear();
652  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ end()

iterator TOOL_EVENT_LIST::end ( )
inline

Definition at line 629 of file tool_event.h.

630  {
631  return m_events.end();
632  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

◆ Format()

const std::string TOOL_EVENT_LIST::Format ( ) const

Function Format() Returns information about event in form of a human-readable string.

Returns
Event information.

Definition at line 170 of file tool_event.cpp.

171 {
172  std::string s;
173 
174  for( const TOOL_EVENT& e : m_events )
175  s += e.Format() + " ";
176 
177  return s;
178 }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684
Generic, UI-independent tool event.
Definition: tool_event.h:173

References m_events.

◆ Matches()

OPT<const TOOL_EVENT&> TOOL_EVENT_LIST::Matches ( const TOOL_EVENT aEvent) const
inline

Definition at line 603 of file tool_event.h.

604  {
605  for( const TOOL_EVENT& event : m_events )
606  {
607  if( event.Matches( aEvent ) )
608  return event;
609  }
610 
611  return OPT<const TOOL_EVENT&>();
612  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684
Generic, UI-independent tool event.
Definition: tool_event.h:173
boost::optional< T > OPT
Definition: optional.h:7

References m_events.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ operator=() [1/2]

TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator= ( const TOOL_EVENT_LIST aEventList)
inline

Definition at line 654 of file tool_event.h.

655  {
656  m_events.clear();
657 
658  for( const TOOL_EVENT& event : aEventList.m_events )
659  m_events.push_back( event );
660 
661  return *this;
662  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684
Generic, UI-independent tool event.
Definition: tool_event.h:173

References m_events.

◆ operator=() [2/2]

TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator= ( const TOOL_EVENT aEvent)
inline

Definition at line 664 of file tool_event.h.

665  {
666  m_events.clear();
667  m_events.push_back( aEvent );
668  return *this;
669  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

◆ operator||() [1/2]

TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator|| ( const TOOL_EVENT aEvent)
inline

Definition at line 671 of file tool_event.h.

672  {
673  Add( aEvent );
674  return *this;
675  }
void Add(const TOOL_EVENT &aEvent)
Add a tool event to the list.
Definition: tool_event.h:619

References Add().

◆ operator||() [2/2]

TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator|| ( const TOOL_EVENT_LIST aEvent)
inline

Definition at line 677 of file tool_event.h.

678  {
679  std::copy( aEvent.m_events.begin(), aEvent.m_events.end(), std::back_inserter( m_events ) );
680  return *this;
681  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

◆ size()

int TOOL_EVENT_LIST::size ( ) const
inline

Definition at line 644 of file tool_event.h.

645  {
646  return m_events.size();
647  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:684

References m_events.

Member Data Documentation

◆ m_events

std::deque<TOOL_EVENT> TOOL_EVENT_LIST::m_events
private

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