2015-10-21 23:00:23 +00:00
|
|
|
/*
|
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
2016-10-13 13:00:19 +00:00
|
|
|
* Copyright (C) 2016 Symless Ltd.
|
2016-10-15 14:30:28 +00:00
|
|
|
*
|
2015-10-21 23:00:23 +00:00
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2016-10-15 14:30:28 +00:00
|
|
|
*
|
2015-10-21 23:00:23 +00:00
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-06-01 15:17:02 +00:00
|
|
|
#include "SerialKeyData.h"
|
2020-10-02 07:19:13 +00:00
|
|
|
#include "SerialKeyEdition.h"
|
2024-07-02 19:07:06 +00:00
|
|
|
#include <ctime>
|
|
|
|
|
#include <string>
|
2015-10-21 23:00:23 +00:00
|
|
|
|
2016-10-13 12:53:09 +00:00
|
|
|
class SerialKey {
|
2024-07-02 19:07:06 +00:00
|
|
|
friend bool operator==(SerialKey const &, SerialKey const &);
|
|
|
|
|
|
2016-10-13 12:53:09 +00:00
|
|
|
public:
|
2024-07-02 19:07:06 +00:00
|
|
|
explicit SerialKey(Edition edition = kUnregistered);
|
|
|
|
|
explicit SerialKey(const std::string &serial);
|
|
|
|
|
|
|
|
|
|
bool isExpiring(time_t currentTime) const;
|
|
|
|
|
bool isExpired(time_t currentTime) const;
|
|
|
|
|
bool isTrial() const;
|
|
|
|
|
bool isTemporary() const;
|
|
|
|
|
bool isMaintenance() const;
|
|
|
|
|
bool isValid() const;
|
|
|
|
|
time_t daysLeft(time_t currentTime) const;
|
|
|
|
|
time_t getExpiration() const;
|
|
|
|
|
int getSpanLeft(time_t time = ::time(0)) const;
|
|
|
|
|
Edition edition() const;
|
|
|
|
|
const std::string &toString() const;
|
2016-10-17 15:12:33 +00:00
|
|
|
|
2016-10-13 16:55:09 +00:00
|
|
|
private:
|
2024-07-02 19:07:06 +00:00
|
|
|
SerialKeyData m_data;
|
2015-10-21 23:00:23 +00:00
|
|
|
};
|
2016-10-14 10:28:37 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
inline bool operator==(SerialKey const &lhs, SerialKey const &rhs) {
|
|
|
|
|
return (lhs.m_data == rhs.m_data);
|
2016-10-14 10:28:37 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
inline bool operator!=(SerialKey const &lhs, SerialKey const &rhs) {
|
|
|
|
|
return !(lhs == rhs);
|
2016-10-14 10:28:37 +00:00
|
|
|
}
|