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
17 * along with this program. If not, see <https://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
31{
32public:
34
39 std::string GetKiCadFieldName( const std::string& aPadsAttr ) const;
40
45 bool IsStandardField( const std::string& aPadsAttr ) const;
46
47 bool IsReferenceField( const std::string& aPadsAttr ) const;
48
49 bool IsValueField( const std::string& aPadsAttr ) const;
50
51 bool IsFootprintField( const std::string& aPadsAttr ) const;
52
56 void AddMapping( const std::string& aPadsAttr, const std::string& aKiCadField );
57
58 const std::map<std::string, std::string>& GetMappings() const { return m_customMappings; }
59
60 static constexpr const char* FIELD_REFERENCE = "Reference";
61 static constexpr const char* FIELD_VALUE = "Value";
62 static constexpr const char* FIELD_FOOTPRINT = "Footprint";
63 static constexpr const char* FIELD_DATASHEET = "Datasheet";
64 static constexpr const char* FIELD_MPN = "MPN";
65 static constexpr const char* FIELD_MANUFACTURER = "Manufacturer";
66
67private:
68 std::string normalizeAttrName( const std::string& aName ) const;
69
70 std::map<std::string, std::string> m_standardMappings;
71 std::map<std::string, std::string> m_customMappings;
72};
73
74#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
std::map< std::string, std::string > m_customMappings
bool IsReferenceField(const std::string &aPadsAttr) const
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 IsFootprintField(const std::string &aPadsAttr) const
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 (Reference, Value, or Footprint).
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
static constexpr const char * FIELD_FOOTPRINT