|
KiCad PCB EDA Suite
|
Provide class metadata.Helper macro to map type hashes to names. More...
#include <property_mgr.h>
Classes | |
| struct | CLASS_DESC |
| Returns metadata for a specific type. More... | |
| struct | CLASS_INFO |
Public Types | |
| typedef std::vector< CLASS_INFO > | CLASSES_INFO |
Public Member Functions | |
| void | RegisterType (TYPE_ID aType, const wxString &aName) |
| Associate a name with a type. | |
| PROPERTY_BASE * | GetProperty (TYPE_ID aType, const wxString &aProperty) const |
| Return a property for a specific type. | |
| const std::vector< PROPERTY_BASE * > & | GetProperties (TYPE_ID aType) const |
| Return all properties for a specific type. | |
| const std::map< PROPERTY_BASE *, int > & | GetDisplayOrder (TYPE_ID aType) const |
| const std::vector< wxString > & | GetGroupDisplayOrder (TYPE_ID aType) const |
| const void * | TypeCast (const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const |
| Cast a type to another type. | |
| void * | TypeCast (void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const |
| PROPERTY_BASE & | AddProperty (PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString) |
| Register a property. | |
| PROPERTY_BASE & | ReplaceProperty (size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString) |
| Replace an existing property for a specific type. | |
| void | AddTypeCast (TYPE_CAST_BASE *aCast) |
| Register a type converter. | |
| void | InheritsAfter (TYPE_ID aDerived, TYPE_ID aBase) |
| Declare an inheritance relationship between types. | |
| void | Mask (TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName) |
| Sets a base class property as masked in a derived class. | |
| void | OverrideAvailability (TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc) |
| Sets an override availability functor for a base class property of a given derived class. | |
| void | OverrideWriteability (TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc) |
| Sets an override writeability functor for a base class property of a given derived class. | |
| bool | IsAvailableFor (TYPE_ID aItemClass, PROPERTY_BASE *aProp, INSPECTABLE *aItem) |
| Checks overriden availability and original availability of a property, returns false if the property is unavailable in either case. | |
| bool | IsWriteableFor (TYPE_ID aItemClass, PROPERTY_BASE *aProp, INSPECTABLE *aItem) |
| Checks overriden availability and original availability of a property, returns false if the property is unavailable in either case. | |
| bool | IsOfType (TYPE_ID aDerived, TYPE_ID aBase) const |
| Return true if aDerived is inherited from aBase. | |
| void | Rebuild () |
| Rebuild the list of all registered properties. | |
| CLASSES_INFO | GetAllClasses () |
| void | PropertyChanged (INSPECTABLE *aObject, PROPERTY_BASE *aProperty) |
| Callback to alert the notification system that a property has changed. | |
| class PROPERTY_LISTENER_SUBSCRIPTION | RegisterListener (TYPE_ID aType, PROPERTY_LISTENER aListenerFunc) |
| Register a listener for the given type and return a move-only subscription that auto-unregisters in its destructor. | |
| void | UnregisterListener (TYPE_ID aType, PROPERTY_LISTENER_HANDLE aHandle) |
| Remove a single listener registration by its handle. | |
Static Public Member Functions | |
| static PROPERTY_MANAGER & | Instance () |
Private Member Functions | |
| PROPERTY_MANAGER () | |
| ~PROPERTY_MANAGER () noexcept | |
| CLASS_DESC & | getClass (TYPE_ID aTypeId) |
Private Attributes | |
| std::unordered_map< TYPE_ID, wxString > | m_classNames |
| Map of all available types. | |
| std::unordered_map< TYPE_ID, CLASS_DESC > | m_classes |
| bool | m_dirty |
| Flag indicating that the list of properties needs to be rebuild (RebuildProperties()) | |
| std::map< TYPE_ID, std::vector< std::pair< PROPERTY_LISTENER_HANDLE, PROPERTY_LISTENER > > > | m_listeners |
| PROPERTY_LISTENER_HANDLE | m_nextListenerHandle = 0 |
| COMMIT * | m_managedCommit |
Friends | |
| class | PROPERTY_COMMIT_HANDLER |
| Structure holding type meta-data. | |
Provide class metadata.Helper macro to map type hashes to names.
Each class handled by PROPERTY_MANAGER needs to be described using AddProperty(), AddTypeCast() and InheritsAfter() methods.
Enum types use a dedicated property type (PROPERTY_ENUM), define its possible values with ENUM_MAP class, then describe the type using macros:
Once all classes are described, the property list must be build using Rebuild() method.
Definition at line 78 of file property_mgr.h.
| typedef std::vector<CLASS_INFO> PROPERTY_MANAGER::CLASSES_INFO |
Definition at line 243 of file property_mgr.h.
|
inlineprivate |
Definition at line 275 of file property_mgr.h.
References m_dirty, and m_managedCommit.
Referenced by GetDisplayOrder(), GetGroupDisplayOrder(), GetProperties(), GetProperty(), Instance(), PROPERTY_MANAGER::CLASS_DESC::rebuild(), and RegisterType().
|
privatedefaultnoexcept |
| PROPERTY_BASE & PROPERTY_MANAGER::AddProperty | ( | PROPERTY_BASE * | aProperty, |
| const wxString & | aGroup = wxEmptyString ) |
Register a property.
Properties for a given item will be shown in the order they are added. If a group name is supplied, the group will be created if it does not yet exists. Groups will likewise be shown in the order they are added (so, groups first added by a base class will appear before those of a child class).
| aProperty | is the property to register. |
| aGroup | is an optional grouping key for the property |
Definition at line 133 of file property_mgr.cpp.
References getClass(), m_dirty, PROPERTY_MANAGER::CLASS_DESC::m_groupDisplayOrder, PROPERTY_MANAGER::CLASS_DESC::m_groups, PROPERTY_MANAGER::CLASS_DESC::m_ownDisplayOrder, PROPERTY_MANAGER::CLASS_DESC::m_ownProperties, PROPERTY_BASE::Name(), name, PROPERTY_BASE::OwnerHash(), and PROPERTY_BASE::SetGroup().
Referenced by ALIGNED_DIMENSION_DESC::ALIGNED_DIMENSION_DESC(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), CLASS_A_DESC::CLASS_A_DESC(), CLASS_B_DESC::CLASS_B_DESC(), CLASS_C_DESC::CLASS_C_DESC(), CLASS_D_DESC::CLASS_D_DESC(), DIMENSION_DESC::DIMENSION_DESC(), EDA_ITEM_DESC::EDA_ITEM_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), EDA_TEXT_DESC::EDA_TEXT_DESC(), FOOTPRINT_DESC::FOOTPRINT_DESC(), LEADER_DIMENSION_DESC::LEADER_DIMENSION_DESC(), LIB_SYMBOL_DESC::LIB_SYMBOL_DESC(), PAD_DESC::PAD_DESC(), PCB_BARCODE_DESC::PCB_BARCODE_DESC(), PCB_FIELD_DESC::PCB_FIELD_DESC(), PCB_GROUP_DESC::PCB_GROUP_DESC(), PCB_POINT_DESC::PCB_POINT_DESC(), PCB_REFERENCE_IMAGE_DESC::PCB_REFERENCE_IMAGE_DESC(), PCB_SHAPE_DESC::PCB_SHAPE_DESC(), PCB_TABLE_DESC::PCB_TABLE_DESC(), PCB_TABLECELL_DESC::PCB_TABLECELL_DESC(), PCB_TARGET_DESC::PCB_TARGET_DESC(), PCB_TEXT_DESC::PCB_TEXT_DESC(), PCB_TEXTBOX_DESC::PCB_TEXTBOX_DESC(), PCB_TUNING_PATTERN_DESC::PCB_TUNING_PATTERN_DESC(), RADIAL_DIMENSION_DESC::RADIAL_DIMENSION_DESC(), ReplaceProperty(), SCH_BITMAP_DESC::SCH_BITMAP_DESC(), SCH_BUS_ENTRY_DESC::SCH_BUS_ENTRY_DESC(), SCH_DIRECTIVE_LABEL_DESC::SCH_DIRECTIVE_LABEL_DESC(), SCH_FIELD_DESC::SCH_FIELD_DESC(), SCH_GROUP_DESC::SCH_GROUP_DESC(), SCH_ITEM_DESC::SCH_ITEM_DESC(), SCH_JUNCTION_DESC::SCH_JUNCTION_DESC(), SCH_LABEL_DESC::SCH_LABEL_DESC(), SCH_LINE_DESC::SCH_LINE_DESC(), SCH_PIN_DESC::SCH_PIN_DESC(), SCH_RULE_AREA_DESC::SCH_RULE_AREA_DESC(), SCH_SHAPE_DESC::SCH_SHAPE_DESC(), SCH_SHEET_DESC::SCH_SHEET_DESC(), SCH_SYMBOL_DESC::SCH_SYMBOL_DESC(), SCH_TABLE_DESC::SCH_TABLE_DESC(), SCH_TABLECELL_DESC::SCH_TABLECELL_DESC(), SCH_TEXT_DESC::SCH_TEXT_DESC(), SCH_TEXTBOX_DESC::SCH_TEXTBOX_DESC(), TRACK_VIA_DESC::TRACK_VIA_DESC(), and ZONE_DESC::ZONE_DESC().
| void PROPERTY_MANAGER::AddTypeCast | ( | TYPE_CAST_BASE * | aCast | ) |
Register a type converter.
Required prior TypeCast() usage.
| aCast | is the type converter to register. |
Definition at line 172 of file property_mgr.cpp.
References TYPE_CAST_BASE::BaseHash(), TYPE_CAST_BASE::DerivedHash(), getClass(), and PROPERTY_MANAGER::CLASS_DESC::m_typeCasts.
Referenced by ALIGNED_DIMENSION_DESC::ALIGNED_DIMENSION_DESC(), CENTER_DIMENSION_DESC::CENTER_DIMENSION_DESC(), CLASS_D_DESC::CLASS_D_DESC(), DIMENSION_DESC::DIMENSION_DESC(), FOOTPRINT_DESC::FOOTPRINT_DESC(), LEADER_DIMENSION_DESC::LEADER_DIMENSION_DESC(), ORTHOGONAL_DIMENSION_DESC::ORTHOGONAL_DIMENSION_DESC(), PAD_DESC::PAD_DESC(), PCB_FIELD_DESC::PCB_FIELD_DESC(), PCB_GROUP_DESC::PCB_GROUP_DESC(), PCB_MARKER_DESC::PCB_MARKER_DESC(), PCB_SHAPE_DESC::PCB_SHAPE_DESC(), PCB_TABLE_DESC::PCB_TABLE_DESC(), PCB_TABLECELL_DESC::PCB_TABLECELL_DESC(), PCB_TEXT_DESC::PCB_TEXT_DESC(), PCB_TEXTBOX_DESC::PCB_TEXTBOX_DESC(), PCB_TUNING_PATTERN_DESC::PCB_TUNING_PATTERN_DESC(), RADIAL_DIMENSION_DESC::RADIAL_DIMENSION_DESC(), SCH_DIRECTIVE_LABEL_DESC::SCH_DIRECTIVE_LABEL_DESC(), SCH_FIELD_DESC::SCH_FIELD_DESC(), SCH_GROUP_DESC::SCH_GROUP_DESC(), SCH_LABEL_DESC::SCH_LABEL_DESC(), SCH_PIN_DESC::SCH_PIN_DESC(), SCH_RULE_AREA_DESC::SCH_RULE_AREA_DESC(), SCH_SHAPE_DESC::SCH_SHAPE_DESC(), SCH_SHEET_PIN_DESC::SCH_SHEET_PIN_DESC(), SCH_SYMBOL_DESC::SCH_SYMBOL_DESC(), SCH_TABLE_DESC::SCH_TABLE_DESC(), SCH_TABLECELL_DESC::SCH_TABLECELL_DESC(), SCH_TEXT_DESC::SCH_TEXT_DESC(), and SCH_TEXTBOX_DESC::SCH_TEXTBOX_DESC().
| PROPERTY_MANAGER::CLASSES_INFO PROPERTY_MANAGER::GetAllClasses | ( | ) |
Definition at line 407 of file property_mgr.cpp.
References info, m_classes, and m_classNames.
Referenced by PCBEXPR_UCODE::CreateVarRef(), PANEL_DRC_RULE_EDITOR::onScintillaCharAdded(), and PANEL_SETUP_RULES::onScintillaCharAdded().
|
private |
Definition at line 287 of file property_mgr.cpp.
References m_classes.
Referenced by AddProperty(), AddTypeCast(), InheritsAfter(), IsAvailableFor(), IsWriteableFor(), Mask(), OverrideAvailability(), OverrideWriteability(), PropertyChanged(), and ReplaceProperty().
| const std::map< PROPERTY_BASE *, int > & PROPERTY_MANAGER::GetDisplayOrder | ( | TYPE_ID | aType | ) | const |
Definition at line 85 of file property_mgr.cpp.
References EMPTY_PROP_DISPLAY_ORDER, m_classes, m_dirty, PROPERTY_MANAGER(), and Rebuild().
Referenced by PROPERTIES_PANEL::rebuildProperties().
| const std::vector< wxString > & PROPERTY_MANAGER::GetGroupDisplayOrder | ( | TYPE_ID | aType | ) | const |
Definition at line 99 of file property_mgr.cpp.
References EMPTY_GROUP_DISPLAY_ORDER, m_classes, m_dirty, PROPERTY_MANAGER(), and Rebuild().
Referenced by PROPERTIES_PANEL::rebuildProperties().
| const std::vector< PROPERTY_BASE * > & PROPERTY_MANAGER::GetProperties | ( | TYPE_ID | aType | ) | const |
Return all properties for a specific type.
| aType | is the type identifier (obtained using TYPE_HASH()). |
Definition at line 71 of file property_mgr.cpp.
References EMPTY_PROP_LIST, m_classes, m_dirty, PROPERTY_MANAGER(), and Rebuild().
Referenced by KICAD_DIFF::DiffItemProperties(), KICAD_DIFF::ItemProperties(), DIALOG_FIND_BY_PROPERTIES::onScintillaCharAdded(), PANEL_DRC_RULE_EDITOR::onScintillaCharAdded(), PANEL_SETUP_RULES::onScintillaCharAdded(), PROPERTIES_PANEL::rebuildProperties(), and DIALOG_FIND_BY_PROPERTIES::rebuildPropertyGrid().
| PROPERTY_BASE * PROPERTY_MANAGER::GetProperty | ( | TYPE_ID | aType, |
| const wxString & | aProperty ) const |
Return a property for a specific type.
| aType | is the type identifier (obtained using TYPE_HASH()). |
| aProperty | is the property name used during class registration. |
Definition at line 49 of file property_mgr.cpp.
References PROPERTY_MANAGER::CLASS_DESC::m_allProperties, m_classes, m_dirty, PROPERTY_BASE::Name(), PROPERTY_MANAGER(), and Rebuild().
Referenced by KICAD_DIFF::ApplyPropertyResolutions(), BOOST_AUTO_TEST_CASE(), PCBEXPR_UCODE::CreateVarRef(), PROPERTIES_PANEL::extractValueAndWritability(), INSPECTABLE::Get(), DIALOG_FIND_BY_PROPERTIES::itemMatchesPropertyCriteria(), PROPERTIES_PANEL::rebuildProperties(), DIALOG_FIND_BY_PROPERTIES::rebuildPropertyGrid(), and INSPECTABLE::Set().
Declare an inheritance relationship between types.
| aBase | is the base type identifier (obtained using TYPE_HASH()). |
| aDerived | is the derived type identifier (obtained using TYPE_HASH()). |
Definition at line 182 of file property_mgr.cpp.
References getClass(), PROPERTY_MANAGER::CLASS_DESC::m_bases, m_dirty, and PROPERTY_MANAGER::CLASS_DESC::m_typeCasts.
Referenced by ALIGNED_DIMENSION_DESC::ALIGNED_DIMENSION_DESC(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), CENTER_DIMENSION_DESC::CENTER_DIMENSION_DESC(), CLASS_B_DESC::CLASS_B_DESC(), CLASS_D_DESC::CLASS_D_DESC(), DIMENSION_DESC::DIMENSION_DESC(), FOOTPRINT_DESC::FOOTPRINT_DESC(), LEADER_DIMENSION_DESC::LEADER_DIMENSION_DESC(), LIB_SYMBOL_DESC::LIB_SYMBOL_DESC(), ORTHOGONAL_DIMENSION_DESC::ORTHOGONAL_DIMENSION_DESC(), PAD_DESC::PAD_DESC(), PCB_BARCODE_DESC::PCB_BARCODE_DESC(), PCB_FIELD_DESC::PCB_FIELD_DESC(), PCB_GROUP_DESC::PCB_GROUP_DESC(), PCB_MARKER_DESC::PCB_MARKER_DESC(), PCB_POINT_DESC::PCB_POINT_DESC(), PCB_REFERENCE_IMAGE_DESC::PCB_REFERENCE_IMAGE_DESC(), PCB_SHAPE_DESC::PCB_SHAPE_DESC(), PCB_TABLE_DESC::PCB_TABLE_DESC(), PCB_TABLECELL_DESC::PCB_TABLECELL_DESC(), PCB_TARGET_DESC::PCB_TARGET_DESC(), PCB_TEXT_DESC::PCB_TEXT_DESC(), PCB_TEXTBOX_DESC::PCB_TEXTBOX_DESC(), PCB_TUNING_PATTERN_DESC::PCB_TUNING_PATTERN_DESC(), RADIAL_DIMENSION_DESC::RADIAL_DIMENSION_DESC(), SCH_BITMAP_DESC::SCH_BITMAP_DESC(), SCH_BUS_ENTRY_DESC::SCH_BUS_ENTRY_DESC(), SCH_DIRECTIVE_LABEL_DESC::SCH_DIRECTIVE_LABEL_DESC(), SCH_FIELD_DESC::SCH_FIELD_DESC(), SCH_GROUP_DESC::SCH_GROUP_DESC(), SCH_ITEM_DESC::SCH_ITEM_DESC(), SCH_JUNCTION_DESC::SCH_JUNCTION_DESC(), SCH_LABEL_DESC::SCH_LABEL_DESC(), SCH_LINE_DESC::SCH_LINE_DESC(), SCH_PIN_DESC::SCH_PIN_DESC(), SCH_RULE_AREA_DESC::SCH_RULE_AREA_DESC(), SCH_SHAPE_DESC::SCH_SHAPE_DESC(), SCH_SHEET_DESC::SCH_SHEET_DESC(), SCH_SHEET_PIN_DESC::SCH_SHEET_PIN_DESC(), SCH_SYMBOL_DESC::SCH_SYMBOL_DESC(), SCH_TABLE_DESC::SCH_TABLE_DESC(), SCH_TABLECELL_DESC::SCH_TABLECELL_DESC(), SCH_TEXT_DESC::SCH_TEXT_DESC(), SCH_TEXTBOX_DESC::SCH_TEXTBOX_DESC(), TRACK_VIA_DESC::TRACK_VIA_DESC(), and ZONE_DESC::ZONE_DESC().
|
inlinestatic |
Definition at line 81 of file property_mgr.h.
References PROPERTY_MANAGER().
Referenced by ALIGNED_DIMENSION_DESC::ALIGNED_DIMENSION_DESC(), KICAD_DIFF::ApplyPropertyResolutions(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), CENTER_DIMENSION_DESC::CENTER_DIMENSION_DESC(), CLASS_A_DESC::CLASS_A_DESC(), CLASS_B_DESC::CLASS_B_DESC(), CLASS_C_DESC::CLASS_C_DESC(), CLASS_D_DESC::CLASS_D_DESC(), CLASS_E_DESC::CLASS_E_DESC(), PCBEXPR_UCODE::CreateVarRef(), KICAD_DIFF::DiffItemProperties(), DIMENSION_DESC::DIMENSION_DESC(), EDA_ITEM_DESC::EDA_ITEM_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), EDA_TEXT_DESC::EDA_TEXT_DESC(), PROPERTIES_PANEL::extractValueAndWritability(), FOOTPRINT_DESC::FOOTPRINT_DESC(), GENERATOR_TOOL::GENERATOR_TOOL(), INSPECTABLE::Get(), INSPECTABLE::Get(), DIALOG_FIND_BY_PROPERTIES::itemMatchesPropertyCriteria(), KICAD_DIFF::ItemProperties(), LEADER_DIMENSION_DESC::LEADER_DIMENSION_DESC(), LIB_SYMBOL_DESC::LIB_SYMBOL_DESC(), main(), main(), DIALOG_FIND_BY_PROPERTIES::onScintillaCharAdded(), PANEL_DRC_RULE_EDITOR::onScintillaCharAdded(), PANEL_SETUP_RULES::onScintillaCharAdded(), ORTHOGONAL_DIMENSION_DESC::ORTHOGONAL_DIMENSION_DESC(), PAD_DESC::PAD_DESC(), PCB_BARCODE_DESC::PCB_BARCODE_DESC(), PCB_FIELD_DESC::PCB_FIELD_DESC(), PCB_GROUP_DESC::PCB_GROUP_DESC(), PCB_MARKER_DESC::PCB_MARKER_DESC(), PCB_POINT_DESC::PCB_POINT_DESC(), PCB_REFERENCE_IMAGE_DESC::PCB_REFERENCE_IMAGE_DESC(), PCB_SHAPE_DESC::PCB_SHAPE_DESC(), PCB_TABLE_DESC::PCB_TABLE_DESC(), PCB_TABLECELL_DESC::PCB_TABLECELL_DESC(), PCB_TARGET_DESC::PCB_TARGET_DESC(), PCB_TEXT_DESC::PCB_TEXT_DESC(), PCB_TEXTBOX_DESC::PCB_TEXTBOX_DESC(), PCB_TUNING_PATTERN_DESC::PCB_TUNING_PATTERN_DESC(), PROPERTY_COMMIT_HANDLER::PROPERTY_COMMIT_HANDLER(), RADIAL_DIMENSION_DESC::RADIAL_DIMENSION_DESC(), PROPERTIES_PANEL::rebuildProperties(), DIALOG_FIND_BY_PROPERTIES::rebuildPropertyGrid(), PROPERTY_LISTENER_SUBSCRIPTION::reset(), SCH_BITMAP_DESC::SCH_BITMAP_DESC(), SCH_BUS_ENTRY_DESC::SCH_BUS_ENTRY_DESC(), SCH_DIRECTIVE_LABEL_DESC::SCH_DIRECTIVE_LABEL_DESC(), SCH_FIELD_DESC::SCH_FIELD_DESC(), SCH_GROUP_DESC::SCH_GROUP_DESC(), SCH_ITEM_DESC::SCH_ITEM_DESC(), SCH_JUNCTION_DESC::SCH_JUNCTION_DESC(), SCH_LABEL_DESC::SCH_LABEL_DESC(), SCH_LINE_DESC::SCH_LINE_DESC(), SCH_PIN_DESC::SCH_PIN_DESC(), SCH_RULE_AREA_DESC::SCH_RULE_AREA_DESC(), SCH_SHAPE_DESC::SCH_SHAPE_DESC(), SCH_SHEET_DESC::SCH_SHEET_DESC(), SCH_SHEET_PIN_DESC::SCH_SHEET_PIN_DESC(), SCH_SYMBOL_DESC::SCH_SYMBOL_DESC(), SCH_TABLE_DESC::SCH_TABLE_DESC(), SCH_TABLECELL_DESC::SCH_TABLECELL_DESC(), SCH_TEXT_DESC::SCH_TEXT_DESC(), SCH_TEXTBOX_DESC::SCH_TEXTBOX_DESC(), SCHEMATIC::SCHEMATIC(), INSPECTABLE::Set(), INSPECTABLE::Set(), INSPECTABLE::Set(), INSPECTABLE::Set(), TRACK_VIA_DESC::TRACK_VIA_DESC(), ZONE_DESC::ZONE_DESC(), and PROPERTY_COMMIT_HANDLER::~PROPERTY_COMMIT_HANDLER().
| bool PROPERTY_MANAGER::IsAvailableFor | ( | TYPE_ID | aItemClass, |
| PROPERTY_BASE * | aProp, | ||
| INSPECTABLE * | aItem ) |
Checks overriden availability and original availability of a property, returns false if the property is unavailable in either case.
TODO: This isn't the cleanest API, consider how to merge with PROPERTY_BASE::Available
Definition at line 227 of file property_mgr.cpp.
References PROPERTY_BASE::Available(), PROPERTY_BASE::BaseHash(), getClass(), PROPERTY_MANAGER::CLASS_DESC::m_availabilityOverrides, and PROPERTY_BASE::Name().
Referenced by KICAD_DIFF::DiffItemProperties(), PROPERTIES_PANEL::extractValueAndWritability(), DIALOG_FIND_BY_PROPERTIES::itemMatchesPropertyCriteria(), KICAD_DIFF::ItemProperties(), and DIALOG_FIND_BY_PROPERTIES::rebuildPropertyGrid().
Return true if aDerived is inherited from aBase.
Definition at line 259 of file property_mgr.cpp.
References IsOfType(), and m_classes.
Referenced by PCBEXPR_UCODE::CreateVarRef(), IsOfType(), and TypeCast().
| bool PROPERTY_MANAGER::IsWriteableFor | ( | TYPE_ID | aItemClass, |
| PROPERTY_BASE * | aProp, | ||
| INSPECTABLE * | aItem ) |
Checks overriden availability and original availability of a property, returns false if the property is unavailable in either case.
TODO: This isn't the cleanest API, consider how to merge with PROPERTY_BASE::Writeable
Definition at line 243 of file property_mgr.cpp.
References PROPERTY_BASE::BaseHash(), getClass(), PROPERTY_MANAGER::CLASS_DESC::m_writeabilityOverrides, PROPERTY_BASE::Name(), and PROPERTY_BASE::Writeable().
Referenced by PROPERTIES_PANEL::extractValueAndWritability().
Sets a base class property as masked in a derived class.
Masked properties are hidden from the list of editable properties for this class.
| aDerived | is the type to apply the mask for. |
| aBase | is the type that aName belongs to. |
| aName | is the name of a property on the base class. |
Definition at line 195 of file property_mgr.cpp.
References getClass(), m_dirty, and PROPERTY_MANAGER::CLASS_DESC::m_maskedBaseProperties.
Referenced by DIMENSION_DESC::DIMENSION_DESC(), PAD_DESC::PAD_DESC(), PCB_FIELD_DESC::PCB_FIELD_DESC(), PCB_GROUP_DESC::PCB_GROUP_DESC(), PCB_MARKER_DESC::PCB_MARKER_DESC(), PCB_SHAPE_DESC::PCB_SHAPE_DESC(), PCB_TABLECELL_DESC::PCB_TABLECELL_DESC(), PCB_TEXT_DESC::PCB_TEXT_DESC(), PCB_TEXTBOX_DESC::PCB_TEXTBOX_DESC(), SCH_DIRECTIVE_LABEL_DESC::SCH_DIRECTIVE_LABEL_DESC(), SCH_FIELD_DESC::SCH_FIELD_DESC(), SCH_GROUP_DESC::SCH_GROUP_DESC(), SCH_LABEL_DESC::SCH_LABEL_DESC(), SCH_PIN_DESC::SCH_PIN_DESC(), SCH_SHEET_PIN_DESC::SCH_SHEET_PIN_DESC(), SCH_TABLECELL_DESC::SCH_TABLECELL_DESC(), SCH_TEXT_DESC::SCH_TEXT_DESC(), SCH_TEXTBOX_DESC::SCH_TEXTBOX_DESC(), and TRACK_VIA_DESC::TRACK_VIA_DESC().
| void PROPERTY_MANAGER::OverrideAvailability | ( | TYPE_ID | aDerived, |
| TYPE_ID | aBase, | ||
| const wxString & | aName, | ||
| std::function< bool(INSPECTABLE *)> | aFunc ) |
Sets an override availability functor for a base class property of a given derived class.
| aDerived | is the type to apply the mask for. |
| aBase | is the type that aName belongs to. |
| aName | is the name of a property on the base class. |
| aFunc | is the new availability functor to apply. |
Definition at line 205 of file property_mgr.cpp.
References getClass(), PROPERTY_MANAGER::CLASS_DESC::m_availabilityOverrides, and m_dirty.
Referenced by ALIGNED_DIMENSION_DESC::ALIGNED_DIMENSION_DESC(), CENTER_DIMENSION_DESC::CENTER_DIMENSION_DESC(), LEADER_DIMENSION_DESC::LEADER_DIMENSION_DESC(), ORTHOGONAL_DIMENSION_DESC::ORTHOGONAL_DIMENSION_DESC(), PAD_DESC::PAD_DESC(), PCB_SHAPE_DESC::PCB_SHAPE_DESC(), PCB_TEXT_DESC::PCB_TEXT_DESC(), RADIAL_DIMENSION_DESC::RADIAL_DIMENSION_DESC(), SCH_FIELD_DESC::SCH_FIELD_DESC(), SCH_SHAPE_DESC::SCH_SHAPE_DESC(), and ZONE_DESC::ZONE_DESC().
| void PROPERTY_MANAGER::OverrideWriteability | ( | TYPE_ID | aDerived, |
| TYPE_ID | aBase, | ||
| const wxString & | aName, | ||
| std::function< bool(INSPECTABLE *)> | aFunc ) |
Sets an override writeability functor for a base class property of a given derived class.
| aDerived | is the type to apply the mask for. |
| aBase | is the type that aName belongs to. |
| aName | is the name of a property on the base class. |
| aFunc | is the new availability functor to apply. |
Definition at line 216 of file property_mgr.cpp.
References getClass(), m_dirty, and PROPERTY_MANAGER::CLASS_DESC::m_writeabilityOverrides.
Referenced by SCH_FIELD_DESC::SCH_FIELD_DESC(), and SCH_SHAPE_DESC::SCH_SHAPE_DESC().
| void PROPERTY_MANAGER::PropertyChanged | ( | INSPECTABLE * | aObject, |
| PROPERTY_BASE * | aProperty ) |
Callback to alert the notification system that a property has changed.
| aObject | is the object whose property just changed |
| aProperty | is the property that changed |
Definition at line 428 of file property_mgr.cpp.
References getClass(), PROPERTY_MANAGER::CLASS_DESC::m_bases, PROPERTY_MANAGER::CLASS_DESC::m_id, m_listeners, m_managedCommit, and TYPE_HASH.
Referenced by INSPECTABLE::Set(), INSPECTABLE::Set(), INSPECTABLE::Set(), and INSPECTABLE::Set().
| void PROPERTY_MANAGER::Rebuild | ( | ) |
Rebuild the list of all registered properties.
Needs to be called once before GetProperty()/GetProperties() are used.
Definition at line 278 of file property_mgr.cpp.
References m_classes, and m_dirty.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), GetDisplayOrder(), GetGroupDisplayOrder(), GetProperties(), GetProperty(), main(), and main().
|
nodiscard |
Register a listener for the given type and return a move-only subscription that auto-unregisters in its destructor.
Store the result as a member of the listening object — when the object is destroyed the subscription lapses on its own.
Definition at line 470 of file property_mgr.cpp.
References m_listeners, and m_nextListenerHandle.
Referenced by GENERATOR_TOOL::GENERATOR_TOOL(), and SCHEMATIC::SCHEMATIC().
| void PROPERTY_MANAGER::RegisterType | ( | TYPE_ID | aType, |
| const wxString & | aName ) |
Associate a name with a type.
Build a map to provide faster type look-up.
| aType | is the type identifier (obtained using TYPE_HASH()). |
| aName | is the type name. |
Definition at line 42 of file property_mgr.cpp.
References m_classNames, PROPERTY_MANAGER(), and RegisterType().
Referenced by RegisterType().
| PROPERTY_BASE & PROPERTY_MANAGER::ReplaceProperty | ( | size_t | aBase, |
| const wxString & | aName, | ||
| PROPERTY_BASE * | aNew, | ||
| const wxString & | aGroup = wxEmptyString ) |
Replace an existing property for a specific type.
It is used to modify a property that has been inherited from a base class. This method is used instead of AddProperty().
| aBase | is the base class type the delivers the original property. |
| aName | is the name of the replaced property. |
| aNew | is the property replacing the inherited one. |
| aGroup | is the group to set for the replaced property. |
Definition at line 163 of file property_mgr.cpp.
References AddProperty(), getClass(), PROPERTY_MANAGER::CLASS_DESC::m_replaced, and PROPERTY_BASE::OwnerHash().
Referenced by BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), CLASS_D_DESC::CLASS_D_DESC(), CLASS_E_DESC::CLASS_E_DESC(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_REFERENCE_IMAGE_DESC::PCB_REFERENCE_IMAGE_DESC(), PCB_SHAPE_DESC::PCB_SHAPE_DESC(), PCB_TUNING_PATTERN_DESC::PCB_TUNING_PATTERN_DESC(), SCH_FIELD_DESC::SCH_FIELD_DESC(), TRACK_VIA_DESC::TRACK_VIA_DESC(), and ZONE_DESC::ZONE_DESC().
| const void * PROPERTY_MANAGER::TypeCast | ( | const void * | aSource, |
| TYPE_ID | aBase, | ||
| TYPE_ID | aTarget ) const |
Cast a type to another type.
Used for correct type-casting of types with multi-inheritance. Requires registration of an appropriate converter (AddTypeCast).
| aSource | is a pointer to the casted object. |
| aBase | is aSource type identifier (obtained using TYPE_HASH()). |
| aTarget | is the desired type identifier (obtained using TYPE_HASH()). |
Definition at line 113 of file property_mgr.cpp.
References IsOfType(), and m_classes.
Referenced by INSPECTABLE::Get(), INSPECTABLE::Get(), INSPECTABLE::Set(), INSPECTABLE::Set(), INSPECTABLE::Set(), INSPECTABLE::Set(), and TypeCast().
Definition at line 131 of file property_mgr.h.
References TypeCast().
| void PROPERTY_MANAGER::UnregisterListener | ( | TYPE_ID | aType, |
| PROPERTY_LISTENER_HANDLE | aHandle ) |
Remove a single listener registration by its handle.
Prefer the PROPERTY_LISTENER_SUBSCRIPTION returned by RegisterListener; this entry point exists for the subscription wrapper itself.
Defined out-of-line in property_mgr.cpp so consumers of this header (e.g. classes that hold a PROPERTY_LISTENER_SUBSCRIPTION member) don't have to fully instantiate PROPERTY_MANAGER — that would in turn require complete PROPERTY_BASE / TYPE_CAST_BASE for the unique_ptr members inside CLASS_DESC.
Definition at line 478 of file property_mgr.cpp.
References m_listeners.
Referenced by PROPERTY_LISTENER_SUBSCRIPTION::reset().
|
friend |
Structure holding type meta-data.
Definition at line 292 of file property_mgr.h.
References PROPERTY_COMMIT_HANDLER.
Referenced by PROPERTY_COMMIT_HANDLER.
|
private |
Definition at line 364 of file property_mgr.h.
Referenced by GetAllClasses(), getClass(), GetDisplayOrder(), GetGroupDisplayOrder(), GetProperties(), GetProperty(), IsOfType(), Rebuild(), and TypeCast().
|
private |
Map of all available types.
Definition at line 361 of file property_mgr.h.
Referenced by GetAllClasses(), and RegisterType().
|
private |
Flag indicating that the list of properties needs to be rebuild (RebuildProperties())
Definition at line 367 of file property_mgr.h.
Referenced by AddProperty(), GetDisplayOrder(), GetGroupDisplayOrder(), GetProperties(), GetProperty(), InheritsAfter(), Mask(), OverrideAvailability(), OverrideWriteability(), PROPERTY_MANAGER(), and Rebuild().
|
private |
Definition at line 370 of file property_mgr.h.
Referenced by PropertyChanged(), RegisterListener(), and UnregisterListener().
|
private |
Definition at line 374 of file property_mgr.h.
Referenced by PROPERTY_COMMIT_HANDLER::PROPERTY_COMMIT_HANDLER(), PROPERTY_MANAGER(), PropertyChanged(), and PROPERTY_COMMIT_HANDLER::~PROPERTY_COMMIT_HANDLER().
|
private |
Definition at line 372 of file property_mgr.h.
Referenced by RegisterListener().