KiCad PCB EDA Suite
PROPERTY_MANAGER::CLASS_DESC Struct Reference

Returns metadata for a specific type. More...

Public Member Functions

 CLASS_DESC (TYPE_ID aId)
 Unique type identifier (obtained using TYPE_HASH) More...
 
void rebuild ()
 Traverses the class inheritance hierarchy bottom-to-top, gathering all properties available to a type. More...
 
void collectPropsRecur (PROPERTY_LIST &aResult, PROPERTY_SET &aReplaced) const
 

Public Attributes

const TYPE_ID m_id
 Types after which this type inherits. More...
 
std::vector< std::reference_wrapper< CLASS_DESC > > m_bases
 Properties unique to this type (i.e. not inherited) More...
 
std::map< wxString, std::unique_ptr< PROPERTY_BASE > > m_ownProperties
 Type converters available for this type. More...
 
std::map< TYPE_ID, std::unique_ptr< TYPE_CAST_BASE > > m_typeCasts
 All properties (both unique to the type and inherited) More...
 
std::vector< PROPERTY_BASE * > m_allProperties
 Replaced properties (TYPE_ID / name) More...
 
PROPERTY_SET m_replaced
 Recreates the list of properties. More...
 

Detailed Description

Returns metadata for a specific type.

Definition at line 199 of file property_mgr.h.

Constructor & Destructor Documentation

◆ CLASS_DESC()

PROPERTY_MANAGER::CLASS_DESC::CLASS_DESC ( TYPE_ID  aId)
inline

Unique type identifier (obtained using TYPE_HASH)

Definition at line 201 of file property_mgr.h.

Member Function Documentation

◆ collectPropsRecur()

void PROPERTY_MANAGER::CLASS_DESC::collectPropsRecur ( PROPERTY_LIST aResult,
PROPERTY_SET aReplaced 
) const

Definition at line 194 of file property_mgr.cpp.

196 {
197  for( const std::pair<size_t, wxString>& replacedEntry : m_replaced )
198  aReplaced.emplace( replacedEntry );
199 
200  for( const std::pair<const wxString, std::unique_ptr<PROPERTY_BASE>>& prop : m_ownProperties )
201  {
202  PROPERTY_BASE* property = prop.second.get();
203 
204  // Do not store replaced properties
205  if( aReplaced.count( std::make_pair( property->OwnerHash(), property->Name() ) ) == 0 )
206  aResult.push_back( property );
207  }
208 
209  for( const std::reference_wrapper<CLASS_DESC>& base : m_bases )
210  base.get().collectPropsRecur( aResult, aReplaced );
211 }
PROPERTY_SET m_replaced
Recreates the list of properties.
Definition: property_mgr.h:222
std::vector< std::reference_wrapper< CLASS_DESC > > m_bases
Properties unique to this type (i.e. not inherited)
Definition: property_mgr.h:210
T get(void *aObject)
Definition: property.h:268
std::map< wxString, std::unique_ptr< PROPERTY_BASE > > m_ownProperties
Type converters available for this type.
Definition: property_mgr.h:213

References PROPERTY_BASE::get().

Referenced by rebuild().

◆ rebuild()

void PROPERTY_MANAGER::CLASS_DESC::rebuild ( )

Traverses the class inheritance hierarchy bottom-to-top, gathering all properties available to a type.

Definition at line 184 of file property_mgr.cpp.

185 {
186  PROPERTY_SET replaced( m_replaced );
187  m_allProperties.clear();
188  collectPropsRecur( m_allProperties, replaced );
189  // We need to keep properties sorted to be able to use std::set_* functions
190  sort( m_allProperties.begin(), m_allProperties.end() );
191 }
PROPERTY_SET m_replaced
Recreates the list of properties.
Definition: property_mgr.h:222
void collectPropsRecur(PROPERTY_LIST &aResult, PROPERTY_SET &aReplaced) const
std::set< std::pair< size_t, wxString > > PROPERTY_SET
Definition: property_mgr.h:46
std::vector< PROPERTY_BASE * > m_allProperties
Replaced properties (TYPE_ID / name)
Definition: property_mgr.h:219

References collectPropsRecur(), m_allProperties, and m_replaced.

Member Data Documentation

◆ m_allProperties

std::vector<PROPERTY_BASE*> PROPERTY_MANAGER::CLASS_DESC::m_allProperties

Replaced properties (TYPE_ID / name)

Definition at line 219 of file property_mgr.h.

Referenced by PROPERTY_MANAGER::GetProperty(), and rebuild().

◆ m_bases

std::vector<std::reference_wrapper<CLASS_DESC> > PROPERTY_MANAGER::CLASS_DESC::m_bases

Properties unique to this type (i.e. not inherited)

Definition at line 210 of file property_mgr.h.

Referenced by PROPERTY_MANAGER::InheritsAfter().

◆ m_id

const TYPE_ID PROPERTY_MANAGER::CLASS_DESC::m_id

Types after which this type inherits.

Definition at line 207 of file property_mgr.h.

◆ m_ownProperties

std::map<wxString, std::unique_ptr<PROPERTY_BASE> > PROPERTY_MANAGER::CLASS_DESC::m_ownProperties

Type converters available for this type.

Definition at line 213 of file property_mgr.h.

Referenced by PROPERTY_MANAGER::AddProperty().

◆ m_replaced

PROPERTY_SET PROPERTY_MANAGER::CLASS_DESC::m_replaced

Recreates the list of properties.

Definition at line 222 of file property_mgr.h.

Referenced by rebuild(), and PROPERTY_MANAGER::ReplaceProperty().

◆ m_typeCasts

std::map<TYPE_ID, std::unique_ptr<TYPE_CAST_BASE> > PROPERTY_MANAGER::CLASS_DESC::m_typeCasts

All properties (both unique to the type and inherited)

Definition at line 216 of file property_mgr.h.

Referenced by PROPERTY_MANAGER::AddTypeCast(), and PROPERTY_MANAGER::InheritsAfter().


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