LibrePCB Developers Documentation
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  ******************************************************************************/
33 namespace librepcb {
34 
35 class FilePath;
36 class LibraryBaseElement;
37 class SExpression;
38 class TransactionalFileSystem;
39 
40 namespace cli {
41 
42 /*******************************************************************************
43  * Class CommandLineInterface
44  ******************************************************************************/
45 
49 class CommandLineInterface final {
50  Q_DECLARE_TR_FUNCTIONS(CommandLineInterface)
51 
52 public:
53  // Constructors / Destructor
54  CommandLineInterface() noexcept;
55  ~CommandLineInterface() noexcept = default;
56 
57  // General Methods
58  int execute(const QStringList& args) noexcept;
59 
60 private: // Methods
61  bool openProject(
62  const QString& projectFile, bool runErc, bool runDrc,
63  const QString& drcSettingsPath, const QStringList& runJobs,
64  bool runAllJobs, const QString& customJobsPath,
65  const QString& customOutDir, const QStringList& exportSchematicsFiles,
66  const QStringList& exportBomFiles, const QStringList& exportBoardBomFiles,
67  const QString& bomAttributes, bool exportPcbFabricationData,
68  const QString& pcbFabricationSettingsPath,
69  const QStringList& exportPnpTopFiles,
70  const QStringList& exportPnpBottomFiles,
71  const QStringList& exportNetlistFiles, const QStringList& boardNames,
72  const QStringList& boardIndices, bool removeOtherBoards,
73  const QStringList& avNames, const QStringList& avIndices,
74  const QString& setDefaultAv, bool save, bool strict) const noexcept;
75  bool openLibrary(const QString& libDir, bool all, bool runCheck,
76  bool minifyStepFiles, bool save, bool strict) const noexcept;
77  void processLibraryElement(const QString& libDir, TransactionalFileSystem& fs,
78  LibraryBaseElement& element, bool runCheck,
79  bool minifyStepFiles, bool save, bool strict,
80  bool& success) const;
81  bool openStep(const QString& filePath, bool minify, bool tesselate,
82  const QString& saveTo) const noexcept;
83  static QStringList prepareRuleCheckMessages(
84  RuleCheckMessageList messages, const QSet<SExpression>& approvals,
85  int& approvedMsgCount) noexcept;
86  static QString prettyPath(const FilePath& path,
87  const QString& style) noexcept;
88  static bool failIfFileFormatUnstable() noexcept;
89  static void print(const QString& str) noexcept;
90  static void printErr(const QString& str) noexcept;
91 };
92 
93 /*******************************************************************************
94  * End of File
95  ******************************************************************************/
96 
97 } // namespace cli
98 } // namespace librepcb
99 
100 #endif
The LibraryBaseElement class.
Definition: librarybaseelement.h:48
Transactional librepcb::FileSystem implementation.
Definition: transactionalfilesystem.h:71
Definition: occmodel.cpp:77
void processLibraryElement(const QString &libDir, TransactionalFileSystem &fs, LibraryBaseElement &element, bool runCheck, bool minifyStepFiles, bool save, bool strict, bool &success) const
Definition: commandlineinterface.cpp:1190
int execute(const QStringList &args) noexcept
Definition: commandlineinterface.cpp:82
QVector< std::shared_ptr< const RuleCheckMessage > > RuleCheckMessageList
Definition: rulecheckmessage.h:104
static void print(const QString &str) noexcept
Definition: commandlineinterface.cpp:1427
static QString prettyPath(const FilePath &path, const QString &style) noexcept
Definition: commandlineinterface.cpp:1397
static void printErr(const QString &str) noexcept
Definition: commandlineinterface.cpp:1432
static bool failIfFileFormatUnstable() noexcept
Definition: commandlineinterface.cpp:1411
CommandLineInterface() noexcept
Definition: commandlineinterface.cpp:75
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
~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:483
bool openLibrary(const QString &libDir, bool all, bool runCheck, bool minifyStepFiles, bool save, bool strict) const noexcept
Definition: commandlineinterface.cpp:1050
bool openStep(const QString &filePath, bool minify, bool tesselate, const QString &saveTo) const noexcept
Definition: commandlineinterface.cpp:1292
static QStringList prepareRuleCheckMessages(RuleCheckMessageList messages, const QSet< SExpression > &approvals, int &approvedMsgCount) noexcept
Definition: commandlineinterface.cpp:1368
The CommandLineInterface class.
Definition: commandlineinterface.h:49