KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PADS_ATTRIBUTE_MAPPER Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PADS_ATTRIBUTE_MAPPER()

PADS_ATTRIBUTE_MAPPER::PADS_ATTRIBUTE_MAPPER ( )

Member Function Documentation

◆ AddMapping()

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().

◆ GetKiCadFieldName()

std::string PADS_ATTRIBUTE_MAPPER::GetKiCadFieldName ( const std::string & aPadsAttr) const

◆ GetMappings()

const std::map< std::string, std::string > & PADS_ATTRIBUTE_MAPPER::GetMappings ( ) const
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().

◆ IsFootprintField()

bool PADS_ATTRIBUTE_MAPPER::IsFootprintField ( const std::string & aPadsAttr) const

◆ IsReferenceField()

bool PADS_ATTRIBUTE_MAPPER::IsReferenceField ( const std::string & aPadsAttr) const

◆ 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().

◆ IsValueField()

bool PADS_ATTRIBUTE_MAPPER::IsValueField ( const std::string & aPadsAttr) const

◆ normalizeAttrName()

std::string PADS_ATTRIBUTE_MAPPER::normalizeAttrName ( const std::string & aName) const
private

Definition at line 66 of file pads_attribute_mapper.cpp.

Referenced by AddMapping(), and GetKiCadFieldName().

Member Data Documentation

◆ FIELD_DATASHEET

const char* PADS_ATTRIBUTE_MAPPER::FIELD_DATASHEET = "Datasheet"
staticconstexpr

◆ FIELD_FOOTPRINT

const char* PADS_ATTRIBUTE_MAPPER::FIELD_FOOTPRINT = "Footprint"
staticconstexpr

◆ FIELD_MANUFACTURER

const char* PADS_ATTRIBUTE_MAPPER::FIELD_MANUFACTURER = "Manufacturer"
staticconstexpr

◆ FIELD_MPN

const char* PADS_ATTRIBUTE_MAPPER::FIELD_MPN = "MPN"
staticconstexpr

◆ FIELD_REFERENCE

const char* PADS_ATTRIBUTE_MAPPER::FIELD_REFERENCE = "Reference"
staticconstexpr

◆ FIELD_VALUE

const char* PADS_ATTRIBUTE_MAPPER::FIELD_VALUE = "Value"
staticconstexpr

◆ m_customMappings

std::map<std::string, std::string> PADS_ATTRIBUTE_MAPPER::m_customMappings
private

Definition at line 71 of file pads_attribute_mapper.h.

Referenced by AddMapping(), GetKiCadFieldName(), and GetMappings().

◆ m_standardMappings

std::map<std::string, std::string> PADS_ATTRIBUTE_MAPPER::m_standardMappings
private

Definition at line 70 of file pads_attribute_mapper.h.

Referenced by GetKiCadFieldName(), and PADS_ATTRIBUTE_MAPPER().


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