KiCad PCB EDA Suite
CLASS_D_DESC Struct Reference

Public Member Functions

 CLASS_D_DESC ()
 

Detailed Description

Definition at line 155 of file test_property.cpp.

Constructor & Destructor Documentation

◆ CLASS_D_DESC()

CLASS_D_DESC::CLASS_D_DESC ( )
inline

Definition at line 157 of file test_property.cpp.

158  {
160  .Map( D::enum_class::TESTA, "TESTA" )
161  .Map( D::enum_class::TESTB, "TESTB" )
162  .Map( D::enum_class::TESTC, "TESTC" );
163 
165  propMgr.AddProperty( new PROPERTY_ENUM<D, enum_glob>( "enumGlob", &D::setGlobEnum, &D::getGlobEnum ) );
167  propMgr.AddProperty( new PROPERTY<D, wxPoint, A>( "point_alias", &D::setPoint, &D::getPoint ) );
168 
169  propMgr.ReplaceProperty( TYPE_HASH( C ), "bool",
170  new PROPERTY<D, bool, C>( "replaced_bool", &D::setBool, &D::getBool ) );
171 
172  // lines below are needed to indicate multiple inheritance
173  propMgr.AddTypeCast( new TYPE_CAST<D, A> );
174  propMgr.AddTypeCast( new TYPE_CAST<D, C> );
175  propMgr.InheritsAfter( TYPE_HASH( D ), TYPE_HASH( A ) );
176  propMgr.InheritsAfter( TYPE_HASH( D ), TYPE_HASH( C ) );
177 
178  auto cond = new PROPERTY<D, int>( "cond", &D::setCond, &D::getCond );
179  cond->SetAvailableFunc( [=](INSPECTABLE* aItem)->bool { return *aItem->Get<int>( "A" ) > 50; } );
180  propMgr.AddProperty( cond );
181  }
void setCond(int a)
const wxPoint & getPoint() const
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
bool getBool() const
enum_glob getGlobEnum() const
int getCond() const
static ENUM_MAP< T > & Instance()
Definition: property.h:517
enum_class getClassEnum() const
void setBool(bool a)
wxAny Get(PROPERTY_BASE *aProperty)
Definition: inspectable.h:84
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declares an inheritance relationship between types.
void setClassEnum(enum_class val)
Class that other classes need to inherit from, in order to be inspectable.
Definition: inspectable.h:33
void setGlobEnum(enum_glob val)
void AddTypeCast(TYPE_CAST_BASE *aCast)
Registers a type converter.
void AddProperty(PROPERTY_BASE *aProperty)
Registers a property.
void ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew)
Replaces an existing property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
virtual void setPoint(const wxPoint &p)

References PROPERTY_MANAGER::AddProperty(), PROPERTY_MANAGER::AddTypeCast(), INSPECTABLE::Get(), C::getBool(), D::getClassEnum(), D::getCond(), D::getGlobEnum(), A::getPoint(), PROPERTY_MANAGER::InheritsAfter(), PROPERTY_MANAGER::Instance(), ENUM_MAP< T >::Instance(), PROPERTY_MANAGER::ReplaceProperty(), C::setBool(), D::setClassEnum(), D::setCond(), D::setGlobEnum(), A::setPoint(), and TYPE_HASH.


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