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...
 
boost::optional< 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 468 of file tool_event.h.

Member Typedef Documentation

Definition at line 473 of file tool_event.h.

Definition at line 472 of file tool_event.h.

Definition at line 471 of file tool_event.h.

Constructor & Destructor Documentation

TOOL_EVENT_LIST::TOOL_EVENT_LIST ( )
inline

Default constructor. Creates an empty list.

Definition at line 476 of file tool_event.h.

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

Constructor for a list containing only one TOOL_EVENT.

Definition at line 480 of file tool_event.h.

References m_events.

481  {
482  m_events.push_back( aSingleEvent );
483  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575

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

References m_events.

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

508  {
509  m_events.push_back( aEvent );
510  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
iterator TOOL_EVENT_LIST::begin ( )
inline

Definition at line 512 of file tool_event.h.

References m_events.

513  {
514  return m_events.begin();
515  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
const_iterator TOOL_EVENT_LIST::cbegin ( ) const
inline

Definition at line 522 of file tool_event.h.

References m_events.

523  {
524  return m_events.begin();
525  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
const_iterator TOOL_EVENT_LIST::cend ( ) const
inline

Definition at line 527 of file tool_event.h.

References m_events.

528  {
529  return m_events.end();
530  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
void TOOL_EVENT_LIST::clear ( )
inline

Definition at line 537 of file tool_event.h.

References m_events.

Referenced by TOOL_MANAGER::dispatchInternal().

538  {
539  m_events.clear();
540  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
iterator TOOL_EVENT_LIST::end ( )
inline

Definition at line 517 of file tool_event.h.

References m_events.

518  {
519  return m_events.end();
520  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
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.

References m_events.

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

Definition at line 493 of file tool_event.h.

References m_events.

Referenced by TOOL_MANAGER::dispatchInternal().

494  {
495  for( const_iterator i = m_events.begin(); i != m_events.end(); ++i )
496  if( i->Matches( aEvent ) )
497  return *i;
498 
500  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
std::deque< TOOL_EVENT >::const_iterator const_iterator
Definition: tool_event.h:473
TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator= ( const TOOL_EVENT_LIST aEventList)
inline

Definition at line 542 of file tool_event.h.

References m_events.

543  {
544  m_events.clear();
545 
546  for( std::deque<TOOL_EVENT>::const_iterator i = aEventList.m_events.begin();
547  i != aEventList.m_events.end(); ++i )
548  {
549  m_events.push_back( *i );
550  }
551 
552  return *this;
553  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator= ( const TOOL_EVENT aEvent)
inline

Definition at line 555 of file tool_event.h.

References m_events.

556  {
557  m_events.clear();
558  m_events.push_back( aEvent );
559  return *this;
560  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator|| ( const TOOL_EVENT aEvent)
inline

Definition at line 562 of file tool_event.h.

References Add().

563  {
564  Add( aEvent );
565  return *this;
566  }
void Add(const TOOL_EVENT &aEvent)
Function Add() Adds a tool event to the list.
Definition: tool_event.h:507
TOOL_EVENT_LIST& TOOL_EVENT_LIST::operator|| ( const TOOL_EVENT_LIST aEvent)
inline

Definition at line 568 of file tool_event.h.

References m_events.

569  {
570  std::copy( aEvent.m_events.begin(), aEvent.m_events.end(), std::back_inserter( m_events ) );
571  return *this;
572  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575
int TOOL_EVENT_LIST::size ( ) const
inline

Definition at line 532 of file tool_event.h.

References m_events.

533  {
534  return m_events.size();
535  }
std::deque< TOOL_EVENT > m_events
Definition: tool_event.h:575

Member Data Documentation

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

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