|
KiCad PCB EDA Suite
|
Maps PADS attribute names to KiCad field names. 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. | |
| bool | IsStandardField (const std::string &aPadsAttr) const |
| Check if a PADS attribute maps to a standard KiCad field. | |
| bool | IsReferenceField (const std::string &aPadsAttr) const |
| Check if a PADS attribute maps to the Reference field. | |
| bool | IsValueField (const std::string &aPadsAttr) const |
| Check if a PADS attribute maps to the Value field. | |
| bool | IsFootprintField (const std::string &aPadsAttr) const |
| Check if a PADS attribute maps to the Footprint field. | |
| 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 |
| Get all custom mappings. | |
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.
PADS uses different attribute names than KiCad for standard fields. This class provides mapping from PADS names to KiCad-compatible names, and identifies which attributes correspond to standard KiCad fields (Reference, Value, Footprint) versus custom user fields.
Definition at line 34 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.
| aPadsAttr | The PADS attribute name. |
| aKiCadField | The KiCad field name to map to. |
Definition at line 135 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.
For known PADS attributes (like "Ref.Des.", "Part Type"), returns the corresponding KiCad field name. For unknown attributes, returns the original name unchanged.
| aPadsAttr | The PADS attribute name. |
Definition at line 87 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 |
Get all custom mappings.
Definition at line 99 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 |
Check if a PADS attribute maps to the Footprint field.
| aPadsAttr | The PADS attribute name. |
Definition at line 128 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 |
Check if a PADS attribute maps to the Reference field.
| aPadsAttr | The PADS attribute name. |
Definition at line 114 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.
Standard fields are Reference, Value, and Footprint. These are handled specially in KiCad and exist on every footprint.
| aPadsAttr | The PADS attribute name. |
Definition at line 108 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 |
Check if a PADS attribute maps to the Value field.
| aPadsAttr | The PADS attribute name. |
Definition at line 121 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 73 of file pads_attribute_mapper.cpp.
Referenced by AddMapping(), and GetKiCadFieldName().
|
staticconstexpr |
Definition at line 105 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PADS_ATTRIBUTE_MAPPER().
|
staticconstexpr |
Definition at line 104 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 107 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PADS_ATTRIBUTE_MAPPER().
|
staticconstexpr |
Definition at line 106 of file pads_attribute_mapper.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PADS_ATTRIBUTE_MAPPER().
|
staticconstexpr |
Definition at line 102 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 103 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 113 of file pads_attribute_mapper.h.
Referenced by AddMapping(), GetKiCadFieldName(), and GetMappings().
|
private |
Definition at line 112 of file pads_attribute_mapper.h.
Referenced by GetKiCadFieldName(), and PADS_ATTRIBUTE_MAPPER().