KiCad PCB EDA Suite
|
A model subscriber implementation using links to represent connections. More...
Namespaces | |
namespace | DETAIL |
Classes | |
class | LINK |
Simple RAII-handle to a subscription. More... | |
class | OBSERVABLE |
Typedefs | |
template<typename T > | |
using | CFG_MAP = std::vector< std::pair< T, long > > |
A config value table is a list of native values (usually enums) to a different set of values, for example, the values used to represent the enum in a config file, or the index used to represent it in a selection list. | |
template<typename MAP > | |
using | CFG_NATIVE_VAL = typename MAP::value_type::first_type |
The "native" type of a CFG_MAP: probably an enum type. | |
Functions | |
wxString | GetRefDesPrefix (const wxString &aRefDes) |
Get the (non-numeric) prefix from a refdes - e.g. | |
wxString | GetRefDesUnannotated (const wxString &aRefDes) |
Return an unannotated refdes from either a prefix or an existing refdes. | |
int | GetRefDesNumber (const wxString &aRefDes) |
Get the numeric suffix from a refdes - e.g. | |
template<typename MAP > | |
static long | GetConfigForVal (const MAP &aMap, CFG_NATIVE_VAL< MAP > aVal) |
Get the mapped config value (the one to write to file, or use in an index) from the given native (probably enum) value. | |
template<typename MAP > | |
static CFG_NATIVE_VAL< MAP > | GetValFromConfig (const MAP &aMap, long aConf) |
Get the native value corresponding to the config value (read from file or UI, probably) and find it in the mapping table. | |
A model subscriber implementation using links to represent connections.
Subscribers can be removed during notification. If no observers are registered, size is the size of a shared_ptr.
using UTIL::CFG_MAP = typedef std::vector<std::pair<T, long> > |
A config value table is a list of native values (usually enums) to a different set of values, for example, the values used to represent the enum in a config file, or the index used to represent it in a selection list.
It can be important to decouple from the internal representation, especially in the case of persistent config files, as adding, removing or modifying the order of items internally can easily result in configs being read incorrectly, and, even if otherwise carefully managed, results in obsolete values being kept in enums as placeholders.
The first item in the list is used default if no matching value is found during lookup.
Definition at line 49 of file config_map.h.
using UTIL::CFG_NATIVE_VAL = typedef typename MAP::value_type::first_type |
The "native" type of a CFG_MAP: probably an enum type.
Definition at line 55 of file config_map.h.
|
static |
Get the mapped config value (the one to write to file, or use in an index) from the given native (probably enum) value.
The default (first item) is returned if the value is not found in the list.
aMap | the value-config mapping table |
aVal | the value to look up |
Definition at line 69 of file config_map.h.
Referenced by PANEL_PCB_DISPLAY_OPTIONS::loadPCBSettings(), and GAL_DISPLAY_OPTIONS_IMPL::WriteConfig().
int UTIL::GetRefDesNumber | ( | const wxString & | aRefDes | ) |
Get the numeric suffix from a refdes - e.g.
R1 -> 1 IC34 -> 34 R? -> -1
aRefDes | full refdes |
Definition at line 54 of file refdes_utils.cpp.
Referenced by DIALOG_BOARD_REANNOTATE::BuildUnavailableRefsList(), and DIALOG_CHANGE_SYMBOLS::processSymbols().
wxString UTIL::GetRefDesPrefix | ( | const wxString & | aRefDes | ) |
Get the (non-numeric) prefix from a refdes - e.g.
R1 -> R IC34 -> IC U? -> U
aRefDes | full refdes |
Definition at line 35 of file refdes_utils.cpp.
References res.
Referenced by BOOST_AUTO_TEST_CASE(), compareFootprintsbyRef(), TMATCH::COMPONENT::COMPONENT(), FIELD_VALIDATOR::DoValidate(), FOOTPRINT::GetNextPadNumber(), GetRefDesUnannotated(), FOOTPRINT::IncrementReference(), DIALOG_CHANGE_SYMBOLS::processSymbols(), SCH_SYMBOL::SCH_SYMBOL(), SCH_SYMBOL::SetRef(), and DIALOG_LIB_SYMBOL_PROPERTIES::Validate().
wxString UTIL::GetRefDesUnannotated | ( | const wxString & | aRefDes | ) |
Return an unannotated refdes from either a prefix or an existing refdes.
R -> R? IC34 -> IC? U? -> U?
aRefDes |
Definition at line 48 of file refdes_utils.cpp.
References GetRefDesPrefix().
Referenced by SCH_SHEET_PATH::CheckForMissingSymbolInstances(), SCH_SYMBOL::ClearAnnotation(), SCH_SYMBOL::GetRef(), DIALOG_CHANGE_SYMBOLS::processSymbols(), SCH_SYMBOL::SCH_SYMBOL(), and SCH_SYMBOL::SetUnitSelection().
|
static |
Get the native value corresponding to the config value (read from file or UI, probably) and find it in the mapping table.
The default item is returned if the mapping fails.
aMap | the value-config mapping table |
aConf | the config value to look up |
Definition at line 96 of file config_map.h.
Referenced by GAL_DISPLAY_OPTIONS_IMPL::ReadWindowSettings(), and PANEL_PCB_DISPLAY_OPTIONS::TransferDataFromWindow().