|
KiCad PCB EDA Suite
|
Maps PADS attribute names to KiCad field names and identifies which attributes are standard KiCad fields (Reference, Value, Footprint) versus custom fields. More...
#include <pads_attribute_mapper.h>
Public Member Functions | |
| PADS_ATTRIBUTE_MAPPER () | |
| std::string | GetKiCadFieldName (const std::string &aPadsAttr) const |
| Get the KiCad field name for a PADS attribute, or the original name unchanged when no mapping exists. | |
| bool | IsStandardField (const std::string &aPadsAttr) const |
| Check if a PADS attribute maps to a standard KiCad field (Reference, Value, or Footprint). | |
| bool | IsReferenceField (const std::string &aPadsAttr) const |
| bool | IsValueField (const std::string &aPadsAttr) const |
| bool | IsFootprintField (const std::string &aPadsAttr) const |
| void | AddMapping (const std::string &aPadsAttr, const std::string &aKiCadField) |
| Add or override a custom attribute mapping. | |
| const std::map< std::string, std::string > & | GetMappings () const |
Static Public Attributes | |
| static constexpr const char * | FIELD_REFERENCE = "Reference" |
| static constexpr const char * | FIELD_VALUE = "Value" |
| static constexpr const char * | FIELD_FOOTPRINT = "Footprint" |
| static constexpr const char * | FIELD_DATASHEET = "Datasheet" |
| static constexpr const char * | FIELD_MPN = "MPN" |
| static constexpr const char * | FIELD_MANUFACTURER = "Manufacturer" |
Private Member Functions | |
| std::string | normalizeAttrName (const std::string &aName) const |
Private Attributes | |
| std::map< std::string, std::string > | m_standardMappings |
| std::map< std::string, std::string > | m_customMappings |
Maps PADS attribute names to KiCad field names and identifies which attributes are standard KiCad fields (Reference, Value, Footprint) versus custom fields.
Definition at line 30 of file pads_attribute_mapper.h.
| PADS_ATTRIBUTE_MAPPER::PADS_ATTRIBUTE_MAPPER | ( | ) |
Definition at line 26 of file pads_attribute_mapper.cpp.
References FIELD_DATASHEET, FIELD_FOOTPRINT, FIELD_MANUFACTURER, FIELD_MPN, FIELD_REFERENCE, FIELD_VALUE, and m_standardMappings.
| void PADS_ATTRIBUTE_MAPPER::AddMapping | ( | const std::string & | aPadsAttr, |
| const std::string & | aKiCadField ) |
Add or override a custom attribute mapping.
Definition at line 126 of file pads_attribute_mapper.cpp.
References m_customMappings, and normalizeAttrName().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| std::string PADS_ATTRIBUTE_MAPPER::GetKiCadFieldName | ( | const std::string & | aPadsAttr | ) | const |
Get the KiCad field name for a PADS attribute, or the original name unchanged when no mapping exists.
Definition at line 80 of file pads_attribute_mapper.cpp.
References m_customMappings, m_standardMappings, and normalizeAttrName().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PADS_SCH::PADS_SCH_SCHEMATIC_BUILDER::CreateCustomFields(), IsFootprintField(), IsReferenceField(), and IsValueField().
|
inline |
Definition at line 58 of file pads_attribute_mapper.h.
References m_customMappings.
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| bool PADS_ATTRIBUTE_MAPPER::IsFootprintField | ( | const std::string & | aPadsAttr | ) | const |
Definition at line 119 of file pads_attribute_mapper.cpp.
References FIELD_FOOTPRINT, and GetKiCadFieldName().
Referenced by PADS_SCH::PADS_SCH_SCHEMATIC_BUILDER::ApplyFieldSettings(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and IsStandardField().
| bool PADS_ATTRIBUTE_MAPPER::IsReferenceField | ( | const std::string & | aPadsAttr | ) | const |
Definition at line 105 of file pads_attribute_mapper.cpp.
References FIELD_REFERENCE, and GetKiCadFieldName().
Referenced by PADS_SCH::PADS_SCH_SCHEMATIC_BUILDER::ApplyFieldSettings(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and IsStandardField().
| bool PADS_ATTRIBUTE_MAPPER::IsStandardField | ( | const std::string & | aPadsAttr | ) | const |
Check if a PADS attribute maps to a standard KiCad field (Reference, Value, or Footprint).
Definition at line 99 of file pads_attribute_mapper.cpp.
References IsFootprintField(), IsReferenceField(), and IsValueField().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PADS_SCH::PADS_SCH_SCHEMATIC_BUILDER::CreateCustomFields().
| bool PADS_ATTRIBUTE_MAPPER::IsValueField | ( | const std::string & | aPadsAttr | ) | const |
Definition at line 112 of file pads_attribute_mapper.cpp.
References FIELD_VALUE, and GetKiCadFieldName().
Referenced by PADS_SCH::PADS_SCH_SCHEMATIC_BUILDER::ApplyFieldSettings(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and IsStandardField().
|
private |
Definition at line 66 of file pads_attribute_mapper.cpp.
Referenced by AddMapping(), and GetKiCadFieldName().
|
staticconstexpr |
Definition at line 63 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PADS_ATTRIBUTE_MAPPER().
|
staticconstexpr |
Definition at line 62 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), IsFootprintField(), and PADS_ATTRIBUTE_MAPPER().
|
staticconstexpr |
Definition at line 65 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PADS_ATTRIBUTE_MAPPER().
|
staticconstexpr |
Definition at line 64 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PADS_ATTRIBUTE_MAPPER().
|
staticconstexpr |
Definition at line 60 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), IsReferenceField(), and PADS_ATTRIBUTE_MAPPER().
|
staticconstexpr |
Definition at line 61 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), IsValueField(), and PADS_ATTRIBUTE_MAPPER().
|
private |
Definition at line 71 of file pads_attribute_mapper.h.
Referenced by AddMapping(), GetKiCadFieldName(), and GetMappings().
|
private |
Definition at line 70 of file pads_attribute_mapper.h.
Referenced by GetKiCadFieldName(), and PADS_ATTRIBUTE_MAPPER().