KiCad PCB EDA Suite
PROPERTY_MANAGER::CLASS_DESC Struct Reference

Structure holding type meta-data

More...

Public Member Functions

 CLASS_DESC (TYPE_ID aId)
 
void rebuild ()
 

Recreates the list of properties

More...
 
void collectPropsRecur (PROPERTY_LIST &aResult, PROPERTY_SET &aReplaced) const
 

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

More...
 

Public Attributes

const TYPE_ID m_id
 

Unique type identifier (obtained using TYPE_HASH)

More...
 
std::vector< std::reference_wrapper< CLASS_DESC > > m_bases
 

Types after which this type inherits

More...
 
std::map< wxString, std::unique_ptr< PROPERTY_BASE > > m_ownProperties
 

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

More...
 
std::map< TYPE_ID, std::unique_ptr< TYPE_CAST_BASE > > m_typeCasts
 

Type converters available for this type

More...
 
std::vector< PROPERTY_BASE * > m_allProperties
 

All properties (both unique to the type and inherited)

More...
 
PROPERTY_SET m_replaced
 

Replaced properties (TYPE_ID / name)

More...
 

Detailed Description

Structure holding type meta-data

Definition at line 195 of file property_mgr.h.

Constructor & Destructor Documentation

◆ CLASS_DESC()

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

Definition at line 197 of file property_mgr.h.

198  : m_id( aId )
199  {
200  }
const TYPE_ID m_id
Unique type identifier (obtained using TYPE_HASH)
Definition: property_mgr.h:203

Member Function Documentation

◆ collectPropsRecur()

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

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

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
Replaced properties (TYPE_ID / name)
Definition: property_mgr.h:218
std::vector< std::reference_wrapper< CLASS_DESC > > m_bases
Types after which this type inherits
Definition: property_mgr.h:206
T get(void *aObject)
Definition: property.h:273
std::map< wxString, std::unique_ptr< PROPERTY_BASE > > m_ownProperties
Properties unique to this type (i.e. not inherited)
Definition: property_mgr.h:209

References PROPERTY_BASE::get().

Referenced by rebuild().

◆ rebuild()

void PROPERTY_MANAGER::CLASS_DESC::rebuild ( )

Recreates the list of properties

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
Replaced properties (TYPE_ID / name)
Definition: property_mgr.h:218
void collectPropsRecur(PROPERTY_LIST &aResult, PROPERTY_SET &aReplaced) const
Traverses the class inheritance hierarchy bottom-to-top, gathering all properties available to a type
std::set< std::pair< size_t, wxString > > PROPERTY_SET
Definition: property_mgr.h:42
std::vector< PROPERTY_BASE * > m_allProperties
All properties (both unique to the type and inherited)
Definition: property_mgr.h:215

References collectPropsRecur(), m_allProperties, and m_replaced.

Member Data Documentation

◆ m_allProperties

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

All properties (both unique to the type and inherited)

Definition at line 215 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

Types after which this type inherits

Definition at line 206 of file property_mgr.h.

Referenced by PROPERTY_MANAGER::InheritsAfter().

◆ m_id

const TYPE_ID PROPERTY_MANAGER::CLASS_DESC::m_id

Unique type identifier (obtained using TYPE_HASH)

Definition at line 203 of file property_mgr.h.

◆ m_ownProperties

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

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

Definition at line 209 of file property_mgr.h.

Referenced by PROPERTY_MANAGER::AddProperty().

◆ m_replaced

PROPERTY_SET PROPERTY_MANAGER::CLASS_DESC::m_replaced

Replaced properties (TYPE_ID / name)

Definition at line 218 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

Type converters available for this type

Definition at line 212 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: