Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
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.
 
 Registration (const Registration &reg_)
 Constructs a new Registration object from an existing Registration object (copy constructor)
 
virtual ~Registration ()
 Destructs a Registration object.
 
virtual Registrationoperator= (const Registration &rhs_)
 Assigns one Registration object to another.
 
virtual bool isEmpty () const
 Gets whether the target Registration object is empty (constructed with the default ctor)
 
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.
 
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)
 
virtual std::string appSerial () const
 Gets the value of the parent application serial number element.
 
virtual bool setAppSerial (const std::string &serial_)
 Sets the value of the parent application serial number element.
 
virtual std::string name () const
 Gets the value of the user name element.
 
virtual bool setName (const std::string &name_)
 Sets the value of the user name element.
 
virtual std::string company () const
 Gets the value of the company name element.
 
virtual bool setCompany (const std::string &company_)
 Sets the value of the company name element.
 
virtual std::string pluginSerial () const
 Gets the value of the product (plugin) serial.
 
virtual bool setPluginSerial (const std::string &serial_)
 Sets the value of the product (plugin) serial number.
 
virtual std::string pluginUpgradeSerial () const
 Gets the value of the product (plugin) upgrade serial.
 
virtual bool setPluginUpgradeSerial (const std::string &serial_)
 Sets the value of the product (plugin) upgrade serial.
 
virtual bool demoMode () const
 Gets whether the product (plugin) is in demo mode.
 
virtual void setDemoMode (const bool isDemo_)
 Sets whether the product (plugin) is in demo mode.
 
virtual bool demoModePersistent () const
 Gets whether the product (plugin) is in demo mode (persistently!)
 
virtual void setDemoModePersistent (const bool isDemo_)
 Sets whether the product (plugin) is in demo mode (persistently!)
 
virtual int32_t versionNumber () const
 Gets the number version for the registration data.
 
virtual bool setVersionNumber (const int32_t version_)
 Sets the number version for the registration data.
 
virtual std::string versionString () const
 Gets the version string for the registration data.
 
virtual bool setVersionString (const std::string &version_)
 Sets the version string for the registration data.
 
virtual std::unique_ptr< DictionaryPrefuserData () const
 Gets the dictionary for storing user data.
 

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.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Registration() [1/2]

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

◆ Registration() [2/2]

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

◆ ~Registration()

virtual hdi::core::Registration::~Registration ( )
virtual

Destructs a Registration object.

Author
GW
Date
09/2013

Member Function Documentation

◆ appSerial()

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

Gets the value of the parent application serial number element.

Author
GW
Date
09/2013
Returns
The value previously set for the app's serial number, or "" if never set

◆ company()

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

◆ demoMode()

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

◆ demoModePersistent()

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

◆ isEmpty()

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

◆ load()

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

◆ name()

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

◆ operator=()

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

◆ pluginSerial()

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

◆ pluginUpgradeSerial()

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

◆ reload()

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!

◆ save()

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

◆ setAppSerial()

virtual bool hdi::core::Registration::setAppSerial ( const std::string &  serial_)
virtual

Sets the value of the parent application 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
For Illustrator, the app serial number can be acquired with the hdi::core::Illustrator::serialNumber() method.
For Photoshop, the app serial number can be acquired with the hdi::core::Photoshop::serialNumber() method.
This method is useful to see if a user has registered their plugin with one license of an app, but then attempted to use the same registration with a different parent app license. Enforcement of this sort of registration policy is not automatic.

◆ setCompany()

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

◆ setDemoMode()

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

◆ setDemoModePersistent()

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

◆ setName()

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

◆ setPluginSerial()

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

◆ setPluginUpgradeSerial()

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

◆ setVersionNumber()

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

◆ setVersionString()

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

◆ userData()

virtual std::unique_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

◆ versionNumber()

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

◆ versionString()

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