KiCad PCB EDA Suite
TOOL_EVENT_LIST Class Reference

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...
 
 TOOL_EVENT_LIST (const TOOL_EVENT_LIST &aEventList)=default
 

Copy an existing TOOL_EVENT_LIST

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

TOOL_EVENT_LIST.

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

Definition at line 564 of file tool_event.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 569 of file tool_event.h.

◆ iterator

Definition at line 568 of file tool_event.h.

◆ value_type

Definition at line 567 of file tool_event.h.

Constructor & Destructor Documentation

◆ TOOL_EVENT_LIST() [1/3]

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( )
inline

Default constructor. Creates an empty list.

Definition at line 572 of file tool_event.h.

573  {}

◆ TOOL_EVENT_LIST() [2/3]

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( const TOOL_EVENT aSingleEvent)
inline

Constructor for a list containing only one TOOL_EVENT.

Definition at line 576 of file tool_event.h.

577  {
578  m_events.push_back( aSingleEvent );
579  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673

References m_events.

◆ TOOL_EVENT_LIST() [3/3]

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( const TOOL_EVENT_LIST aEventList)
default

Copy an existing TOOL_EVENT_LIST

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 608 of file tool_event.h.

609  {
610  m_events.push_back( aEvent );
611  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673

References m_events.

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

◆ begin()

iterator TOOL_EVENT_LIST::begin ( )
inline

Definition at line 613 of file tool_event.h.

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

References m_events.

◆ cbegin()

const_iterator TOOL_EVENT_LIST::cbegin ( ) const
inline

Definition at line 623 of file tool_event.h.

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

References m_events.

◆ cend()

const_iterator TOOL_EVENT_LIST::cend ( ) const
inline

Definition at line 628 of file tool_event.h.

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

References m_events.

◆ clear()

void TOOL_EVENT_LIST::clear ( )
inline

Definition at line 638 of file tool_event.h.

639  {
640  m_events.clear();
641  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673

References m_events.

Referenced by TOOL_MANAGER::dispatchInternal().

◆ end()

iterator TOOL_EVENT_LIST::end ( )
inline

Definition at line 618 of file tool_event.h.

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

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

168 {
169  std::string s;
170 
171  for( const TOOL_EVENT& e : m_events )
172  s += e.Format() + " ";
173 
174  return s;
175 }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673
TOOL_EVENT.
Definition: tool_event.h:171

References m_events.

◆ Matches()

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

Definition at line 592 of file tool_event.h.

593  {
594  for( const TOOL_EVENT& event : m_events )
595  {
596  if( event.Matches( aEvent ) )
597  return event;
598  }
599 
600  return OPT<const TOOL_EVENT&>();
601  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673
TOOL_EVENT.
Definition: tool_event.h:171
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 643 of file tool_event.h.

644  {
645  m_events.clear();
646 
647  for( const TOOL_EVENT& event : aEventList.m_events )
648  m_events.push_back( event );
649 
650  return *this;
651  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673
TOOL_EVENT.
Definition: tool_event.h:171

References m_events.

◆ operator=() [2/2]

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

Definition at line 653 of file tool_event.h.

654  {
655  m_events.clear();
656  m_events.push_back( aEvent );
657  return *this;
658  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673

References m_events.

◆ operator||() [1/2]

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

Definition at line 660 of file tool_event.h.

661  {
662  Add( aEvent );
663  return *this;
664  }
void Add(const TOOL_EVENT &aEvent)
Function Add() Adds a tool event to the list.
Definition: tool_event.h:608

References Add().

◆ operator||() [2/2]

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

Definition at line 666 of file tool_event.h.

667  {
668  std::copy( aEvent.m_events.begin(), aEvent.m_events.end(), std::back_inserter( m_events ) );
669  return *this;
670  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673

References m_events.

◆ size()

int TOOL_EVENT_LIST::size ( ) const
inline

Definition at line 633 of file tool_event.h.

634  {
635  return m_events.size();
636  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:673

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: