LibrePCB Developers Documentation
projectjsonexport.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_PROJECTJSONEXPORT_H
21#define LIBREPCB_CORE_PROJECTJSONEXPORT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../types/point.h"
27
28#include <optional/tl/optional.hpp>
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class AssemblyVariant;
38class Board;
39class PcbColor;
40class Project;
41
42/*******************************************************************************
43 * Class ProjectJsonExport
44 ******************************************************************************/
45
53class ProjectJsonExport final {
54public:
55 // Types
56 struct BoundingBox {
57 tl::optional<std::pair<Point, Point>> points;
58 };
59 struct ToolList {
60 QList<Length> diameters;
61 };
62
63 // Constructors / Destructor
64 ProjectJsonExport() noexcept;
65 ProjectJsonExport(const ProjectJsonExport& other) = delete;
66 ~ProjectJsonExport() noexcept;
67
68 // General Methods
69 QJsonArray toJson(const QStringList& obj) const;
70 QJsonValue toJson(const Length& obj) const;
71 QJsonValue toJson(const tl::optional<Length>& obj) const;
72 QJsonArray toJson(const QSet<Length>& obj) const;
73 QJsonValue toJson(const PcbColor* obj) const;
74 QJsonObject toJson(const AssemblyVariant& obj) const;
75 QJsonValue toJson(const BoundingBox& obj) const;
76 QJsonObject toJson(const ToolList& obj) const;
77 QJsonObject toJson(const Board& obj) const;
78 QJsonObject toJson(const Project& obj) const;
79 QByteArray toUtf8(const Project& obj) const;
80
81 // Operator Overloadings
82 ProjectJsonExport& operator=(const ProjectJsonExport& rhs) = delete;
83};
84
85/*******************************************************************************
86 * End of File
87 ******************************************************************************/
88
89} // namespace librepcb
90
91#endif
The AssemblyVariant class.
Definition: assemblyvariant.h:45
The Board class represents a PCB of a project and is always part of a circuit.
Definition: board.h:73
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:83
Predefined colors relevant for PCB fabrication.
Definition: pcbcolor.h:41
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71
Project data export to JSON.
Definition: projectjsonexport.h:53
QJsonArray toJson(const QStringList &obj) const
Definition: projectjsonexport.cpp:61
QByteArray toUtf8(const Project &obj) const
Definition: projectjsonexport.cpp:221
ProjectJsonExport() noexcept
Definition: projectjsonexport.cpp:51
Definition: occmodel.cpp:77
Definition: uuid.h:183
Definition: projectjsonexport.h:56
tl::optional< std::pair< Point, Point > > points
Definition: projectjsonexport.h:57
Definition: projectjsonexport.h:59
QList< Length > diameters
Definition: projectjsonexport.h:60