Helper class for loading license information from the CC website or from saved data. More...
#include <LicenseInfoLoader.h>
Inherits LicenseInfo.
Public Member Functions | |
LicenseInfoLoader () | |
Default constructor. | |
LicenseInfoLoader (const LicenseInfo &info) | |
Copy constructor. | |
LoadedLicenseDataType | GetCCLicenseType () const |
Retrieves the type of XML license information that this object can use (according to the member values). | |
std::tstring | GetLicenseName () const |
Returns the license name. | |
UINT | GetLicenseImageID () const |
Returns the license image resource ID. | |
bool | LoadLicenseData (HWND hParent) |
Loads the license information from the cache, CC website (if not found) or saved resource (if cannot access). | |
Static Public Member Functions | |
static void | InitLicenseRetrievedData () |
Initializes the static data. | |
static const XDoc & | GetLicenseXML (LoadedLicenseDataType eType) |
Retrieves an XML object holding the cached license. | |
static bool | RequestLicenseType (LoadedLicenseDataType eType, HWND hWnd, bool &bCancel) |
Retrieves the license type information from the CC website. | |
Protected Member Functions | |
bool | RequestLicense (HWND hParent, XDoc &doc, bool &bCancel) |
Loads the license information from the CC website. | |
Static Protected Member Functions | |
static bool | IsValidLicenseInfo (LoadedLicenseDataType eType) |
Checks if the license specified is valid. | |
static bool | IsLicenseRetrievedData (LoadedLicenseDataType eType) |
Checks if this license was loaded from the web (or at least tried to). | |
static bool | LoadData (LoadedLicenseDataType eType, LPCTSTR pXML) |
Loads an XML string as the cached license. | |
static bool | LoadAndValidateData (LoadedLicenseDataType eType, XDoc &doc, LPCTSTR pXML) |
Loads an XML string into the cached license object and makes sure it's valid. | |
static bool | LoadInternalLicenseInfo (LoadedLicenseDataType eType) |
Loads a license data from a resource XML string. | |
static bool | IsValidLicenseInfo (LoadedLicenseDataType eType, XDoc &doc) |
Tests to see if the received XML object holds valid license data information. | |
static void | SetLicenseRetrieved (LoadedLicenseDataType eType) |
Sets the license retrieval flag. | |
static LPCTSTR | GetLicenseURL (LoadedLicenseDataType eType) |
Retrieves the license retrieval URL by the license type. | |
static LPCTSTR | GetImageURL (LoadedLicenseDataType eType) |
Retrieves the license image's URL by the license type. | |
Static Protected Attributes | |
static XDoc | m_xmlData [LLDT_Count] |
Cached XML license information. | |
static bool | m_bRetrievedFromWeb [LLDT_Count] |
Flags indicating if the license was retrieved from the CC website in this session. |
Helper class for loading license information from the CC website or from saved data.
Definition at line 35 of file LicenseInfoLoader.h.
LicenseInfoLoader::LicenseInfoLoader | ( | const LicenseInfo & | info | ) | [inline] |
Copy constructor.
info | The license information object to copy |
Definition at line 46 of file LicenseInfoLoader.h.
LicenseInfo::LoadedLicenseDataType LicenseInfoLoader::GetCCLicenseType | ( | ) | const |
Retrieves the type of XML license information that this object can use (according to the member values).
Definition at line 268 of file LicenseInfoLoader.cpp.
References LicenseInfo::m_bCommercialUse, LicenseInfo::m_eLicense, LicenseInfo::m_eModification, and LicenseInfo::m_eSampling.
Referenced by RequestLicense().
LPCTSTR LicenseInfoLoader::GetImageURL | ( | LoadedLicenseDataType | eType | ) | [static, protected] |
Retrieves the license image's URL by the license type.
eType | Type of license (only actual CC or Sampling licenses supported) |
Definition at line 181 of file LicenseInfoLoader.cpp.
References CCINFO_IMAGE_URL.
UINT LicenseInfoLoader::GetLicenseImageID | ( | ) | const |
Returns the license image resource ID.
Definition at line 130 of file LicenseInfoLoader.cpp.
References LicenseInfo::m_bCommercialUse, LicenseInfo::m_eLicense, LicenseInfo::m_eModification, and LicenseInfo::m_eSampling.
Referenced by CCLicensePropPage::UpdateLicenseControls().
std::tstring LicenseInfoLoader::GetLicenseName | ( | ) | const |
Returns the license name.
Definition at line 189 of file LicenseInfoLoader.cpp.
References LicenseInfo::HasJurisdiction(), LicenseInfo::m_cJurisdiction, LicenseInfo::m_cName, and tstring.
Referenced by CCLicensePropPage::UpdateLicenseControls().
LPCTSTR LicenseInfoLoader::GetLicenseURL | ( | LoadedLicenseDataType | eType | ) | [static, protected] |
Retrieves the license retrieval URL by the license type.
eType | Type of license (CC or Sampling) |
Definition at line 169 of file LicenseInfoLoader.cpp.
References CCINFO_URL.
Referenced by RequestLicenseType().
static const XDoc& LicenseInfoLoader::GetLicenseXML | ( | LoadedLicenseDataType | eType | ) | [inline, static] |
Retrieves an XML object holding the cached license.
eType | Type of license information needed |
Definition at line 83 of file LicenseInfoLoader.h.
References m_xmlData.
Referenced by CCLicenseWizJurisdictionPage::OnSetActive(), RequestLicense(), and CCLicenseWizBasePage::SetDescriptionFromField().
static bool LicenseInfoLoader::IsLicenseRetrievedData | ( | LoadedLicenseDataType | eType | ) | [inline, static, protected] |
Checks if this license was loaded from the web (or at least tried to).
Checks if the license data was retrieved from the website in this session
eType | The type of license data to check |
Definition at line 97 of file LicenseInfoLoader.h.
References m_bRetrievedFromWeb.
Referenced by RequestLicense(), and RequestLicenseType().
bool LicenseInfoLoader::IsValidLicenseInfo | ( | LoadedLicenseDataType | eType, | |
XDoc & | doc | |||
) | [static, protected] |
Tests to see if the received XML object holds valid license data information.
eType | Type of license to check | |
doc | XML object to validate the contents of |
Definition at line 219 of file LicenseInfoLoader.cpp.
bool LicenseInfoLoader::IsValidLicenseInfo | ( | LoadedLicenseDataType | eType | ) | [static, protected] |
Checks if the license specified is valid.
eType | Type of license to check |
Definition at line 208 of file LicenseInfoLoader.cpp.
References m_xmlData.
Referenced by LoadAndValidateData(), and LoadInternalLicenseInfo().
bool LicenseInfoLoader::LoadAndValidateData | ( | LoadedLicenseDataType | eType, | |
XDoc & | doc, | |||
LPCTSTR | pXML | |||
) | [static, protected] |
Loads an XML string into the cached license object and makes sure it's valid.
eType | Type of license to load | |
doc | XML object to fill with the license data | |
pXML | XML string to load |
Definition at line 250 of file LicenseInfoLoader.cpp.
References IsValidLicenseInfo().
Referenced by LoadData(), and RequestLicense().
bool LicenseInfoLoader::LoadData | ( | LoadedLicenseDataType | eType, | |
LPCTSTR | pXML | |||
) | [static, protected] |
Loads an XML string as the cached license.
eType | Type of license to load into the cache | |
pXML | XML string to load |
Definition at line 238 of file LicenseInfoLoader.cpp.
References LoadAndValidateData(), and m_xmlData.
Referenced by LoadInternalLicenseInfo(), RequestLicense(), and RequestLicenseType().
bool LicenseInfoLoader::LoadInternalLicenseInfo | ( | LoadedLicenseDataType | eType | ) | [static, protected] |
Loads a license data from a resource XML string.
eType | Type of license information to retrieve |
Definition at line 377 of file LicenseInfoLoader.cpp.
References ghInstance, IsValidLicenseInfo(), LoadData(), MakeTString(), and tstring.
Referenced by RequestLicense(), and RequestLicenseType().
bool LicenseInfoLoader::LoadLicenseData | ( | HWND | hParent | ) |
Loads the license information from the cache, CC website (if not found) or saved resource (if cannot access).
hParent | Handle to parent window |
Definition at line 587 of file LicenseInfoLoader.cpp.
References LoadResourceString(), LicenseInfo::m_eLicense, RequestLicense(), LicenseInfo::SetJurisdiction(), LicenseInfo::SetName(), and LicenseInfo::SetURI().
Referenced by CCLicensePropPage::PageProc().
bool LicenseInfoLoader::RequestLicense | ( | HWND | hParent, | |
XDoc & | doc, | |||
bool & | bCancel | |||
) | [protected] |
Loads the license information from the CC website.
hParent | Handle to parent window | |
doc | Reference to XML document to fill | |
bCancel | Reference to cancel flag; will be set to true if the user cancels the request |
Definition at line 412 of file LicenseInfoLoader.cpp.
References GetCCLicenseType(), GetLicenseXML(), LicenseInfo::HasJurisdiction(), IsLicenseRetrievedData(), LoadAndValidateData(), LoadData(), LoadInternalLicenseInfo(), LoadResourceString(), LicenseInfo::m_bCommercialUse, LicenseInfo::m_cJurisdiction, LicenseInfo::m_eLicense, LicenseInfo::m_eModification, LicenseInfo::m_eSampling, MakeAnsiString(), MakeTString(), LicenseInfo::SetJurisdiction(), SetLicenseRetrieved(), tstring, and URLEncode().
Referenced by LoadLicenseData().
bool LicenseInfoLoader::RequestLicenseType | ( | LoadedLicenseDataType | eType, | |
HWND | hWnd, | |||
bool & | bCancel | |||
) | [static] |
Retrieves the license type information from the CC website.
eType | Type of license creation information to load (only CC or Sampling allowed) | |
hWnd | Handle of parent window | |
bCancel | Reference to the cancel flag; will be set to true if the user canceled the request |
Definition at line 326 of file LicenseInfoLoader.cpp.
References CCPrintProgressDlg::DoRequest(), CCPrintProgressDlg::GetCancel(), InternetRequestBuffer::GetData(), GetLicenseURL(), IsLicenseRetrievedData(), LoadData(), LoadInternalLicenseInfo(), CCPrintProgressDlg::m_buffer, SetLicenseRetrieved(), and tstring.
Referenced by CCLicenseWizTypePage::OnKillActive().
static void LicenseInfoLoader::SetLicenseRetrieved | ( | LoadedLicenseDataType | eType | ) | [inline, static, protected] |
Sets the license retrieval flag.
eType | Type of license retrieved |
Definition at line 111 of file LicenseInfoLoader.h.
References m_bRetrievedFromWeb.
Referenced by RequestLicense(), and RequestLicenseType().