LibrePCB Developers Documentation
versionfile.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_VERSIONFILE_H
21#define LIBREPCB_CORE_VERSIONFILE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../types/version.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35/*******************************************************************************
36 * Class VersionFile
37 ******************************************************************************/
38
47class VersionFile final {
48 Q_DECLARE_TR_FUNCTIONS(VersionFile)
49
50public:
51 // Constructors / Destructor
52 VersionFile() = delete;
53 VersionFile(const VersionFile& other) = default;
54
60 VersionFile(const Version& version) noexcept;
61
65 ~VersionFile() noexcept;
66
67 // Getters
68
74 const Version& getVersion() const noexcept { return mVersion; }
75
76 // Setters
77
83 void setVersion(const Version& version) noexcept { mVersion = version; }
84
85 // General Methods
86
90 QByteArray toByteArray() const noexcept;
91
101 static VersionFile fromByteArray(const QByteArray& content);
102
103 // Operator Overloadings
104 VersionFile& operator=(const VersionFile& rhs) = delete;
105
106private: // Data
111};
112
113/*******************************************************************************
114 * End of File
115 ******************************************************************************/
116
117} // namespace librepcb
118
119#endif
Class for reading and writing version files from/to QByteArray.
Definition: versionfile.h:47
void setVersion(const Version &version) noexcept
Set the version of the file.
Definition: versionfile.h:83
~VersionFile() noexcept
Definition: versionfile.cpp:41
Version mVersion
The version number of the file.
Definition: versionfile.h:110
QByteArray toByteArray() const noexcept
Export file content as byte array.
Definition: versionfile.cpp:48
static VersionFile fromByteArray(const QByteArray &content)
Load version file from byte array.
Definition: versionfile.cpp:56
const Version & getVersion() const noexcept
Get the content of the file.
Definition: versionfile.h:74
VersionFile(const VersionFile &other)=default
The Version class represents a version number in the format "1.42.7".
Definition: version.h:58
Definition: occmodel.cpp:77