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 
44 class ExcellonGenerator final {
45  Q_DECLARE_TR_FUNCTIONS(ExcellonGenerator)
46 
47 public:
48  // Constructors / Destructor
49  // ExcellonGenerator() = delete;
50  ExcellonGenerator(const ExcellonGenerator& other) = delete;
51  ExcellonGenerator() noexcept;
52  ~ExcellonGenerator() noexcept;
53 
54  // Getters
55  const QString& toStr() const noexcept { return mOutput; }
56 
57  // General Methods
58  void drill(const Point& pos, const PositiveLength& dia) noexcept;
59  void generate();
60  void saveToFile(const FilePath& filepath) const;
61  void reset() noexcept;
62 
63  // Operator Overloadings
64  ExcellonGenerator& operator=(const ExcellonGenerator& rhs) = delete;
65 
66 private:
67  void printHeader() noexcept;
68  void printToolList() noexcept;
69  void printDrills() noexcept;
70  void printFooter() noexcept;
71 
72  // Excellon Data
73  QString mOutput;
74  QMultiMap<Length, Point> mDrillList;
75 };
76 
77 /*******************************************************************************
78  * End of File
79  ******************************************************************************/
80 
81 } // namespace librepcb
82 
83 #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:44
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
void generate()
Definition: excellongenerator.cpp:53
QMultiMap< Length, Point > mDrillList
Definition: excellongenerator.h:74
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
void printFooter() noexcept
Definition: excellongenerator.cpp:112
const QString & toStr() const noexcept
Definition: excellongenerator.h:55
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:780
QString mOutput
Definition: excellongenerator.h:73
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:82
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