KiCad PCB EDA Suite
TOOL_EVENT_LIST Class Reference

Class TOOL_EVENT_LIST. 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
 

Public Member Functions

 TOOL_EVENT_LIST ()
 

Default constructor. Creates an empty list.

More...
 
 TOOL_EVENT_LIST (const TOOL_EVENT &aSingleEvent)
 

Constructor for a list containing only one TOOL_EVENT.

More...
 
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)
 Function Add() Adds 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

Class TOOL_EVENT_LIST.

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

Definition at line 556 of file tool_event.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 561 of file tool_event.h.

◆ iterator

Definition at line 560 of file tool_event.h.

◆ value_type

Definition at line 559 of file tool_event.h.

Constructor & Destructor Documentation

◆ TOOL_EVENT_LIST() [1/2]

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( )
inline

Default constructor. Creates an empty list.

Definition at line 564 of file tool_event.h.

565  {}

◆ TOOL_EVENT_LIST() [2/2]

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( const TOOL_EVENT aSingleEvent)
inline

Constructor for a list containing only one TOOL_EVENT.

Definition at line 568 of file tool_event.h.

569  {
570  m_events.push_back( aSingleEvent );
571  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

References m_events.

Member Function Documentation

◆ Add()

void TOOL_EVENT_LIST::Add ( const TOOL_EVENT aEvent)
inline

Function Add() Adds a tool event to the list.

Parameters
aEventis the tool event to be addded.

Definition at line 597 of file tool_event.h.

598  {
599  m_events.push_back( aEvent );
600  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

References m_events.

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

◆ begin()

iterator TOOL_EVENT_LIST::begin ( )
inline

Definition at line 602 of file tool_event.h.

603  {
604  return m_events.begin();
605  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

References m_events.

◆ cbegin()

const_iterator TOOL_EVENT_LIST::cbegin ( ) const
inline

Definition at line 612 of file tool_event.h.

613  {
614  return m_events.begin();
615  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

References m_events.

◆ cend()

const_iterator TOOL_EVENT_LIST::cend ( ) const
inline

Definition at line 617 of file tool_event.h.

618  {
619  return m_events.end();
620  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

References m_events.

◆ clear()

void TOOL_EVENT_LIST::clear ( )
inline

Definition at line 627 of file tool_event.h.

628  {
629  m_events.clear();
630  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

References m_events.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ end()

iterator TOOL_EVENT_LIST::end ( )
inline

Definition at line 607 of file tool_event.h.

608  {
609  return m_events.end();
610  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

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 163 of file tool_event.cpp.

164 {
165  std::string s;
166 
167  for( const TOOL_EVENT& e : m_events )
168  s += e.Format() + " ";
169 
170  return s;
171 }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662
Class TOOL_EVENT.
Definition: tool_event.h:168

References m_events.

◆ Matches()

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

Definition at line 581 of file tool_event.h.

582  {
583  for( const TOOL_EVENT& event : m_events )
584  {
585  if( event.Matches( aEvent ) )
586  return event;
587  }
588 
589  return OPT<const TOOL_EVENT&>();
590  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662
Class TOOL_EVENT.
Definition: tool_event.h:168
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 632 of file tool_event.h.

633  {
634  m_events.clear();
635 
636  for( const TOOL_EVENT& event : aEventList.m_events )
637  m_events.push_back( event );
638 
639  return *this;
640  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662
Class TOOL_EVENT.
Definition: tool_event.h:168

References m_events.

◆ operator=() [2/2]

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

Definition at line 642 of file tool_event.h.

643  {
644  m_events.clear();
645  m_events.push_back( aEvent );
646  return *this;
647  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

References m_events.

◆ operator||() [1/2]

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

Definition at line 649 of file tool_event.h.

650  {
651  Add( aEvent );
652  return *this;
653  }
void Add(const TOOL_EVENT &aEvent)
Function Add() Adds a tool event to the list.
Definition: tool_event.h:597

References Add().

◆ operator||() [2/2]

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

Definition at line 655 of file tool_event.h.

656  {
657  std::copy( aEvent.m_events.begin(), aEvent.m_events.end(), std::back_inserter( m_events ) );
658  return *this;
659  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

References m_events.

◆ size()

int TOOL_EVENT_LIST::size ( ) const
inline

Definition at line 622 of file tool_event.h.

623  {
624  return m_events.size();
625  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:662

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: