KiCad PCB EDA Suite
A Class Referenceabstract
Inheritance diagram for A:
INSPECTABLE B D E

Public Member Functions

virtual void setA (int a)=0
 
virtual int getA () const =0
 
virtual const int & getA2 () const
 
virtual void setPoint (const wxPoint &p)
 
void setPoint2 (wxPoint &p)
 
void setPoint3 (wxPoint p)
 
void setPoint4 (wxPoint p)
 
const wxPoint & getPoint () const
 
wxPoint getPoint2 () const
 
wxPoint getPoint3 ()
 
const wxPoint & getPoint4 () const
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

Protected Attributes

int m_a = 0
 
wxPoint m_p
 

Detailed Description

Definition at line 29 of file test_property.cpp.

Member Function Documentation

◆ Get() [1/3]

template<typename T >
std::optional< T > INSPECTABLE::Get ( const wxString &  aProperty) const
inlineinherited

Definition at line 104 of file inspectable.h.

105 {
107 TYPE_ID thisType = TYPE_HASH( *this );
108 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109 std::optional<T> ret;
110
111 if( prop )
112 {
113 const void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114
115 if( object )
116 ret = prop->get<T>( object );
117 }
118
119 return ret;
120 }
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:270
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:63
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
#define TYPE_HASH(x)
Definition: property.h:60
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [3/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ getA()

virtual int A::getA ( ) const
pure virtual

Implemented in B, and D.

Referenced by CLASS_A_DESC::CLASS_A_DESC().

◆ getA2()

virtual const int & A::getA2 ( ) const
inlinevirtual

Definition at line 34 of file test_property.cpp.

34{ return m_a; }
int m_a

References m_a.

Referenced by CLASS_A_DESC::CLASS_A_DESC().

◆ getPoint()

const wxPoint & A::getPoint ( ) const
inline

Definition at line 41 of file test_property.cpp.

41{ return m_p; }
wxPoint m_p

References m_p.

Referenced by CLASS_A_DESC::CLASS_A_DESC(), and CLASS_D_DESC::CLASS_D_DESC().

◆ getPoint2()

wxPoint A::getPoint2 ( ) const
inline

Definition at line 42 of file test_property.cpp.

42{ return m_p; }

References m_p.

Referenced by CLASS_A_DESC::CLASS_A_DESC().

◆ getPoint3()

wxPoint A::getPoint3 ( )
inline

Definition at line 43 of file test_property.cpp.

43{ return m_p; }

References m_p.

◆ getPoint4()

const wxPoint & A::getPoint4 ( ) const
inline

Definition at line 44 of file test_property.cpp.

44{ return m_p; }

References m_p.

Referenced by CLASS_A_DESC::CLASS_A_DESC().

◆ Set() [1/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:263

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ setA()

virtual void A::setA ( int  a)
pure virtual

Implemented in B, and D.

Referenced by CLASS_A_DESC::CLASS_A_DESC().

◆ setPoint()

virtual void A::setPoint ( const wxPoint &  p)
inlinevirtual

Definition at line 36 of file test_property.cpp.

36{ m_p = p; }

References m_p.

Referenced by CLASS_A_DESC::CLASS_A_DESC(), and CLASS_D_DESC::CLASS_D_DESC().

◆ setPoint2()

void A::setPoint2 ( wxPoint &  p)
inline

Definition at line 37 of file test_property.cpp.

37{ m_p = p; }

References m_p.

◆ setPoint3()

void A::setPoint3 ( wxPoint  p)
inline

Definition at line 38 of file test_property.cpp.

38{ m_p = p; }

References m_p.

◆ setPoint4()

void A::setPoint4 ( wxPoint  p)
inline

Definition at line 39 of file test_property.cpp.

39{ m_p = p; }

References m_p.

Referenced by CLASS_A_DESC::CLASS_A_DESC().

Member Data Documentation

◆ m_a

int A::m_a = 0
protected

Definition at line 47 of file test_property.cpp.

Referenced by B::getA(), getA2(), and B::setA().

◆ m_p

wxPoint A::m_p
protected

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