KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pads_attribute_mapper.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PADS_ATTRIBUTE_MAPPER_H
21#define PADS_ATTRIBUTE_MAPPER_H
22
23#include <map>
24#include <string>
25
35{
36public:
38
49 std::string GetKiCadFieldName( const std::string& aPadsAttr ) const;
50
60 bool IsStandardField( const std::string& aPadsAttr ) const;
61
68 bool IsReferenceField( const std::string& aPadsAttr ) const;
69
76 bool IsValueField( const std::string& aPadsAttr ) const;
77
84 bool IsFootprintField( const std::string& aPadsAttr ) const;
85
92 void AddMapping( const std::string& aPadsAttr, const std::string& aKiCadField );
93
99 const std::map<std::string, std::string>& GetMappings() const { return m_customMappings; }
100
101 // Standard KiCad field names
102 static constexpr const char* FIELD_REFERENCE = "Reference";
103 static constexpr const char* FIELD_VALUE = "Value";
104 static constexpr const char* FIELD_FOOTPRINT = "Footprint";
105 static constexpr const char* FIELD_DATASHEET = "Datasheet";
106 static constexpr const char* FIELD_MPN = "MPN";
107 static constexpr const char* FIELD_MANUFACTURER = "Manufacturer";
108
109private:
110 std::string normalizeAttrName( const std::string& aName ) const;
111
112 std::map<std::string, std::string> m_standardMappings;
113 std::map<std::string, std::string> m_customMappings;
114};
115
116#endif // PADS_ATTRIBUTE_MAPPER_H
static constexpr const char * FIELD_MANUFACTURER
std::map< std::string, std::string > m_standardMappings
static constexpr const char * FIELD_DATASHEET
const std::map< std::string, std::string > & GetMappings() const
Get all custom mappings.
std::map< std::string, std::string > m_customMappings
bool IsReferenceField(const std::string &aPadsAttr) const
Check if a PADS attribute maps to the Reference field.
std::string GetKiCadFieldName(const std::string &aPadsAttr) const
Get the KiCad field name for a PADS attribute.
bool IsFootprintField(const std::string &aPadsAttr) const
Check if a PADS attribute maps to the Footprint field.
static constexpr const char * FIELD_REFERENCE
static constexpr const char * FIELD_MPN
bool IsStandardField(const std::string &aPadsAttr) const
Check if a PADS attribute maps to a standard KiCad field.
void AddMapping(const std::string &aPadsAttr, const std::string &aKiCadField)
Add or override a custom attribute mapping.
static constexpr const char * FIELD_VALUE
std::string normalizeAttrName(const std::string &aName) const
bool IsValueField(const std::string &aPadsAttr) const
Check if a PADS attribute maps to the Value field.
static constexpr const char * FIELD_FOOTPRINT