LibrePCB Developers Documentation
eaglelibraryconverter.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU 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 <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EAGLEIMPORT_EAGLELIBRARYCONVERTER_H
21#define LIBREPCB_EAGLEIMPORT_EAGLELIBRARYCONVERTER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
29#include <optional/tl/optional.hpp>
30
31#include <QtCore>
32
33#include <memory>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace parseagle {
39class Device;
40class DeviceSet;
41class Package;
42class Pin;
43class Symbol;
44} // namespace parseagle
45
46namespace librepcb {
47
48class Component;
49class Device;
50class MessageLogger;
51class Package;
52class Polygon;
53class Symbol;
54
55namespace eagleimport {
56
57/*******************************************************************************
58 * Struct EagleLibraryConverterSettings
59 ******************************************************************************/
60
66
67 QString namePrefix;
69 QString author;
70 QString keywords;
71 QSet<Uuid> symbolCategories;
74 QSet<Uuid> deviceCategories;
76};
77
78/*******************************************************************************
79 * Class EagleLibraryConverter
80 ******************************************************************************/
81
85class EagleLibraryConverter final : public QObject {
86 Q_OBJECT
87
88public:
89 // Constructors / Destructor
92 QObject* parent = nullptr) noexcept;
93 ~EagleLibraryConverter() noexcept;
94
95 // Getters
96 Uuid getComponentSignalOfSymbolPin(const QString& libName,
97 const QString& libUrn,
98 const QString& devSetName,
99 const QString& gateName,
100 const QString& pinName) const;
101
102 // General Methods
103 void reset() noexcept;
104 std::unique_ptr<Symbol> createSymbol(const QString& libName,
105 const QString& libUrn,
106 const parseagle::Symbol& eagleSymbol,
107 MessageLogger& log);
108 std::unique_ptr<Package> createPackage(const QString& libName,
109 const QString& libUrn,
110 const parseagle::Package& eaglePackage,
111 MessageLogger& log);
112 std::unique_ptr<Component> createComponent(
113 const QString& libName, const QString& libUrn,
114 const parseagle::DeviceSet& eagleDeviceSet, MessageLogger& log);
115 std::unique_ptr<Device> createDevice(
116 const QString& devLibName, const QString& devLibUrn,
117 const parseagle::DeviceSet& eagleDeviceSet,
118 const parseagle::Device& eagleDevice, const QString& pkgLibName,
119 const QString& pkgLibUrn, MessageLogger& log);
120
121 // Operator Overloadings
122 EagleLibraryConverter& operator=(const EagleLibraryConverter& rhs) = delete;
123
124private: // Methods
125 void tryOrLogError(std::function<void()> func, MessageLogger& log);
126
127private: // Data
129
130 // State
131
134 QHash<QStringList, tl::optional<Uuid> > mSymbolMap;
135
138 QHash<QStringList,
139 QMap<QString,
140 std::pair<std::shared_ptr<parseagle::Pin>, tl::optional<Uuid> > > >
142
145 QHash<QStringList, tl::optional<Uuid> > mPackageMap;
146
149 QHash<QStringList, QMap<QString, tl::optional<Uuid> > > mPackagePadMap;
150
153 QHash<QStringList, tl::optional<Uuid> > mComponentMap;
154
157 QHash<QStringList, tl::optional<Uuid> > mComponentSignalMap;
158};
159
160/*******************************************************************************
161 * End of File
162 ******************************************************************************/
163
164} // namespace eagleimport
165} // namespace librepcb
166
167#endif
The BoundedUnsignedRatio class represents a ratio limited to a range specified by min/max values.
Definition: boundedunsignedratio.h:46
The Component class represents a "generic" device in the library.
Definition: component.h:73
The Device class represents an instance of a component (a "real" component)
Definition: device.h:55
Generic logger class to pass messages between objects.
Definition: messagelogger.h:43
The Package class represents a package of a component (including footprint and 3D model)
Definition: package.h:59
The Symbol class represents the part of a component which is added to schematics.
Definition: symbol.h:55
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The Version class represents a version number in the format "1.42.7".
Definition: version.h:58
Converts EAGLE library elements to LibrePCB.
Definition: eaglelibraryconverter.h:85
QHash< QStringList, tl::optional< Uuid > > mComponentMap
Definition: eaglelibraryconverter.h:153
void reset() noexcept
Definition: eaglelibraryconverter.cpp:91
std::unique_ptr< Device > createDevice(const QString &devLibName, const QString &devLibUrn, const parseagle::DeviceSet &eagleDeviceSet, const parseagle::Device &eagleDevice, const QString &pkgLibName, const QString &pkgLibUrn, MessageLogger &log)
Definition: eaglelibraryconverter.cpp:424
QHash< QStringList, QMap< QString, tl::optional< Uuid > > > mPackagePadMap
Definition: eaglelibraryconverter.h:149
QHash< QStringList, tl::optional< Uuid > > mComponentSignalMap
Definition: eaglelibraryconverter.h:157
QHash< QStringList, tl::optional< Uuid > > mPackageMap
Definition: eaglelibraryconverter.h:145
EagleLibraryConverter(const EagleLibraryConverter &other)=delete
void tryOrLogError(std::function< void()> func, MessageLogger &log)
Definition: eaglelibraryconverter.cpp:486
std::unique_ptr< Component > createComponent(const QString &libName, const QString &libUrn, const parseagle::DeviceSet &eagleDeviceSet, MessageLogger &log)
Definition: eaglelibraryconverter.cpp:311
std::unique_ptr< Symbol > createSymbol(const QString &libName, const QString &libUrn, const parseagle::Symbol &eagleSymbol, MessageLogger &log)
Definition: eaglelibraryconverter.cpp:100
QHash< QStringList, QMap< QString, std::pair< std::shared_ptr< parseagle::Pin >, tl::optional< Uuid > > > > mSymbolPinMap
Definition: eaglelibraryconverter.h:141
Uuid getComponentSignalOfSymbolPin(const QString &libName, const QString &libUrn, const QString &devSetName, const QString &gateName, const QString &pinName) const
Definition: eaglelibraryconverter.cpp:73
std::unique_ptr< Package > createPackage(const QString &libName, const QString &libUrn, const parseagle::Package &eaglePackage, MessageLogger &log)
Definition: eaglelibraryconverter.cpp:210
EagleLibraryConverterSettings mSettings
Definition: eaglelibraryconverter.h:128
QHash< QStringList, tl::optional< Uuid > > mSymbolMap
Definition: eaglelibraryconverter.h:134
Definition: occmodel.cpp:77
Definition: eaglelibraryconverter.h:38
Definition: uuid.h:183
Settings for librepcb::eagleimport::EagleLibraryConverter.
Definition: eaglelibraryconverter.h:64
QString namePrefix
Definition: eaglelibraryconverter.h:67
QString author
Definition: eaglelibraryconverter.h:69
QSet< Uuid > packageCategories
Definition: eaglelibraryconverter.h:72
EagleLibraryConverterSettings() noexcept
Definition: eaglelibraryconverter.cpp:49
BoundedUnsignedRatio autoThtAnnularWidth
Definition: eaglelibraryconverter.h:75
QString keywords
Definition: eaglelibraryconverter.h:70
QSet< Uuid > symbolCategories
Definition: eaglelibraryconverter.h:71
QSet< Uuid > deviceCategories
Definition: eaglelibraryconverter.h:74
Version version
Definition: eaglelibraryconverter.h:68
QSet< Uuid > componentCategories
Definition: eaglelibraryconverter.h:73