mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 20:50:43 +00:00
This removes git dependencies from everything except for version.cpp, and removes the associated interfaces in version.h. Since the full version string contains the branch and revision number where applicable, the build information no longer needs to report branch and revision separately. It also now queries version.cpp for a more consistent and reliable build time. Debug output of build information is also now more consistent with less redundant code.
60 lines
2.0 KiB
C++
60 lines
2.0 KiB
C++
/* Version.h
|
|
*
|
|
* Copyright (c) 2020 The OSCAR Team
|
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file COPYING in the main directory of the source code
|
|
* for more details. */
|
|
|
|
#ifndef VERSION_H
|
|
#define VERSION_H
|
|
|
|
#include <QString>
|
|
|
|
class Version
|
|
{
|
|
friend class VersionTests;
|
|
public:
|
|
Version(const QString & version_string);
|
|
const QString PrereleaseType() const;
|
|
bool IsReleaseVersion() const { return mPrerelease.isEmpty(); }
|
|
bool IsValid() const { return mIsValid; }
|
|
bool operator==(const Version & b) const { return Compare(*this, b) == 0; }
|
|
bool operator!=(const Version & b) const { return Compare(*this, b) != 0; }
|
|
bool operator<(const Version & b) const { return Compare(*this, b) < 0; }
|
|
bool operator>(const Version & b) const { return Compare(*this, b) > 0; }
|
|
|
|
//!brief Returns the full version string, including all metadata, used in reports
|
|
operator const QString &() const;
|
|
//!brief Returns the full version string, including all metadata, used in reports
|
|
const QString & toString() const;
|
|
//!brief Returns the version string to display in the UI, without build metadata if a release version
|
|
const QString displayString() const;
|
|
//!brief Returns the version string without any build metadata
|
|
const QString minimalString() const;
|
|
//!brief Returns the build metadata
|
|
const QString & getBuildMetadata() const;
|
|
|
|
protected:
|
|
const QString mString;
|
|
bool mIsValid;
|
|
|
|
int mMajor, mMinor, mPatch;
|
|
QString mPrerelease, mBuild;
|
|
|
|
void ParseSemanticVersion();
|
|
void FixLegacyVersions();
|
|
static int Compare(const Version & a, const Version & b);
|
|
};
|
|
|
|
//!brief Get the current version of the application.
|
|
const Version & getVersion();
|
|
|
|
//!brief Get the date and time of the application was built.
|
|
const QString & getBuildDateTime();
|
|
|
|
QString getPrereleaseSuffix();
|
|
|
|
#endif // VERSION_H
|