GameShield V5 SDK Programming Guide: gs::TGSLicense Class Reference

GameShield v5 SDK

gs::TGSLicense Class Reference

GS License Object. More...

Inheritance diagram for gs::TGSLicense:
Collaboration diagram for gs::TGSLicense:

Public Member Functions

 TGSLicense (const char *licId)
 Create a license instance by license type id. More...
 
bool bindToEntity (TGSEntity *entity)
 bind a license to an entity More...
 
std::string getUnlockRequestCode ()
 Gets a request code to unlock this license only.
 
TGSEntitylicensedEntity ()
 Gets the entity this license is attached to.
 
License Parameter APIs
int paramCount ()
 Gets total number of parameters.
 
TGSVariableparams (int index)
 C++: Gets parameter by its index (. More...
 
TGSVariableparams (const char *name)
 C++: Gets parameter by its name (. More...
 
TGSVariablegetParamByIndex (int index)
 Get the license parameter by its index, ranges [0, paramCount()-1 ].
 
TGSVariablegetParamByName (const char *name)
 Get the license parameter by its name.
 
License Properties
const char * id ()
 Gets the license object's license id.
 
const char * name ()
 Gets the license object's license name.
 
const char * description ()
 Gets the license object's license description.
 
TLicenseStatus status ()
 Gets the license object's license status (ref: LicenseStatus)
 
bool isValid ()
 Is license currently valid? More...
 
License parameter access helpers

Instead of getting the TGSVariable instance of license parameters and get its value via "asXXX()" functions, these helpers give you short-cut to retrieve the parameter value directly.

std::string getParamStr (const char *name)
 Gets parameter value as a string.
 
void setParamStr (const char *name, const char *v)
 Sets parameter value from a string.
 
int getParamInt (const char *name)
 Gets parameter value as a 32-bit integer.
 
void setParamInt (const char *name, int v)
 Sets parameter value as a 32-bit integer;.
 
int64_t getParamInt64 (const char *name)
 Gets parameter value as a 64-bit integer.
 
void setParamInt64 (const char *name, int64_t v)
 Sets parameter value as a 64-bit integer;.
 
bool getParamBool (const char *name)
 Gets parameter value as boolean.
 
void setParamBool (const char *name, bool v)
 Sets parameter value from a boolean;.
 
double getParamDouble (const char *name)
 Gets parameter value as double;.
 
void setParamDouble (const char *name, double v)
 Sets parameter value from a double.
 
float getParamFloat (const char *name)
 Gets parameter value as float.
 
void setParamFloat (const char *name, float v)
 Sets parameter value from float.
 
time_t getParamUTCTime (const char *name)
 Gets parameter value as time_t (seconds since 01/01/1970)
 
void setParamUTCTime (const char *name, time_t v)
 Sets parameter value from time_t (seconds since 01/01/1970)
 
Inspect license model's actions
int actionCount ()
 Gets total number of actions appliable to a license Ref: ActionInfo.
 
action_id_t actionIds (int index)
 Gets action id by index (ref: ActionInfo)
 
const char * actionNames (int index)
 Gets action name by index (ref: ActionInfo)
 
- Public Member Functions inherited from gs::TGSObject
gs_handle_t handle () const
 Gets GS5 object handle.
 

Detailed Description

GS License Object.

Constructor & Destructor Documentation

gs::TGSLicense::TGSLicense ( const char *  licId)
inline

Create a license instance by license type id.

Usually, the GS5 core creates license instances and bind them to associated entities automatically so there is no need to create a license instance manually by this api; however, if you are trying to do license-entity dynamic-binding at runtime, you can create a license by its type id and calls bindToEntity() to attach the license to a target entity.

Member Function Documentation

bool gs::TGSLicense::bindToEntity ( TGSEntity entity)

bind a license to an entity

Attach this license to a target entity. A license can be attached only to a single entity, while one entity can be attached to multiple licenses.

bool gs::TGSLicense::isValid ( )

Is license currently valid?

In GS5, an entity can be bundled with one or more licenses, depending the entity's license policy, the entity is accessible if any or all of its bundled licenses are valid.

TGSVariable * gs::TGSLicense::params ( int  index)

C++: Gets parameter by its index (.

See Also
getParamByIndex)
TGSVariable * gs::TGSLicense::params ( const char *  name)

C++: Gets parameter by its name (.

See Also
getParamByName )
Generated on Mon Feb 3 2014 13:15:29 for GameShield V5 SDK Programming Guide by   doxygen 1.8.5