LibrePCB Developers Documentation
repository.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_REPOSITORY_H
21 #define LIBREPCB_REPOSITORY_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include <QtCore>
27 
28 /*******************************************************************************
29  * Namespace / Forward Declarations
30  ******************************************************************************/
31 namespace librepcb {
32 
33 /*******************************************************************************
34  * Class Repository
35  ******************************************************************************/
36 
40 class Repository final : public QObject {
41  Q_OBJECT
42 
43 public:
44  // Constructors / Destructor
45  Repository() = delete;
46  Repository(const Repository& other) = delete;
47  explicit Repository(const QUrl& url) noexcept;
48  ~Repository() noexcept;
49 
50  // Getters
51  const QUrl& getUrl() const noexcept { return mUrl; }
52 
53  // General Methods
54  void requestLibraryList() const noexcept;
55 
56  // Operators
57  Repository& operator=(const Repository& rhs) = delete;
58 
59 signals:
60  void libraryListReceived(const QJsonArray& libs);
61  void errorWhileFetchingLibraryList(const QString& errorMsg);
62 
63 private: // Methods
64  void requestLibraryList(const QUrl& url) const noexcept;
65  void requestedDataReceived(const QByteArray& data) noexcept;
66 
67 private: // Data
68  QUrl mUrl;
69 };
70 
71 /*******************************************************************************
72  * End of File
73  ******************************************************************************/
74 
75 } // namespace librepcb
76 
77 #endif // LIBREPCB_REPOSITORY_H
Definition: alignment.cpp:30
void libraryListReceived(const QJsonArray &libs)
The Repository class provides access to a LibrePCB API server.
Definition: repository.h:40
void requestedDataReceived(const QByteArray &data) noexcept
Definition: repository.cpp:69
void requestLibraryList() const noexcept
Definition: repository.cpp:49
Repository & operator=(const Repository &rhs)=delete
~Repository() noexcept
Definition: repository.cpp:42
const QUrl & getUrl() const noexcept
Definition: repository.h:51
void errorWhileFetchingLibraryList(const QString &errorMsg)
QUrl mUrl
Definition: repository.h:68