LibrePCB Developers Documentation
Loading...
Searching...
No Matches
fileformatmigrationv01.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_CORE_FILEFORMATMIGRATIONV01_H
21#define LIBREPCB_CORE_FILEFORMATMIGRATIONV01_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../types/alignment.h"
27#include "../types/angle.h"
28#include "../types/point.h"
29#include "../types/uuid.h"
30#include "fileformatmigration.h"
31
32#include <QtCore>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class SExpression;
40
41/*******************************************************************************
42 * Class FileFormatMigrationV01
43 ******************************************************************************/
44
49 Q_OBJECT
50
51protected:
61
62 struct Symbol {
63 QList<Text> texts;
64 };
65
70
73 QList<Gate> gates;
74 };
75
76 struct Component {
78 QList<ComponentSymbolVariant> symbolVariants;
79 };
80
85
87 // Project library.
88 QHash<Uuid, Symbol> symbols;
89 QHash<Uuid, Component> components;
90 QMap<Uuid, ComponentInstance> componentInstances;
91 QMap<Uuid, QSet<Uuid>> devicesUsedInBoards;
92
93 // Project.
94 QString projectUuid;
95
96 // Counters for emitting messages.
98 int holesCount = 0;
100 int planeCount = 0;
105 };
106
107public:
108 // Constructors / Destructor
109 explicit FileFormatMigrationV01(QObject* parent = nullptr) noexcept;
111 virtual ~FileFormatMigrationV01() noexcept;
112
113 // General Methods
114 virtual void upgradeComponentCategory(TransactionalDirectory& dir) override;
115 virtual void upgradePackageCategory(TransactionalDirectory& dir) override;
116 virtual void upgradeSymbol(TransactionalDirectory& dir) override;
117 virtual void upgradePackage(TransactionalDirectory& dir) override;
118 virtual void upgradeComponent(TransactionalDirectory& dir) override;
119 virtual void upgradeDevice(TransactionalDirectory& dir) override;
120 virtual void upgradeLibrary(TransactionalDirectory& dir) override;
121 virtual void upgradeProject(TransactionalDirectory& dir,
122 QList<Message>& messages) override;
123 virtual void upgradeWorkspaceData(TransactionalDirectory& dir) override;
124
125 // Operator Overloadings
126 FileFormatMigrationV01& operator=(const FileFormatMigrationV01& rhs) = delete;
127
128protected: // Methods
129 virtual void createOutputJobs(TransactionalDirectory& dir);
130 virtual void upgradeMetadata(SExpression& root);
131 virtual void upgradeSettings(SExpression& root);
132 virtual void upgradeCircuit(SExpression& root, ProjectContext& context);
133 virtual void upgradeErc(SExpression& root, ProjectContext& context);
134 virtual void upgradeSchematic(SExpression& root, ProjectContext& context);
135 virtual void upgradeBoard(SExpression& root, ProjectContext& context);
136 virtual void upgradeBoardUserSettings(SExpression& root);
137 virtual void upgradeBoardDesignRules(SExpression& root);
138 virtual void upgradeBoardDrcSettings(SExpression& root);
139 virtual void upgradeGrid(SExpression& node);
140 virtual void upgradeCutouts(SExpression& node, ProjectContext* context);
141 virtual void upgradeHoles(SExpression& node, bool isBoardHole);
142 virtual void upgradeLayers(SExpression& node);
143 virtual void upgradeInversionCharacters(SExpression& root,
144 const QString& childName,
145 const QString& valuePath);
146 virtual void upgradeStrings(SExpression& root);
147 virtual void replaceStrings(SExpression& root,
148 const QMap<QString, QString>& replacements);
149 static QString toFileProofName(const QString& name,
150 const QString& fallback) noexcept;
151};
152
153/*******************************************************************************
154 * End of File
155 ******************************************************************************/
156
157} // namespace librepcb
158
159#endif
The Alignment class.
Definition alignment.h:115
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition angle.h:76
Base class for any file format migration.
Definition fileformatmigration.h:46
Migration to upgrade file format v0.1.
Definition fileformatmigrationv01.h:48
virtual void upgradeBoard(SExpression &root, ProjectContext &context)
Definition fileformatmigrationv01.cpp:856
virtual void upgradeInversionCharacters(SExpression &root, const QString &childName, const QString &valuePath)
Definition fileformatmigrationv01.cpp:1185
virtual void upgradeComponent(TransactionalDirectory &dir) override
Definition fileformatmigrationv01.cpp:243
virtual void upgradeHoles(SExpression &node, bool isBoardHole)
Definition fileformatmigrationv01.cpp:1118
virtual void upgradeBoardDesignRules(SExpression &root)
Definition fileformatmigrationv01.cpp:993
virtual void upgradePackage(TransactionalDirectory &dir) override
Definition fileformatmigrationv01.cpp:107
virtual void upgradeCutouts(SExpression &node, ProjectContext *context)
Definition fileformatmigrationv01.cpp:1059
virtual void upgradeProject(TransactionalDirectory &dir, QList< Message > &messages) override
Definition fileformatmigrationv01.cpp:296
virtual void upgradeCircuit(SExpression &root, ProjectContext &context)
Definition fileformatmigrationv01.cpp:639
virtual void upgradeDevice(TransactionalDirectory &dir) override
Definition fileformatmigrationv01.cpp:264
virtual void upgradeComponentCategory(TransactionalDirectory &dir) override
Definition fileformatmigrationv01.cpp:61
virtual void upgradeGrid(SExpression &node)
Definition fileformatmigrationv01.cpp:1054
virtual void upgradeBoardUserSettings(SExpression &root)
Definition fileformatmigrationv01.cpp:980
virtual void upgradeLibrary(TransactionalDirectory &dir) override
Definition fileformatmigrationv01.cpp:282
virtual void upgradeStrings(SExpression &root)
Definition fileformatmigrationv01.cpp:1201
virtual void upgradeSettings(SExpression &root)
Definition fileformatmigrationv01.cpp:631
virtual void upgradeErc(SExpression &root, ProjectContext &context)
Definition fileformatmigrationv01.cpp:709
virtual void upgradeWorkspaceData(TransactionalDirectory &dir) override
Definition fileformatmigrationv01.cpp:567
virtual void upgradeMetadata(SExpression &root)
Definition fileformatmigrationv01.cpp:626
static QString toFileProofName(const QString &name, const QString &fallback) noexcept
Definition fileformatmigrationv01.cpp:1224
virtual void upgradePackageCategory(TransactionalDirectory &dir) override
Definition fileformatmigrationv01.cpp:67
virtual void replaceStrings(SExpression &root, const QMap< QString, QString > &replacements)
Definition fileformatmigrationv01.cpp:1210
virtual void upgradeBoardDrcSettings(SExpression &root)
Definition fileformatmigrationv01.cpp:1020
virtual void upgradeLayers(SExpression &node)
Definition fileformatmigrationv01.cpp:1131
virtual void upgradeSymbol(TransactionalDirectory &dir) override
Definition fileformatmigrationv01.cpp:73
virtual void createOutputJobs(TransactionalDirectory &dir)
Definition fileformatmigrationv01.cpp:620
virtual void upgradeSchematic(SExpression &root, ProjectContext &context)
Definition fileformatmigrationv01.cpp:759
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The SExpression class.
Definition sexpression.h:69
Helper class to access a subdirectory of TransactionalFileSystem.
Definition transactionaldirectory.h:51
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
Definition occmodel.cpp:76
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition length.h:810
Definition fileformatmigration.h:51
Definition fileformatmigrationv01.h:76
QList< ComponentSymbolVariant > symbolVariants
Definition fileformatmigrationv01.h:78
bool schematicOnly
Definition fileformatmigrationv01.h:77
Definition fileformatmigrationv01.h:81
Uuid libCmpUuid
Definition fileformatmigrationv01.h:82
Uuid libSymbVarUuid
Definition fileformatmigrationv01.h:83
Definition fileformatmigrationv01.h:71
Uuid uuid
Definition fileformatmigrationv01.h:72
QList< Gate > gates
Definition fileformatmigrationv01.h:73
Definition fileformatmigrationv01.h:66
Uuid uuid
Definition fileformatmigrationv01.h:67
Uuid symbolUuid
Definition fileformatmigrationv01.h:68
Definition fileformatmigrationv01.h:86
QHash< Uuid, Symbol > symbols
Definition fileformatmigrationv01.h:88
QString projectUuid
Definition fileformatmigrationv01.h:94
int nonRoundViaCount
Definition fileformatmigrationv01.h:99
int removedErcApprovals
Definition fileformatmigrationv01.h:97
QHash< Uuid, Component > components
Definition fileformatmigrationv01.h:89
int planeCount
Definition fileformatmigrationv01.h:100
int holesCount
Definition fileformatmigrationv01.h:98
int planeConnectNoneCount
Definition fileformatmigrationv01.h:101
int footprintBoardOutlinesObjectCount
Definition fileformatmigrationv01.h:102
QMap< Uuid, ComponentInstance > componentInstances
Definition fileformatmigrationv01.h:90
QMap< Uuid, QSet< Uuid > > devicesUsedInBoards
Definition fileformatmigrationv01.h:91
int componentsWithAssemblyOptions
Definition fileformatmigrationv01.h:104
int topLevelBoardOutlinesObjectCount
Definition fileformatmigrationv01.h:103
Definition fileformatmigrationv01.h:62
QList< Text > texts
Definition fileformatmigrationv01.h:63
Definition fileformatmigrationv01.h:52
Alignment align
Definition fileformatmigrationv01.h:59
QString text
Definition fileformatmigrationv01.h:55
Uuid uuid
Definition fileformatmigrationv01.h:53
QString layerName
Definition fileformatmigrationv01.h:54
Angle rotation
Definition fileformatmigrationv01.h:57
Point position
Definition fileformatmigrationv01.h:56
PositiveLength height
Definition fileformatmigrationv01.h:58