// // Copyright (c) ANSCENTER. All rights reserved. // #include "precomp.h" #include "anslicensing.h" #include "template.h" #include "bitstream.h" #include "base32.h" #include "base64.h" #include "sha1.h" #include "except.h" #include "uniconv.h" #include "validator.h" namespace ANSCENTER { namespace Licensing { template<> KeyValidatorT::KeyValidatorT(): m_Impl( *new KeyValidatorImpl() ) { } template<> KeyValidatorT::KeyValidatorT(): m_Impl( *new KeyValidatorImpl() ) { } template<> KeyValidatorT::KeyValidatorT(const LicenseTemplateT * keyTemplate): m_Impl( *new KeyValidatorImpl(&keyTemplate->m_Impl) ) { } template<> KeyValidatorT::KeyValidatorT(const LicenseTemplateT * keyTemplate): m_Impl( *new KeyValidatorImpl(&keyTemplate->m_Impl) ) { } template<> KeyValidatorT::~KeyValidatorT() { delete & m_Impl; } template<> KeyValidatorT::~KeyValidatorT() { delete & m_Impl; } template<> KeyValidatorT * KeyValidatorT::Create() { return new KeyValidatorT(); } template<> KeyValidatorT * KeyValidatorT::Create() { return new KeyValidatorT(); } template<> void KeyValidatorT::Destroy(KeyValidatorT * obj) { delete obj; } template<> void KeyValidatorT::Destroy(KeyValidatorT * obj) { delete obj; } template<> void KeyValidatorT::SetKeyTemplate(const LicenseTemplateT * templ) { m_Impl.SetKeyTemplate(&templ->m_Impl); } template<> void KeyValidatorT::SetKeyTemplate(const LicenseTemplateT * templ) { m_Impl.SetKeyTemplate(&templ->m_Impl); } template<> void KeyValidatorT::SetValidationData(const char * fieldName, const void * buf, int len) { m_Impl.SetValidationData(fieldName, buf, len); } template<> void KeyValidatorT::SetValidationData(const wchar_t * fieldName, const void * buf, int len) { m_Impl.SetValidationData(w2s(fieldName).c_str(), buf, len); } template<> void KeyValidatorT::SetValidationData(const char * fieldName, const char * data) { m_Impl.SetValidationData(fieldName, data); } template<> void KeyValidatorT::SetValidationData(const wchar_t * fieldName, const wchar_t * data) { m_Impl.SetValidationData(w2s(fieldName).c_str(), w2s(data).c_str()); } template<> void KeyValidatorT::SetValidationData(const char * fieldName, int data) { m_Impl.SetValidationData(fieldName, data); } template<> void KeyValidatorT::SetValidationData(const wchar_t * fieldName, int data) { m_Impl.SetValidationData(w2s(fieldName).c_str(), data); } template<> void KeyValidatorT::SetKey(const char * key) { m_Impl.SetKey(key); } template<> void KeyValidatorT::SetKey(const wchar_t * key) { m_Impl.SetKey(w2s(key).c_str()); } template<> bool KeyValidatorT::IsKeyValid() { return m_Impl.IsKeyValid(); } template<> bool KeyValidatorT::IsKeyValid() { return m_Impl.IsKeyValid(); } template<> void KeyValidatorT::QueryKeyData(const char * dataField, void * buf, int * len) { m_Impl.QueryKeyData(dataField, buf, len); } template<> void KeyValidatorT::QueryKeyData(const wchar_t * dataField, void * buf, int * len) { m_Impl.QueryKeyData(w2s(dataField).c_str(), buf, len); } template<> int KeyValidatorT::QueryIntKeyData(const char * dataField) { return m_Impl.QueryIntKeyData(dataField); } template<> int KeyValidatorT::QueryIntKeyData(const wchar_t * dataField) { return m_Impl.QueryIntKeyData(w2s(dataField).c_str()); } template<> void KeyValidatorT::QueryDateKeyData(const char * dataField, int * year, int * month, int * day) { m_Impl.QueryDateKeyData(dataField, year, month, day); } template<> void KeyValidatorT::QueryDateKeyData(const wchar_t * dataField, int * year, int * month, int * day) { m_Impl.QueryDateKeyData(w2s(dataField).c_str(), year, month, day); } template<> void KeyValidatorT::QueryValidationData(const char * dataField, void * buf, int * len) { m_Impl.QueryValidationData(dataField, buf, len); } template<> void KeyValidatorT::QueryValidationData(const wchar_t * dataField, void * buf, int * len) { m_Impl.QueryValidationData((dataField) ? w2s(dataField).c_str() : NULL, buf, len); } }; };