LibrePCB Developers Documentation
Loading...
Searching...
No Matches
commandlineinterface.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_CLI_COMMANDLINEINTERFACE_H
21#define LIBREPCB_CLI_COMMANDLINEINTERFACE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class FilePath;
36class LibraryBaseElement;
37class SExpression;
38class TransactionalFileSystem;
39
40namespace cli {
41
42/*******************************************************************************
43 * Class CommandLineInterface
44 ******************************************************************************/
45
50 Q_DECLARE_TR_FUNCTIONS(CommandLineInterface)
51
52public:
53 // Constructors / Destructor
54 CommandLineInterface() noexcept;
55 ~CommandLineInterface() noexcept = default;
56
57 // General Methods
58 int execute(const QStringList& args) noexcept;
59
60private: // Methods
61 // Check result structure
62 struct CheckResult {
65 };
66
67 bool openProject(
68 const QString& projectFile, bool runErc, bool runDrc,
69 const QString& drcSettingsPath, const QStringList& runJobs,
70 bool runAllJobs, const QString& customJobsPath,
71 const QString& customOutDir, const QStringList& exportSchematicsFiles,
72 const QStringList& exportBomFiles, const QStringList& exportBoardBomFiles,
73 const QString& bomAttributes, bool exportPcbFabricationData,
74 const QString& pcbFabricationSettingsPath,
75 const QStringList& exportPnpTopFiles,
76 const QStringList& exportPnpBottomFiles,
77 const QStringList& exportNetlistFiles, const QStringList& boardNames,
78 const QStringList& boardIndices, bool removeOtherBoards,
79 const QStringList& avNames, const QStringList& avIndices,
80 const QString& setDefaultAv, bool save, bool strict) const noexcept;
81
82 bool openLibrary(const QString& libDir, bool all, bool runCheck,
83 bool minifyStepFiles, bool save, bool strict) const noexcept;
84
96 const LibraryBaseElement& element) const;
97
98 // Format check summary with optional header
100 const CheckResult& checkResult) const;
101 QStringList formatCheckSummary(int approvedCount, int nonApprovedCount,
102 const QString& indent = "") const;
103
104 void processLibraryElement(const QString& libDir, TransactionalFileSystem& fs,
105 LibraryBaseElement& element, bool runCheck,
106 bool minifyStepFiles, bool save, bool strict,
107 bool& success) const;
108 bool openSymbol(const QString& symbolFile, bool runCheck,
109 const QString& exportFile) const noexcept;
110 bool openPackage(const QString& packageFile, bool runCheck,
111 const QString& exportFile) const noexcept;
112 bool openStep(const QString& filePath, bool minify, bool tesselate,
113 const QString& saveTo) const noexcept;
114 static QStringList prepareRuleCheckMessages(
115 RuleCheckMessageList messages, const QSet<SExpression>& approvals,
116 int& approvedMsgCount) noexcept;
117 static QString prettyPath(const FilePath& path,
118 const QString& style) noexcept;
119 static bool failIfFileFormatUnstable() noexcept;
120 static void print(const QString& str) noexcept;
121 static void printErr(const QString& str) noexcept;
122};
123
124/*******************************************************************************
125 * End of File
126 ******************************************************************************/
127
128} // namespace cli
129} // namespace librepcb
130
131#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The LibraryBaseElement class.
Definition librarybaseelement.h:48
Transactional librepcb::FileSystem implementation.
Definition transactionalfilesystem.h:70
The CommandLineInterface class.
Definition commandlineinterface.h:49
static QString prettyPath(const FilePath &path, const QString &style) noexcept
Definition commandlineinterface.cpp:1732
static void print(const QString &str) noexcept
Definition commandlineinterface.cpp:1762
bool openLibrary(const QString &libDir, bool all, bool runCheck, bool minifyStepFiles, bool save, bool strict) const noexcept
Definition commandlineinterface.cpp:1127
CommandLineInterface() noexcept
Definition commandlineinterface.cpp:78
QStringList formatCheckSummary(int approvedCount, int nonApprovedCount, const QString &indent="") const
Definition commandlineinterface.cpp:1287
void processLibraryElement(const QString &libDir, TransactionalFileSystem &fs, LibraryBaseElement &element, bool runCheck, bool minifyStepFiles, bool save, bool strict, bool &success) const
Definition commandlineinterface.cpp:1295
CheckResult gatherElementCheckMessages(const LibraryBaseElement &element) const
Gather validation check messages for a library element.
Definition commandlineinterface.cpp:1268
static bool failIfFileFormatUnstable() noexcept
Definition commandlineinterface.cpp:1746
bool openSymbol(const QString &symbolFile, bool runCheck, const QString &exportFile) const noexcept
Definition commandlineinterface.cpp:1401
static QStringList prepareRuleCheckMessages(RuleCheckMessageList messages, const QSet< SExpression > &approvals, int &approvedMsgCount) noexcept
Definition commandlineinterface.cpp:1703
bool openPackage(const QString &packageFile, bool runCheck, const QString &exportFile) const noexcept
Definition commandlineinterface.cpp:1494
int execute(const QStringList &args) noexcept
Definition commandlineinterface.cpp:85
static void printErr(const QString &str) noexcept
Definition commandlineinterface.cpp:1767
QStringList formatLibraryElementCheckSummary(const CheckResult &checkResult) const
Definition commandlineinterface.cpp:1278
bool openStep(const QString &filePath, bool minify, bool tesselate, const QString &saveTo) const noexcept
Definition commandlineinterface.cpp:1627
~CommandLineInterface() noexcept=default
bool openProject(const QString &projectFile, bool runErc, bool runDrc, const QString &drcSettingsPath, const QStringList &runJobs, bool runAllJobs, const QString &customJobsPath, const QString &customOutDir, const QStringList &exportSchematicsFiles, const QStringList &exportBomFiles, const QStringList &exportBoardBomFiles, const QString &bomAttributes, bool exportPcbFabricationData, const QString &pcbFabricationSettingsPath, const QStringList &exportPnpTopFiles, const QStringList &exportPnpBottomFiles, const QStringList &exportNetlistFiles, const QStringList &boardNames, const QStringList &boardIndices, bool removeOtherBoards, const QStringList &avNames, const QStringList &avIndices, const QString &setDefaultAv, bool save, bool strict) const noexcept
Definition commandlineinterface.cpp:544
Definition occmodel.cpp:77
QVector< std::shared_ptr< const RuleCheckMessage > > RuleCheckMessageList
Definition rulecheckmessage.h:104
Definition commandlineinterface.h:62
int approvedMsgCount
Definition commandlineinterface.h:63
QStringList nonApprovedMessages
Definition commandlineinterface.h:64