#pragma once #include "license.h" #include #include #include using namespace std; struct NameValuePair { public: NameValuePair(const char* _name, const char* _value): name(_name), stringValue(_value) { } NameValuePair(const char* _name, int _value): name(_name), intValue(_value) { } NameValuePair(const char* _name, int _year, int _month, int _day): name(_name), dateValue { _year, _month, _day } { } NameValuePair(const char* _name, const unsigned char* _value, int _len): name(_name), binaryValue(_value, _value + _len) { } string name; int intValue; string stringValue; struct { int year, month, day; } dateValue; vector binaryValue; }; class LicenseValidationArgsImpl { friend LicensingClient; public: LicenseValidationArgsImpl(): m_license(nullptr) { } void SetLicense(LicenseImpl * license) { m_license = license; } const LicenseImpl * GetLicense() { return m_license; } void SetLicenseKey(const char * licenseKey, int validationDataSize = 0) { m_licenseKey = licenseKey; } void SetLicenseKeyValidationData(const char * fieldName, const char * fieldValue) { m_licenseKeyValidationData.emplace_back(fieldName, fieldValue); } void SetLicenseKeyValidationData(const char * fieldName, int fieldValue) { m_licenseKeyValidationData.emplace_back(fieldName, fieldValue); } void SetLicenseKeyValidationData(const char * fieldName, int year, int month, int day) { m_licenseKeyValidationData.emplace_back(fieldName, year, month, day); } void SetLicenseKeyValidationData(const char * fieldName, void * data, int len) { m_licenseKeyValidationData.emplace_back(fieldName, (unsigned char*)data, len); } const char * GetLicenseKey() { return m_licenseKey.c_str(); } public: const LicenseImpl* m_license; int m_validationDataSize; string m_licenseKey; list m_licenseKeyValidationData; };