LicenseInfoLoader Struct Reference

Helper class for loading license information from the CC website or from saved data. More...

#include <LicenseInfoLoader.h>

Inherits LicenseInfo.

Collaboration diagram for LicenseInfoLoader:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

Helper class for loading license information from the CC website or from saved data.

Definition at line 35 of file LicenseInfoLoader.h.


Constructor & Destructor Documentation

LicenseInfoLoader::LicenseInfoLoader ( const LicenseInfo info  )  [inline]

Copy constructor.

Parameters:
info The license information object to copy

Definition at line 46 of file LicenseInfoLoader.h.


Member Function Documentation

LicenseInfo::LoadedLicenseDataType LicenseInfoLoader::GetCCLicenseType (  )  const

Retrieves the type of XML license information that this object can use (according to the member values).

Returns:
The type of license needed according to the information in the members

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.

Parameters:
eType Type of license (only actual CC or Sampling licenses supported)
Returns:
The URL to retrieve the image from

Definition at line 181 of file LicenseInfoLoader.cpp.

References CCINFO_IMAGE_URL.

UINT LicenseInfoLoader::GetLicenseImageID (  )  const

Returns the license image resource ID.

Returns:
Resource ID of the license image

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.

Returns:
Name of the license, including jurisdication (if any)

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.

Parameters:
eType Type of license (CC or Sampling)
Returns:
The URL to retrieve license creation data from

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.

Parameters:
eType Type of license information needed
Returns:
Reference to the cached XML object

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

Parameters:
eType The type of license data to check
Returns:
true if the license data was loaded from the website in this session, false if not

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.

Parameters:
eType Type of license to check
doc XML object to validate the contents of
Returns:
true if the object holds valid license data, false otherwise

Definition at line 219 of file LicenseInfoLoader.cpp.

bool LicenseInfoLoader::IsValidLicenseInfo ( LoadedLicenseDataType  eType  )  [static, protected]

Checks if the license specified is valid.

Parameters:
eType Type of license to check
Returns:
true if cached license information is valid

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.

Parameters:
eType Type of license to load
doc XML object to fill with the license data
pXML XML string to load
Returns:
true if XML object loaded with valid data, false otherwise

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.

Parameters:
eType Type of license to load into the cache
pXML XML string to load
Returns:
true if XML loaded successfully and the license data is valid, false otherwise

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.

Parameters:
eType Type of license information to retrieve
Returns:
true if loaded from resource successfully, false if failed

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).

Parameters:
hParent Handle to parent window
Returns:
true if license data parsed successfully, false if failed

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.

Parameters:
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
Returns:
true if the license information was retrieved successfully, false if failed

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.

Parameters:
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
Returns:
true if license retrieved successfully, false if failed

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.

Parameters:
eType Type of license retrieved

Definition at line 111 of file LicenseInfoLoader.h.

References m_bRetrievedFromWeb.

Referenced by RequestLicense(), and RequestLicenseType().


The documentation for this struct was generated from the following files:

Generated on Mon Jun 18 12:40:44 2012 for CC PDF Converter by doxygen 1.6.1