The class provides access license details in read-only mode. More...
#include <ms_license.hpp>
Public Member Functions | |
ms_license () | |
Default constructor. | |
ms_license (const char *filename) | |
Immediate action constructor. | |
ms_license (const ms_license &src) | |
Copying constructor. | |
~ms_license () | |
Destructor. | |
void | appendErrors (const ms_errors &src) |
Copies all errors from another instance and appends them at the end of own list. | |
void | clearAllErrors () |
Remove all errors from the current list of errors. | |
void | copyFrom (const ms_errors *right) |
Use this member to make a copy of another instance. | |
void | copyFrom (const ms_license *right) |
Copies all information from another instance. | |
void | defaultValues () |
Can be called before re-using the instance in order to erase the previous license details. | |
std::string | getDistributor () const |
Returns Mascot distributor information. | |
std::string | getEndDate () const |
Returns a date the license is valid until as a string. | |
const ms_errs * | getErrorHandler () const |
Retrive the error object using this function to get access to all errors and error parameters. | |
std::string | getFeatures () const |
Returns a string which encodes feature information. | |
std::string | getFileName () const |
Returns a file name being used as a license. | |
int | getLastError () const |
Return the error description of the last error that occurred. | |
std::string | getLastErrorString () const |
Return the error description of the last error that occurred. | |
std::string | getLicensee () const |
Returns a name of the licensee. | |
std::string | getLicenseString () const |
Returns a compound license string that can be used for displaying license information. | |
std::string | getLicenseVersion () const |
Returns a license version as a string. | |
int | getNumProcessorsLicensed () const |
Returns a number of processors licensed. | |
std::string | getStartDate () const |
Returns a date the license is valid from as a string. | |
bool | isLicenseValid () const |
Returns TRUE if the license has been sucessfully read, parsed and checked. | |
bool | isValid () const |
Call this function to determine if there have been any errors. | |
ms_license & | operator= (const ms_license &right) |
Assignment operator for C++ client applications. | |
void | read_file () |
Main method that reads in the license file. | |
void | setFileName (const char *filename) |
Set the license file name explicitly rather than use a default location. | |
The class provides access license details in read-only mode.
This class doesn't contain functions to create a new license or read details of why a license may be invalid.
Please note the ms_license class will only work with license files from Mascot release 2.3 or earlier.
To use this class:
ms_license | ( | ) |
Default constructor.
This doesn't read a license file.
ms_license | ( | const char * | filename | ) |
Immediate action constructor.
Loads the license file into memory. Call isValid() and isLicenseValid() to checks that it is a valid license file.
filename | is a full or relative path to mascot.license |
|
inherited |
Copies all errors from another instance and appends them at the end of own list.
src | The object to copy the errors across from. See Maintaining object references: two rules of thumb. |
|
inherited |
Remove all errors from the current list of errors.
The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.
All messages are accumulated into a list in this object, until clearAllErrors() is called.
See Error Handling.
|
inherited |
Use this member to make a copy of another instance.
right | is the source to initialise from |
std::string getDistributor | ( | ) | const |
Returns Mascot distributor information.
The distributor will be one of:
std::string getEndDate | ( | ) | const |
Returns a date the license is valid until as a string.
|
inherited |
Retrive the error object using this function to get access to all errors and error parameters.
See Error Handling.
std::string getFeatures | ( | ) | const |
Returns a string which encodes feature information.
std::string getFileName | ( | ) | const |
Returns a file name being used as a license.
|
inherited |
Return the error description of the last error that occurred.
All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.
See Error Handling.
|
inherited |
Return the error description of the last error that occurred.
All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.
See Error Handling.
std::string getLicensee | ( | ) | const |
Returns a name of the licensee.
The licensee name will be up to 80 characters long.
std::string getLicenseString | ( | ) | const |
Returns a compound license string that can be used for displaying license information.
This will be of the following format:
Licensed to: xxx, (yy processors).
For a temporary license:
Licensed to: xxx, (yy processors). Demo version expires: zzzz
std::string getLicenseVersion | ( | ) | const |
Returns a license version as a string.
The license version number is not directly related to the Mascot version number. It is incremented each time new functionality (and hence extra lines) are added to the license file.
int getNumProcessorsLicensed | ( | ) | const |
Returns a number of processors licensed.
std::string getStartDate | ( | ) | const |
Returns a date the license is valid from as a string.
bool isLicenseValid | ( | ) | const |
Returns TRUE if the license has been sucessfully read, parsed and checked.
If the license is not valid, some information may be available by calling getLastErrorString() or getLastError().
|
inherited |
Call this function to determine if there have been any errors.
This will return true unless there have been any fatal errors.
See Error Handling.
void read_file | ( | ) |
Main method that reads in the license file.
Called by the constructor if a filename is passed.
void setFileName | ( | const char * | filename | ) |
Set the license file name explicitly rather than use a default location.
A default location for the license file is ../config/mascot.license
. Call this member to change this file name before calling read_file().
filename | The license filename – full or relative path. |