vrq
Public Member Functions | Protected Attributes

CBackend Class Reference

This is the abstract class to overload to create new backend tools. More...

#include <cbackend.h>

List of all members.

Public Member Functions

virtual char * GetToolName (void)=0
 map of switch to its description
virtual char * GetToolDescription (void)=0
 Access method for tool description use in vrq help.
virtual int AcceptAllPlusArgs (void)
 Override this method if the plugin accepts arbitrary plusargs: ie +argName[=argValue] or +argName[+argValue].
virtual list< string > & GetSwitches (void)
 Access method for list of switches.
virtual const char * GetSwitchDescription (const char *sw)
 Method to get the help text for a switch using the switch name as a key.
virtual void RegisterSwitch (const char *switchName, const char *description)
 Method shortcut to register tool switches with vrq's help system.
virtual int ResolveModules ()=0
 Method to control if plugin requires all module definitions to be searched for and found.
virtual int ResolveInstance (CModule *module, CInstance *inst)=0
 Method to control the resolution of individual module instances.
virtual int HideTool ()
 Method to control if plugin should be hidden, in this case it will not appear in the help but will it still be possible to invoke it.
virtual int IgnoreVrqComments ()
 Method to control how parser handles vrq comment based pragmas: ie // vrq translate_on/off Note: the default behavior is to not ignore vrq comment based pragmas.
virtual void Activate ()=0
 Method to initialize the plugin.
virtual void Process (list< CElement > &inputList, list< CElement > &outputList)=0
 Method to implement plugin function.

Protected Attributes

list< string > switches
map< string, string > switchDescription
 list of plugin command line switches

Detailed Description

This is the abstract class to overload to create new backend tools.

Each tool should create a subclass of this and either add it to the toolList in main.cc or compile it as a standalone DLL and place it in a plugin directory.

This class and its methods will fully integrate the plugin in to vrq. Note not all methods are abstract. For methods where reasonable defaults make sense, a default implementation is defined. If a different behavior is desired the subclass should override the default virtual method.

Note: Plugins should directly store information about the switches they support in the protected instance variables: switches and switchDescription.


Member Function Documentation

virtual int CBackend::AcceptAllPlusArgs ( void   )  [inline, virtual]

Override this method if the plugin accepts arbitrary plusargs: ie +argName[=argValue] or +argName[+argValue].

Returns:
true if all plus args are allowed. Default method disallows plusargs.
virtual void CBackend::Activate (  )  [pure virtual]

Method to initialize the plugin.

This method will be called once before tool is invoked.

virtual const char* CBackend::GetSwitchDescription ( const char *  sw  )  [inline, virtual]

Method to get the help text for a switch using the switch name as a key.

Generally this method need not be overriden.

Parameters:
sw pointer to switch.
Returns:
description of switch.
virtual list<string>& CBackend::GetSwitches ( void   )  [inline, virtual]

Access method for list of switches.

Generally this method need not be overridden.

Returns:
list of switches.
virtual char* CBackend::GetToolDescription ( void   )  [pure virtual]

Access method for tool description use in vrq help.

Returns:
pointer containing the description of tool
virtual char* CBackend::GetToolName ( void   )  [pure virtual]

map of switch to its description

Access method for tool name

Returns:
pointer containing the name of the tool
virtual int CBackend::HideTool (  )  [inline, virtual]

Method to control if plugin should be hidden, in this case it will not appear in the help but will it still be possible to invoke it.

This is useful for development of plugins that care currently unstable. Note: the default behavior is to make the plugin visible.

Returns:
TRUE if plugin should be hidden.
virtual int CBackend::IgnoreVrqComments (  )  [inline, virtual]

Method to control how parser handles vrq comment based pragmas: ie // vrq translate_on/off Note: the default behavior is to not ignore vrq comment based pragmas.

Returns:
TRUE if vrq translate on/off comments should be treated like normal comments. If FALSE code bracketed by // vrq translate_off and //vrq translate_on will handled as if it is a comment.
virtual void CBackend::Process ( list< CElement > &  inputList,
list< CElement > &  outputList 
) [pure virtual]

Method to implement plugin function.

Input list is processed and output list is generated. Dimensions of input list must be > 0. Dimensions of output list must be >= 0. Input and output list dimensions need not match. This method may terminate processing early by throwing an exception that is a subclass of CBackendException. Note throwing an exeception and exiting normally is equivilent to throwing a CBackendExit.

Parameters:
inputList a list of compilation units to process.
outputList a list of compilation units processed.
virtual void CBackend::RegisterSwitch ( const char *  switchName,
const char *  description 
) [inline, virtual]

Method shortcut to register tool switches with vrq's help system.

Parameters:
switchName switch string
description switch description used for help text.
virtual int CBackend::ResolveInstance ( CModule module,
CInstance inst 
) [pure virtual]

Method to control the resolution of individual module instances.

Parameters:
module to the module that contains the instance.
inst pointer to the instance to be resolved.
Returns:
true if the instance should be resolved prior to tool running.
virtual int CBackend::ResolveModules (  )  [pure virtual]

Method to control if plugin requires all module definitions to be searched for and found.

returns true if tool requires all module definitions to be resolved.


Member Data Documentation

map<string,string> CBackend::switchDescription [protected]

list of plugin command line switches

list<string> CBackend::switches [protected]

The documentation for this class was generated from the following file: