Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Public Member Functions | Static Public Member Functions | List of all members
hdi::core::Registration Class Reference

Aids in user registration by reading/writing and de/encrypting the JSON data in a given file. More...

#include <hdicoreRegistration.h>

Public Member Functions

 Registration ()
 Constructs an empty Registration object. More...
 
 Registration (const Registration &reg_)
 Constructs a new Registration object from an existing Registration object (copy constructor) More...
 
virtual ~Registration ()
 Destructs a Registration object. More...
 
virtual Registrationoperator= (const Registration &rhs_)
 Assigns one Registration object to another. More...
 
virtual bool isEmpty () const
 Gets whether the target Registration object is empty (constructed with the default ctor) More...
 
virtual bool save (const std::string &path_, const crypt::aes::Key &key_, const crypt::aes::InitVector &iv_) const
 Writes (encrypted) JSON registration data to a file. More...
 
virtual bool reload (const std::string &path_, const crypt::aes::Key &key_, const crypt::aes::InitVector &iv_)
 Reloads the registration data from disk (as it is kept in memory at runtime, this might be necessary if another process or plugin manipulates the file) More...
 
virtual std::string aiSerial () const
 Gets the value of the Illustrator serial number element. More...
 
virtual bool setAISerial (const std::string &serial_)
 Sets the value of the Illustrator serial number element. More...
 
virtual std::string name () const
 Gets the value of the user name element. More...
 
virtual bool setName (const std::string &name_)
 Sets the value of the user name element. More...
 
virtual std::string company () const
 Gets the value of the company name element. More...
 
virtual bool setCompany (const std::string &company_)
 Sets the value of the company name element. More...
 
virtual std::string pluginSerial () const
 Gets the value of the product (plugin) serial. More...
 
virtual bool setPluginSerial (const std::string &serial_)
 Sets the value of the product (plugin) serial number. More...
 
virtual std::string pluginUpgradeSerial () const
 Gets the value of the product (plugin) upgrade serial. More...
 
virtual bool setPluginUpgradeSerial (const std::string &serial_)
 Sets the value of the product (plugin) upgrade serial. More...
 
virtual bool demoMode () const
 Gets whether the product (plugin) is in demo mode. More...
 
virtual void setDemoMode (const bool isDemo_)
 Sets whether the product (plugin) is in demo mode. More...
 
virtual bool demoModePersistent () const
 Gets whether the product (plugin) is in demo mode (persistently!) More...
 
virtual void setDemoModePersistent (const bool isDemo_)
 Sets whether the product (plugin) is in demo mode (persistently!) More...
 
virtual int32_t versionNumber () const
 Gets the number version for the registration data. More...
 
virtual bool setVersionNumber (const int32_t version_)
 Sets the number version for the registration data. More...
 
virtual std::string versionString () const
 Gets the version string for the registration data. More...
 
virtual bool setVersionString (const std::string &version_)
 Sets the version string for the registration data. More...
 
virtual std::auto_ptr< DictionaryPrefuserData () const
 Gets the dictionary for storing user data. More...
 

Static Public Member Functions

static bool load (const std::string &path_, const crypt::aes::Key &key_, const crypt::aes::InitVector &iv_, const bool create_, Registration &reg__)
 Convenience method to create a Registration object from (encrypted) JSON data in a file. More...
 

Detailed Description

Aids in user registration by reading/writing and de/encrypting the JSON data in a given file.

Constructor & Destructor Documentation

hdi::core::Registration::Registration ( )

Constructs an empty Registration object.

Author
GW
Date
09/2013
Note
To test if a Registration object is empty, call isEmpty() on it
Empty Registration objects do not relate to any actual registration file; they are designed to be "receivers" of some other Registration object via the overloaded assignment operator. Empty Registration objects are useless until such time (though it is safe to call any of their methods).
hdi::core::Registration::Registration ( const Registration reg_)

Constructs a new Registration object from an existing Registration object (copy constructor)

Author
GW
Date
09/2013
Parameters
reg_Existing Registration object
virtual hdi::core::Registration::~Registration ( )
virtual

Destructs a Registration object.

Author
GW
Date
09/2013

Member Function Documentation

virtual std::string hdi::core::Registration::aiSerial ( ) const
virtual

Gets the value of the Illustrator serial number element.

Author
GW
Date
09/2013
Returns
The value previously set for Illustrator's serial number, or "" if never set
virtual std::string hdi::core::Registration::company ( ) const
virtual

Gets the value of the company name element.

Author
GW
Date
09/2013
Returns
The value previously set for company's name, as UTF-8, or "" if never set
virtual bool hdi::core::Registration::demoMode ( ) const
virtual

Gets whether the product (plugin) is in demo mode.

Author
GW
Date
09/2013
Returns
true if in demo mode, false otherwise
virtual bool hdi::core::Registration::demoModePersistent ( ) const
virtual

Gets whether the product (plugin) is in demo mode (persistently!)

Author
GW
Date
01/2016
Returns
true if demo mode, false otherwise
virtual bool hdi::core::Registration::isEmpty ( ) const
virtual

Gets whether the target Registration object is empty (constructed with the default ctor)

Author
GW
Date
09/2013
Returns
true if the target Registration object is empty, false otherwise
static bool hdi::core::Registration::load ( const std::string &  path_,
const crypt::aes::Key key_,
const crypt::aes::InitVector iv_,
const bool  create_,
Registration reg__ 
)
static

Convenience method to create a Registration object from (encrypted) JSON data in a file.

Author
GW
Date
09/2013
Parameters
path_Path to the registration file, as UTF-8
key_AES crypt key for the file
iv_AES initialization vector for the file
reg__Return-by-reference for the Registration object for the file located at path_ and encrypted with key_ (and iv_)
create_Whether to create the file if it cannot be decrypted (or doesn't exist yet)
Returns
true if the file could be created (if necessary) and if the Registration object was acquired, false otherwise
Note
The file need not exist before calling this method (so long as create_ is true).
virtual std::string hdi::core::Registration::name ( ) const
virtual

Gets the value of the user name element.

Author
GW
Date
09/2013
Returns
The value previously set for user's name, as UTF-8, or "" if never set
virtual Registration& hdi::core::Registration::operator= ( const Registration rhs_)
virtual

Assigns one Registration object to another.

Author
GW
Date
09/2013
Parameters
rhs_Existing Registration object to copy values from
Returns
The target Registration object, but with its values updated to match that of the rhs_ argument
virtual std::string hdi::core::Registration::pluginSerial ( ) const
virtual

Gets the value of the product (plugin) serial.

Author
GW
Date
09/2013
Returns
The value previously set for the product serial, or "" if never set
virtual std::string hdi::core::Registration::pluginUpgradeSerial ( ) const
virtual

Gets the value of the product (plugin) upgrade serial.

Author
GW
Date
06/2016
Returns
The value previously set for the product upgrade serial, or "" if never set
virtual bool hdi::core::Registration::reload ( const std::string &  path_,
const crypt::aes::Key key_,
const crypt::aes::InitVector iv_ 
)
virtual

Reloads the registration data from disk (as it is kept in memory at runtime, this might be necessary if another process or plugin manipulates the file)

Author
GW
Date
01/2016
Parameters
path_Path to the registration file, as UTF-8
key_AES crypt key for the file
iv_AES initialization vector for the file
Returns
true if the registration could be reloaded from disk, false otherwise
Note
The given path, in most circumstances, should be the same as given to the load() method!
virtual bool hdi::core::Registration::save ( const std::string &  path_,
const crypt::aes::Key key_,
const crypt::aes::InitVector iv_ 
) const
virtual

Writes (encrypted) JSON registration data to a file.

Author
GW
Date
09/2013
Parameters
path_Path to the registration file, as UTF-8
key_AES crypt key for the file
iv_AES initialization vector for the file
Returns
true if the save operation was successful, false otherwise
virtual bool hdi::core::Registration::setAISerial ( const std::string &  serial_)
virtual

Sets the value of the Illustrator serial number element.

Author
GW
Date
09/2013
Parameters
serial_Serial number to set
Returns
true if the value is set successfully, false otherwise
Note
The Illustrator serial number can be acquired with hdi::core::Illustrator::serialNumber()
This method is useful to see if a user has registered their plugin with one license of Illustrator, but then attempted to use the same registration with a different Illustrator license. Enforcement of this sort of registration policy is not automatic.
virtual bool hdi::core::Registration::setCompany ( const std::string &  company_)
virtual

Sets the value of the company name element.

Author
GW
Date
09/2013
Parameters
company_Company name to set, as UTF-8
Returns
true if the value is set successfully, false otherwise
virtual void hdi::core::Registration::setDemoMode ( const bool  isDemo_)
virtual

Sets whether the product (plugin) is in demo mode.

Author
GW
Date
09/2013
Parameters
isDemo_true for demo, false otherwise
Note
This value is not stored persistently across launches
virtual void hdi::core::Registration::setDemoModePersistent ( const bool  isDemo_)
virtual

Sets whether the product (plugin) is in demo mode (persistently!)

Author
GW
Date
01/2016
Parameters
isDemo_true for demo, false otherwise
virtual bool hdi::core::Registration::setName ( const std::string &  name_)
virtual

Sets the value of the user name element.

Author
GW
Date
09/2013
Parameters
name_User name to set, as UTF-8
Returns
true if the value is set successfully, false otherwise
virtual bool hdi::core::Registration::setPluginSerial ( const std::string &  serial_)
virtual

Sets the value of the product (plugin) serial number.

Author
GW
Date
09/2013
Parameters
serial_Serial number to set
Returns
true if the value is set successfully, false otherwise
virtual bool hdi::core::Registration::setPluginUpgradeSerial ( const std::string &  serial_)
virtual

Sets the value of the product (plugin) upgrade serial.

Author
GW
Date
06/2016
Parameters
serial_Serial number to set
Returns
true if the value is set successfully, false otherwise
virtual bool hdi::core::Registration::setVersionNumber ( const int32_t  version_)
virtual

Sets the number version for the registration data.

Author
GW
Date
09/2013
Parameters
version_New number version value
Returns
true if the number is successfully updated, or false otherwise
virtual bool hdi::core::Registration::setVersionString ( const std::string &  version_)
virtual

Sets the version string for the registration data.

Author
GW
Date
09/2013
Parameters
version_New string version value
Returns
true if the string is successfully updated, or false otherwise
virtual std::auto_ptr<DictionaryPref> hdi::core::Registration::userData ( ) const
virtual

Gets the dictionary for storing user data.

Author
GW
Date
10/2016
Returns
Dictionary object for adding custom user data to the underlying registration data
virtual int32_t hdi::core::Registration::versionNumber ( ) const
virtual

Gets the number version for the registration data.

Author
GW
Date
09/2013
Returns
Stored version number, or 0 if none
virtual std::string hdi::core::Registration::versionString ( ) const
virtual

Gets the version string for the registration data.

Author
GW
Date
09/2013
Returns
Stored version string, or "" if none