Cryptolens Client API for C++
LicenseKey.hpp
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #include "imports/std/optional"
7 
8 #include "basic_Error.hpp"
9 #include "ActivationData.hpp"
10 #include "Customer.hpp"
11 #include "DataObject.hpp"
12 #include "LicenseKeyInformation.hpp"
13 #include "RawLicenseKey.hpp"
14 
15 namespace cryptolens_io {
16 
17 namespace v20190401 {
18 
19 class LicenseKeyChecker;
20 
34 class LicenseKey {
35 private:
37  RawLicenseKey raw_;
38 public:
39  LicenseKey(LicenseKeyInformation && license_key_information, RawLicenseKey && raw_license_key);
40 
41  // TODO: Add factory taking r-value references?
42  // This would mostly be used internally in the library since in most cases
43  // the handle class will be responsible for constructing the object.
44  //static optional<LicenseKey> make(basic_Error & e, RawLicenseKey const& raw_license_key);
45  //static optional<LicenseKey> make(basic_Error & e, optional<RawLicenseKey> const& raw_license_key);
46  //static optional<LicenseKey> make_unsafe(basic_Error & e, std::string const& license_key);
47 
48  std::string to_string() const;
49 
50  LicenseKeyInformation & get_license_key_information() { return info_; }
51  LicenseKeyInformation const& get_license_key_information() const { return info_; }
52 
53  LicenseKeyChecker check() const;
54 
55  int get_product_id() const;
56  std::uint64_t get_created() const;
57  std::uint64_t get_expires() const;
58  int get_period() const;
59  bool get_block() const;
60  bool get_trial_activation() const;
61  std::uint64_t get_sign_date() const;
62  bool get_f1() const;
63  bool get_f2() const;
64  bool get_f3() const;
65  bool get_f4() const;
66  bool get_f5() const;
67  bool get_f6() const;
68  bool get_f7() const;
69  bool get_f8() const;
70 
71  optional<int> const& get_id() const;
72  optional<std::string> const& get_key() const;
73  optional<std::string> const& get_notes() const;
74  optional<int> const& get_global_id() const;
75  optional<Customer> const& get_customer() const;
76  optional<std::vector<ActivationData>> const& get_activated_machines() const;
77  optional<int> const& get_maxnoofmachines() const;
78  optional<std::string> const& get_allowed_machines() const;
79  optional<std::vector<DataObject>> const& get_data_objects() const;
80 };
81 
82 } // namespace v20190401
83 
84 namespace v20180502 {
85 
87 
88 } // namespace v20180502
89 
90 namespace latest {
91 
93 
94 } // namespace latest
95 
96 } // namespace cryptolens_io
bool get_f3() const
Definition: LicenseKey.cpp:127
bool get_f1() const
Definition: LicenseKey.cpp:109
optional< int > const & get_global_id() const
Definition: LicenseKey.cpp:208
std::uint64_t get_created() const
Definition: LicenseKey.cpp:49
int get_period() const
Definition: LicenseKey.cpp:71
std::uint64_t get_expires() const
Definition: LicenseKey.cpp:60
std::uint64_t get_sign_date() const
Definition: LicenseKey.cpp:100
optional< int > const & get_maxnoofmachines() const
Definition: LicenseKey.cpp:236
Definition: ActivateError.hpp:5
Definition: LicenseKeyChecker.hpp:11
bool get_f7() const
Definition: LicenseKey.cpp:163
optional< std::vector< DataObject > > const & get_data_objects() const
Definition: LicenseKey.cpp:256
bool get_f4() const
Definition: LicenseKey.cpp:136
bool get_f5() const
Definition: LicenseKey.cpp:145
bool get_trial_activation() const
Definition: LicenseKey.cpp:89
Definition: RawLicenseKey.hpp:24
optional< int > const & get_id() const
Definition: LicenseKey.cpp:181
optional< Customer > const & get_customer() const
Definition: LicenseKey.cpp:217
int get_product_id() const
Definition: LicenseKey.cpp:38
optional< std::string > const & get_key() const
Definition: LicenseKey.cpp:190
optional< std::vector< ActivationData > > const & get_activated_machines() const
Definition: LicenseKey.cpp:226
optional< std::string > const & get_allowed_machines() const
Definition: LicenseKey.cpp:247
bool get_f8() const
Definition: LicenseKey.cpp:172
bool get_f2() const
Definition: LicenseKey.cpp:118
optional< std::string > const & get_notes() const
Definition: LicenseKey.cpp:199
bool get_block() const
Definition: LicenseKey.cpp:80
LicenseKeyChecker check() const
Definition: LicenseKey.cpp:31
Definition: LicenseKey.hpp:34
bool get_f6() const
Definition: LicenseKey.cpp:154
Definition: LicenseKeyInformation.hpp:34