LibrePCB Developers Documentation
Loading...
Searching...
No Matches
maskconfig.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_MASKCONFIG_H
21#define LIBREPCB_CORE_MASKCONFIG_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "length.h"
27
28#include <QtCore>
29
30#include <optional>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37/*******************************************************************************
38 * Class MaskConfig
39 ******************************************************************************/
40
45class MaskConfig final {
46 Q_DECLARE_TR_FUNCTIONS(MaskConfig)
47
48public:
49 // Constructors / Destructor
50 MaskConfig() = delete;
51 MaskConfig(const MaskConfig& other) noexcept;
52 ~MaskConfig() noexcept;
53
54 // Getters
55 bool isEnabled() const noexcept { return mEnabled; }
56 const std::optional<Length>& getOffset() const noexcept { return mOffset; }
57
58 // Operator Overloadings
59 bool operator==(const MaskConfig& rhs) const noexcept;
60 bool operator!=(const MaskConfig& rhs) const noexcept {
61 return !(*this == rhs);
62 }
63 MaskConfig& operator=(const MaskConfig& rhs) noexcept;
64
65 // Static Methods
66 static MaskConfig off() noexcept { return MaskConfig(false, std::nullopt); }
67 static MaskConfig automatic() noexcept {
68 return MaskConfig(true, std::nullopt);
69 }
70 static MaskConfig manual(const Length& offset) noexcept {
71 return MaskConfig(true, offset);
72 }
73 static MaskConfig maybe(const std::optional<Length>& offset) noexcept {
74 return MaskConfig(offset.has_value(), offset);
75 }
76
77private: // Methods
78 MaskConfig(bool enabled, const std::optional<Length>& offset) noexcept;
79
80private: // Data
81 bool mEnabled;
82 std::optional<Length> mOffset;
83};
84
85/*******************************************************************************
86 * End of File
87 ******************************************************************************/
88
89} // namespace librepcb
90
91#endif
The Length class is used to represent a length (for example 12.75 millimeters)
Definition length.h:82
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition maskconfig.h:45
const std::optional< Length > & getOffset() const noexcept
Definition maskconfig.h:56
static MaskConfig off() noexcept
Definition maskconfig.h:66
std::optional< Length > mOffset
nullopt means "from design rules"
Definition maskconfig.h:82
bool isEnabled() const noexcept
Definition maskconfig.h:55
static MaskConfig manual(const Length &offset) noexcept
Definition maskconfig.h:70
MaskConfig & operator=(const MaskConfig &rhs) noexcept
Definition maskconfig.cpp:58
static MaskConfig maybe(const std::optional< Length > &offset) noexcept
Definition maskconfig.h:73
bool mEnabled
Whether an automatic mask is added or not.
Definition maskconfig.h:81
bool operator==(const MaskConfig &rhs) const noexcept
Definition maskconfig.cpp:54
bool operator!=(const MaskConfig &rhs) const noexcept
Definition maskconfig.h:60
~MaskConfig() noexcept
Definition maskconfig.cpp:47
static MaskConfig automatic() noexcept
Definition maskconfig.h:67
Definition occmodel.cpp:76