LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
converterdb.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_EAGLEIMPORT_CONVERTERDB_H
21 #define LIBREPCB_EAGLEIMPORT_CONVERTERDB_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
27 #include <librepcb/common/uuid.h>
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class FilePath;
37 
38 namespace eagleimport {
39 
40 /*******************************************************************************
41  * Class ConverterDb
42  ******************************************************************************/
43 
47 class ConverterDb final {
48 public:
49  // Constructors / Destructor
50  ConverterDb() = delete;
51  ConverterDb(const ConverterDb& other) = delete;
52  ConverterDb(const FilePath& ini) noexcept;
53  ~ConverterDb() noexcept;
54 
55  // General Methods
56  void setCurrentLibraryFilePath(const FilePath& fp) noexcept {
57  mLibFilePath = fp;
58  }
59  const FilePath& getCurrentLibraryFilePath() const noexcept {
60  return mLibFilePath;
61  }
62  Uuid getSymbolUuid(const QString& symbolName);
63  Uuid getSymbolPinUuid(const Uuid& symbolUuid, const QString& pinName);
64  Uuid getFootprintUuid(const QString& packageName);
65  Uuid getPackageUuid(const QString& packageName);
66  Uuid getPackagePadUuid(const Uuid& footprintUuid, const QString& padName);
67  Uuid getComponentUuid(const QString& deviceSetName);
68  Uuid getComponentSignalUuid(const Uuid& componentUuid,
69  const QString& gateName, const QString& pinName);
70  Uuid getSymbolVariantUuid(const Uuid& componentUuid);
71  Uuid getSymbolVariantItemUuid(const Uuid& componentUuid,
72  const QString& gateName);
73  Uuid getDeviceUuid(const QString& deviceSetName, const QString& deviceName);
74 
75  // Operator Overloadings
76  ConverterDb& operator=(const ConverterDb& rhs) = delete;
77 
78 private:
79  Uuid getOrCreateUuid(const QString& cat, const QString& key1,
80  const QString& key2 = QString());
81 
82  QSettings mIniFile;
84 };
85 
86 /*******************************************************************************
87  * End of File
88  ******************************************************************************/
89 
90 } // namespace eagleimport
91 } // namespace librepcb
92 
93 #endif // LIBREPCB_EAGLEIMPORT_CONVERTERDB_H
~ConverterDb() noexcept
Definition: converterdb.cpp:41
Uuid getSymbolPinUuid(const Uuid &symbolUuid, const QString &pinName)
Definition: converterdb.cpp:52
FilePath mLibFilePath
Definition: converterdb.h:83
Uuid getPackageUuid(const QString &packageName)
Definition: converterdb.cpp:61
The ConverterDb class.
Definition: converterdb.h:47
Uuid getComponentSignalUuid(const Uuid &componentUuid, const QString &gateName, const QString &pinName)
Definition: converterdb.cpp:74
Uuid getOrCreateUuid(const QString &cat, const QString &key1, const QString &key2=QString())
Definition: converterdb.cpp:100
Uuid getFootprintUuid(const QString &packageName)
Definition: converterdb.cpp:57
Uuid getComponentUuid(const QString &deviceSetName)
Definition: converterdb.cpp:70
Uuid getSymbolVariantUuid(const Uuid &componentUuid)
Definition: converterdb.cpp:81
void setCurrentLibraryFilePath(const FilePath &fp) noexcept
Definition: converterdb.h:56
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Uuid getPackagePadUuid(const Uuid &footprintUuid, const QString &padName)
Definition: converterdb.cpp:65
ConverterDb & operator=(const ConverterDb &rhs)=delete
const FilePath & getCurrentLibraryFilePath() const noexcept
Definition: converterdb.h:59
QSettings mIniFile
Definition: converterdb.h:82
Uuid getDeviceUuid(const QString &deviceSetName, const QString &deviceName)
Definition: converterdb.cpp:91
Uuid getSymbolUuid(const QString &symbolName)
Definition: converterdb.cpp:48
Uuid getSymbolVariantItemUuid(const Uuid &componentUuid, const QString &gateName)
Definition: converterdb.cpp:85