// // Copyright (c) 2014 ANSCENTER. All rights reserved. // #include "precomp.h" #include "anslicensing.h" #include "template.h" #include "base32.h" #include "base64.h" #include "sha1.h" #include "except.h" #include "bitstream.h" #include "uniconv.h" #include "generator.h" namespace ANSCENTER { namespace Licensing { template<> KeyGeneratorT::KeyGeneratorT(): m_Impl( *new KeyGeneratorImpl()) { } template<> KeyGeneratorT::KeyGeneratorT(): m_Impl( *new KeyGeneratorImpl()) { } template<> KeyGeneratorT::KeyGeneratorT(const LicenseTemplateT * templ): m_Impl( *new KeyGeneratorImpl(&templ->m_Impl) ) { } template<> KeyGeneratorT::KeyGeneratorT(const LicenseTemplateT * templ): m_Impl( *new KeyGeneratorImpl(&templ->m_Impl) ) { } template<> KeyGeneratorT::~KeyGeneratorT() { delete & m_Impl; } template<> KeyGeneratorT::~KeyGeneratorT() { delete & m_Impl; } template<> KeyGeneratorT * KeyGeneratorT::Create() { return new KeyGeneratorT(); } template<> KeyGeneratorT * KeyGeneratorT::Create() { return new KeyGeneratorT(); } template<> void KeyGeneratorT::Destroy(KeyGeneratorT * obj) { delete obj; } template<> void KeyGeneratorT::Destroy(KeyGeneratorT * obj) { delete obj; } template<> void KeyGeneratorT::SetKeyData(const char * fieldName, const void * buf, int len) { m_Impl.KeyGeneratorImpl::SetKeyData(fieldName, buf, len); } template<> void KeyGeneratorT::SetKeyData(const wchar_t * fieldName, const void * buf, int len) { m_Impl.KeyGeneratorImpl::SetKeyData(w2s(fieldName).c_str(), buf, len); } template<> void KeyGeneratorT::SetKeyData(const char * fieldName, int data) { m_Impl.SetKeyData(fieldName, data); } template<> void KeyGeneratorT::SetKeyData(const wchar_t * fieldName, int data) { m_Impl.SetKeyData(w2s(fieldName).c_str(), data); } template<> void KeyGeneratorT::SetKeyData(const char * fieldName, const char * data) { m_Impl.SetKeyData(fieldName, data); } template<> void KeyGeneratorT::SetKeyData(const wchar_t * fieldName, const wchar_t * data) { m_Impl.SetKeyData(w2s(fieldName).c_str(), w2s(data).c_str()); } template<> void KeyGeneratorT::SetKeyData(const char * fieldName, int year, int month, int day) { m_Impl.SetKeyData(fieldName, year, month, day); } template<> void KeyGeneratorT::SetKeyData(const wchar_t * fieldName, int year, int month, int day) { m_Impl.SetKeyData(w2s(fieldName).c_str(), year, month, day); } template<> void KeyGeneratorT::SetValidationData(const char * fieldName, const void * buf, int len) { m_Impl.SetValidationData(fieldName, buf, len); } template<> void KeyGeneratorT::SetValidationData(const wchar_t * fieldName, const void * buf, int len) { m_Impl.SetValidationData(w2s(fieldName).c_str(), buf, len); } template<> void KeyGeneratorT::SetValidationData(const char * fieldName, int data) { m_Impl.SetValidationData(fieldName, data); } template<> void KeyGeneratorT::SetValidationData(const wchar_t * fieldName, int data) { m_Impl.SetValidationData(w2s(fieldName).c_str(), data); } template<> void KeyGeneratorT::SetValidationData(const char * fieldName, const char * data) { m_Impl.SetValidationData(fieldName, data); } template<> void KeyGeneratorT::SetValidationData(const wchar_t * fieldName, const wchar_t * data) { m_Impl.SetValidationData(w2s(fieldName).c_str(), w2s(data).c_str()); } template<> void KeyGeneratorT::SetKeyTemplate(const LicenseTemplateT & templ) { m_Impl.SetKeyTemplate(&templ.m_Impl); } template<> void KeyGeneratorT::SetKeyTemplate(const LicenseTemplateT & templ) { m_Impl.SetKeyTemplate(&templ.m_Impl); } template<> void KeyGeneratorT::SetKeyTemplate(const LicenseTemplateT * templ) { m_Impl.SetKeyTemplate(&templ->m_Impl); } template<> void KeyGeneratorT::SetKeyTemplate(const LicenseTemplateT * templ) { m_Impl.SetKeyTemplate(&templ->m_Impl); } template<> const char * KeyGeneratorT::GenerateKey() { return m_Impl.GenerateKey(); } template<> const wchar_t * KeyGeneratorT::GenerateKey() { static wstring wstr1; wstr1 = s2w(m_Impl.GenerateKey()); return wstr1.c_str(); } }; };