LibrePCB Developers Documentation
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 <optional/tl/optional.hpp>
29
30#include <QtCore>
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 tl::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, tl::nullopt); }
67 static MaskConfig automatic() noexcept {
68 return MaskConfig(true, tl::nullopt);
69 }
70 static MaskConfig manual(const Length& offset) noexcept {
71 return MaskConfig(true, offset);
72 }
73 static MaskConfig maybe(const tl::optional<Length>& offset) noexcept {
74 return MaskConfig(offset.has_value(), offset);
75 }
76
77private: // Methods
78 MaskConfig(bool enabled, const tl::optional<Length>& offset) noexcept;
79
80private: // Data
81 bool mEnabled;
82 tl::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:83
The MaskConfig class defines how to add automatic stop mask or solder paste.
Definition: maskconfig.h:45
static MaskConfig off() noexcept
Definition: maskconfig.h:66
bool isEnabled() const noexcept
Definition: maskconfig.h:55
static MaskConfig maybe(const tl::optional< Length > &offset) noexcept
Definition: maskconfig.h:73
static MaskConfig manual(const Length &offset) noexcept
Definition: maskconfig.h:70
MaskConfig & operator=(const MaskConfig &rhs) noexcept
Definition: maskconfig.cpp:58
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
tl::optional< Length > mOffset
nullopt means "from design rules"
Definition: maskconfig.h:82
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
const tl::optional< Length > & getOffset() const noexcept
Definition: maskconfig.h:56
Definition: occmodel.cpp:77