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

Member Typedef Documentation

Definition at line 478 of file tool_event.h.

Definition at line 477 of file tool_event.h.

Definition at line 476 of file tool_event.h.

Constructor & Destructor Documentation

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( )
inline

Default constructor. Creates an empty list.

Definition at line 481 of file tool_event.h.

482  {}
TOOL_EVENT_LIST::TOOL_EVENT_LIST ( const TOOL_EVENT aSingleEvent)
inline

Constructor for a list containing only one TOOL_EVENT.

Definition at line 485 of file tool_event.h.

References TOOL_EVENT::Format().

486  {
487  m_events.push_back( aSingleEvent );
488  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580

Member Function Documentation

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

Referenced by operator||().

513  {
514  m_events.push_back( aEvent );
515  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
iterator TOOL_EVENT_LIST::begin ( )
inline

Definition at line 517 of file tool_event.h.

518  {
519  return m_events.begin();
520  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
const_iterator TOOL_EVENT_LIST::cbegin ( ) const
inline

Definition at line 527 of file tool_event.h.

528  {
529  return m_events.begin();
530  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
const_iterator TOOL_EVENT_LIST::cend ( ) const
inline

Definition at line 532 of file tool_event.h.

533  {
534  return m_events.end();
535  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
void TOOL_EVENT_LIST::clear ( )
inline

Definition at line 542 of file tool_event.h.

Referenced by TOOL_MANAGER::dispatchInternal(), and operator=().

543  {
544  m_events.clear();
545  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
iterator TOOL_EVENT_LIST::end ( )
inline

Definition at line 522 of file tool_event.h.

523  {
524  return m_events.end();
525  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
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 154 of file tool_event.cpp.

155 {
156  std::string s;
157 
158  for( const TOOL_EVENT& e : m_events )
159  s += e.Format() + " ";
160 
161  return s;
162 }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
Class TOOL_EVENT.
Definition: tool_event.h:162
OPT<const TOOL_EVENT&> TOOL_EVENT_LIST::Matches ( const TOOL_EVENT aEvent) const
inline

Definition at line 498 of file tool_event.h.

Referenced by TOOL_MANAGER::dispatchInternal().

499  {
500  for( const_iterator i = m_events.begin(); i != m_events.end(); ++i )
501  if( i->Matches( aEvent ) )
502  return *i;
503 
504  return OPT<const TOOL_EVENT&>();
505  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
std::deque< TOOL_EVENT >::const_iterator const_iterator
Definition: tool_event.h:478
boost::optional< T > OPT
Definition: optional.h:7
TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator= ( const TOOL_EVENT_LIST aEventList)
inline

Definition at line 547 of file tool_event.h.

References clear(), and m_events.

548  {
549  m_events.clear();
550 
551  for( std::deque<TOOL_EVENT>::const_iterator i = aEventList.m_events.begin();
552  i != aEventList.m_events.end(); ++i )
553  {
554  m_events.push_back( *i );
555  }
556 
557  return *this;
558  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator= ( const TOOL_EVENT aEvent)
inline

Definition at line 560 of file tool_event.h.

References clear().

561  {
562  m_events.clear();
563  m_events.push_back( aEvent );
564  return *this;
565  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator|| ( const TOOL_EVENT aEvent)
inline

Definition at line 567 of file tool_event.h.

568  {
569  Add( aEvent );
570  return *this;
571  }
void Add(const TOOL_EVENT &aEvent)
Function Add() Adds a tool event to the list.
Definition: tool_event.h:512
TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator|| ( const TOOL_EVENT_LIST aEvent)
inline

Definition at line 573 of file tool_event.h.

References m_events.

574  {
575  std::copy( aEvent.m_events.begin(), aEvent.m_events.end(), std::back_inserter( m_events ) );
576  return *this;
577  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580
int TOOL_EVENT_LIST::size ( ) const
inline

Definition at line 537 of file tool_event.h.

538  {
539  return m_events.size();
540  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:580

Member Data Documentation

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

Definition at line 580 of file tool_event.h.

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


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