LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  ******************************************************************************/
26 #include <QtCore>
27 
28 /*******************************************************************************
29  * Namespace / Forward Declarations
30  ******************************************************************************/
31 namespace librepcb {
32 
33 class Application;
34 class FilePath;
35 
36 namespace cli {
37 
38 /*******************************************************************************
39  * Class CommandLineInterface
40  ******************************************************************************/
41 
45 class CommandLineInterface final {
47 
48 public:
49  // Constructors / Destructor
50  CommandLineInterface() = delete;
51  explicit CommandLineInterface(const Application& app) noexcept;
52  ~CommandLineInterface() noexcept = default;
53 
54  // General Methods
55  int execute() noexcept;
56 
57 private: // Methods
58  bool openProject(const QString& projectFile, bool runErc,
59  const QStringList& exportSchematicsFiles,
60  bool exportPcbFabricationData, const QStringList& boards,
61  bool save) const noexcept;
62  static QString prettyPath(const FilePath& path,
63  const QString& style) noexcept;
64  static void print(const QString& str, int newlines = 1) noexcept;
65  static void printErr(const QString& str, int newlines = 1) noexcept;
66 
67 private: // Data
68  const Application& mApp;
69 };
70 
71 /*******************************************************************************
72  * End of File
73  ******************************************************************************/
74 
75 } // namespace cli
76 } // namespace librepcb
77 
78 #endif // LIBREPCB_CLI_COMMANDLINEINTERFACE_H
static void printErr(const QString &str, int newlines=1) noexcept
Definition: commandlineinterface.cpp:339
static QString prettyPath(const FilePath &path, const QString &style) noexcept
Definition: commandlineinterface.cpp:324
const Application & mApp
Definition: commandlineinterface.h:68
bool openProject(const QString &projectFile, bool runErc, const QStringList &exportSchematicsFiles, bool exportPcbFabricationData, const QStringList &boards, bool save) const noexcept
Definition: commandlineinterface.cpp:196
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
~CommandLineInterface() noexcept=default
Q_DECLARE_TR_FUNCTIONS(CommandLineInterface)
int execute() noexcept
Definition: commandlineinterface.cpp:57
static void print(const QString &str, int newlines=1) noexcept
Definition: commandlineinterface.cpp:331
The Application class extends the QApplication with the exception-safe method notify() ...
Definition: application.h:60
The CommandLineInterface class.
Definition: commandlineinterface.h:45