LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
excellongenerator.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_EXCELLONGENERATOR_H
21 #define LIBREPCB_EXCELLONGENERATOR_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../exceptions.h"
27 #include "../fileio/filepath.h"
28 #include "../units/all_length_units.h"
29 
30 #include <QtCore>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 /*******************************************************************************
38  * Class GerberGenerator
39  ******************************************************************************/
40 
47 class ExcellonGenerator final {
48  Q_DECLARE_TR_FUNCTIONS(ExcellonGenerator)
49 
50 public:
51  // Constructors / Destructor
52  // ExcellonGenerator() = delete;
53  ExcellonGenerator(const ExcellonGenerator& other) = delete;
54  ExcellonGenerator() noexcept;
55  ~ExcellonGenerator() noexcept;
56 
57  // Getters
58  const QString& toStr() const noexcept { return mOutput; }
59 
60  // General Methods
61  void drill(const Point& pos, const PositiveLength& dia) noexcept;
62  void generate();
63  void saveToFile(const FilePath& filepath) const;
64  void reset() noexcept;
65 
66  // Operator Overloadings
67  ExcellonGenerator& operator=(const ExcellonGenerator& rhs) = delete;
68 
69 private:
70  void printHeader() noexcept;
71  void printToolList() noexcept;
72  void printDrills() noexcept;
73  void printFooter() noexcept;
74 
75  // Excellon Data
76  QString mOutput;
77  QMultiMap<Length, Point> mDrillList;
78 };
79 
80 /*******************************************************************************
81  * End of File
82  ******************************************************************************/
83 
84 } // namespace librepcb
85 
86 #endif // LIBREPCB_EXCELLONGENERATOR_H
void printHeader() noexcept
Definition: excellongenerator.cpp:73
ExcellonGenerator() noexcept
Definition: excellongenerator.cpp:38
void reset() noexcept
Definition: excellongenerator.cpp:64
void printToolList() noexcept
Definition: excellongenerator.cpp:93
void printDrills() noexcept
Definition: excellongenerator.cpp:100
The ExcellonGenerator class.
Definition: excellongenerator.h:47
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:81
void generate()
Definition: excellongenerator.cpp:53
QMultiMap< Length, Point > mDrillList
Definition: excellongenerator.h:77
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
void printFooter() noexcept
Definition: excellongenerator.cpp:112
const QString & toStr() const noexcept
Definition: excellongenerator.h:58
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:783
QString mOutput
Definition: excellongenerator.h:76
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:85
void saveToFile(const FilePath &filepath) const
Definition: excellongenerator.cpp:60
void drill(const Point &pos, const PositiveLength &dia) noexcept
Definition: excellongenerator.cpp:48
~ExcellonGenerator() noexcept
Definition: excellongenerator.cpp:41