KiCad PCB EDA Suite
DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group Class Reference
Inheritance diagram for DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group:
DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item

Public Member Functions

 Group (unsigned int aGroupingColumn)
 
virtual void GetValue (wxVariant &aValue, unsigned int aCol) const override
 
virtual wxString GetString (unsigned int aCol) const override
 
virtual wxDataViewItem GetParent () const override
 
virtual bool IsContainer () const override
 
virtual unsigned int GetChildren (wxDataViewItemArray &aItems) const override
 
unsigned int GetCount () const
 
void Add (Pin *aPin)
 

Private Attributes

std::list< Pin * > m_Members
 
unsigned int m_GroupingColumn
 

Detailed Description

Definition at line 115 of file dialog_lib_edit_pin_table.cpp.

Constructor & Destructor Documentation

DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::Group ( unsigned int  aGroupingColumn)
inline

Definition at line 119 of file dialog_lib_edit_pin_table.cpp.

Member Function Documentation

void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::Add ( Pin aPin)

Definition at line 486 of file dialog_lib_edit_pin_table.cpp.

References DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::SetGroup().

487 {
488  switch( GetCount() )
489  {
490  case 0:
491  aPin->SetGroup( 0 );
492  break;
493 
494  case 1:
495  m_Members.front()->SetGroup( this );
496  // fall through
497 
498  default:
499  aPin->SetGroup( this );
500  }
501 
502  m_Members.push_back( aPin );
503 }
virtual unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetChildren ( wxDataViewItemArray &  aItems) const
inlineoverridevirtual
Todo:
C++11

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 125 of file dialog_lib_edit_pin_table.cpp.

References m_Members.

126  {
128  for( std::list<Pin*>::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
129  aItems.push_back( wxDataViewItem( *i ) );
130 
131  return aItems.size();
132  }
unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetCount ( ) const
inline

Definition at line 134 of file dialog_lib_edit_pin_table.cpp.

References m_Members.

134 { return m_Members.size(); }
virtual wxDataViewItem DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetParent ( ) const
inlineoverridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 123 of file dialog_lib_edit_pin_table.cpp.

123 { return wxDataViewItem(); }
wxString DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetString ( unsigned int  aCol) const
overridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 469 of file dialog_lib_edit_pin_table.cpp.

References PinNumbers::insert(), and PinNumbers::size().

470 {
471  if( aCol == m_GroupingColumn )
472  return m_Members.front()->GetString( aCol );
473 
474  PinNumbers values;
475 
476  for( std::list<Pin*>::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
477  values.insert( (*i)->GetString( aCol ) );
478 
479  if( values.size() > 1 )
480  return boost::algorithm::join( values, "," );
481  else
482  return m_Members.front()->GetString( aCol );
483 }
void insert(value_type const &v)
Definition: pin_number.h:57
container_type::size_type size() const
Definition: pin_number.h:58
void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetValue ( wxVariant &  aValue,
unsigned int  aCol 
) const
overridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 446 of file dialog_lib_edit_pin_table.cpp.

References PinNumbers::insert(), and PinNumbers::size().

448 {
449  if( aCol == m_GroupingColumn )
450  // shortcut
451  m_Members.front()->GetValue( aValue, aCol );
452  else if( aCol != PIN_TYPE )
453  aValue = GetString( aCol );
454  else
455  {
456  PinNumbers values;
457 
458  for( std::list<Pin*>::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
459  values.insert( (*i)->GetString( aCol ) );
460 
461  if( values.size() > 1 )
462  aValue << wxDataViewIconText( boost::algorithm::join( values, "," ), wxNullIcon );
463  else
464  m_Members.front()->GetValue( aValue, aCol );
465  }
466 }
virtual wxString GetString(unsigned int aCol) const override
void insert(value_type const &v)
Definition: pin_number.h:57
container_type::size_type size() const
Definition: pin_number.h:58
virtual bool DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::IsContainer ( ) const
inlineoverridevirtual

Implements DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Item.

Definition at line 124 of file dialog_lib_edit_pin_table.cpp.

124 { return true; }

Member Data Documentation

unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::m_GroupingColumn
private

Definition at line 139 of file dialog_lib_edit_pin_table.cpp.

std::list<Pin*> DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::m_Members
private

Definition at line 138 of file dialog_lib_edit_pin_table.cpp.

Referenced by GetChildren(), and GetCount().


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