LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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
30#include <QtCore>
31
32#include <memory>
33#include <optional>
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
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, std::optional<Uuid> > mSymbolMap;
135
138 QHash<
139 QStringList,
140 QMap<QString,
141 std::pair<std::shared_ptr<parseagle::Pin>, std::optional<Uuid> > > >
143
146 QHash<QStringList, std::optional<Uuid> > mPackageMap;
147
150 QHash<QStringList, QMap<QString, std::optional<Uuid> > > mPackagePadMap;
151
154 QHash<QStringList, std::optional<Uuid> > mComponentMap;
155
158 QHash<QStringList, std::optional<Uuid> > mComponentSignalMap;
159};
160
161/*******************************************************************************
162 * End of File
163 ******************************************************************************/
164
165} // namespace eagleimport
166} // namespace librepcb
167
168#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:56
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, std::optional< Uuid > > mSymbolMap
Definition eaglelibraryconverter.h:134
void reset() noexcept
Definition eaglelibraryconverter.cpp:100
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:436
QHash< QStringList, QMap< QString, std::optional< Uuid > > > mPackagePadMap
Definition eaglelibraryconverter.h:150
EagleLibraryConverter(const EagleLibraryConverter &other)=delete
void tryOrLogError(std::function< void()> func, MessageLogger &log)
Definition eaglelibraryconverter.cpp:500
std::unique_ptr< Component > createComponent(const QString &libName, const QString &libUrn, const parseagle::DeviceSet &eagleDeviceSet, MessageLogger &log)
Definition eaglelibraryconverter.cpp:322
std::unique_ptr< Symbol > createSymbol(const QString &libName, const QString &libUrn, const parseagle::Symbol &eagleSymbol, MessageLogger &log)
Definition eaglelibraryconverter.cpp:109
QHash< QStringList, std::optional< Uuid > > mComponentMap
Definition eaglelibraryconverter.h:154
Uuid getComponentSignalOfSymbolPin(const QString &libName, const QString &libUrn, const QString &devSetName, const QString &gateName, const QString &pinName) const
Definition eaglelibraryconverter.cpp:82
QHash< QStringList, std::optional< Uuid > > mComponentSignalMap
Definition eaglelibraryconverter.h:158
QHash< QStringList, std::optional< Uuid > > mPackageMap
Definition eaglelibraryconverter.h:146
std::unique_ptr< Package > createPackage(const QString &libName, const QString &libUrn, const parseagle::Package &eaglePackage, MessageLogger &log)
Definition eaglelibraryconverter.cpp:220
QHash< QStringList, QMap< QString, std::pair< std::shared_ptr< parseagle::Pin >, std::optional< Uuid > > > > mSymbolPinMap
Definition eaglelibraryconverter.h:142
EagleLibraryConverterSettings mSettings
Definition eaglelibraryconverter.h:128
Definition occmodel.cpp:76
Definition eaglelibraryconverter.h:38
Definition uuid.h:186
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:58
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