File indexing completed on 2024-05-26 05:04:50

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include <QDebug>
0011 #include <QJsonObject>
0012 #include <QString>
0013 
0014 class LIBRUQOLACORE_EXPORT ServerInfo
0015 {
0016 public:
0017     ServerInfo();
0018     ~ServerInfo();
0019 
0020     void parseServerInfo(const QJsonObject &obj);
0021     [[nodiscard]] QString arch() const;
0022     void setArch(const QString &arch);
0023 
0024     [[nodiscard]] int numberOfCpu() const;
0025     void setNumberOfCpu(int numberOfCpu);
0026 
0027     [[nodiscard]] QString platform() const;
0028     void setPlatform(const QString &platform);
0029 
0030     [[nodiscard]] QString version() const;
0031     void setVersion(const QString &version);
0032 
0033     [[nodiscard]] QString commitAuthor() const;
0034     void setCommitAuthor(const QString &commitAuthor);
0035 
0036     [[nodiscard]] QString commitBranch() const;
0037     void setCommitBranch(const QString &commitBranch);
0038 
0039     [[nodiscard]] QString commitTag() const;
0040     void setCommitTag(const QString &commitTag);
0041 
0042     [[nodiscard]] QString commitSubject() const;
0043     void setCommitSubject(const QString &commitSubject);
0044 
0045     [[nodiscard]] QString commitHash() const;
0046     void setCommitHash(const QString &commitHash);
0047 
0048     [[nodiscard]] bool operator==(const ServerInfo &other) const;
0049 
0050     [[nodiscard]] QString osRelease() const;
0051     void setOsRelease(const QString &osRelease);
0052 
0053     [[nodiscard]] QString nodeVersion() const;
0054     void setNodeVersion(const QString &nodeVersion);
0055 
0056 private:
0057     QString mArch;
0058     QString mPlatform;
0059     QString mVersion;
0060     QString mCommitAuthor;
0061     QString mCommitBranch;
0062     QString mCommitTag;
0063     QString mCommitSubject;
0064     QString mCommitHash;
0065     QString mOsRelease;
0066     QString mNodeVersion;
0067     // TODO Build Date
0068     int mNumberOfCpu = -1;
0069 };
0070 Q_DECLARE_METATYPE(ServerInfo)
0071 Q_DECLARE_TYPEINFO(ServerInfo, Q_RELOCATABLE_TYPE);
0072 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const ServerInfo &t);