vrq
Public Member Functions | Protected Attributes | List of all members
CBackend Class Referenceabstract

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

#include <cbackend.h>

Public Member Functions

virtual char * GetToolName (void)=0
 map of switch to its description More...
 
virtual char * GetToolDescription (void)=0
 Access method for tool description use in vrq help. More...
 
virtual int AcceptAllPlusArgs (void)
 Override this method if the plugin accepts arbitrary plusargs: ie +argName[=argValue] or +argName[+argValue]. More...
 
virtual list< string > & GetSwitches (void)
 Access method for list of switches. More...
 
virtual const char * GetSwitchDescription (const char *sw)
 Method to get the help text for a switch using the switch name as a key. More...
 
virtual void RegisterSwitch (const char *switchName, const char *description)
 Method shortcut to register tool switches with vrq's help system. More...
 
virtual int RequireModuleResolution ()
 Method to control if plugin requires all module definitions to be resolved. More...
 
virtual int ResolveModules ()=0
 Method to control if plugin enables all module definitions to be searched for returns true if tool enables module definitions to be resolved. More...
 
virtual int ResolveInstance (CModule *module, CInstance *inst)=0
 Method to control the resolution of individual module instances. More...
 
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. More...
 
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. More...
 
virtual void Activate ()=0
 Method to initialize the plugin. More...
 
virtual void Logfile (FILE *logfile)
 Pass current open logfile to plugin. More...
 
virtual void Process (list< CElement > &inputList, list< CElement > &outputList)=0
 Method to implement plugin function. More...
 

Protected Attributes

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

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

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

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

Generally this method need not be overriden.

Parameters
swpointer to switch.
Returns
description of switch.
virtual list<string>& CBackend::GetSwitches ( void  )
inlinevirtual

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 ( )
inlinevirtual

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 ( )
inlinevirtual

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::Logfile ( FILE *  logfile)
inlinevirtual

Pass current open logfile to plugin.

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
inputLista list of compilation units to process.
outputLista list of compilation units processed.
virtual void CBackend::RegisterSwitch ( const char *  switchName,
const char *  description 
)
inlinevirtual

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

Parameters
switchNameswitch string
descriptionswitch description used for help text.
virtual int CBackend::RequireModuleResolution ( )
inlinevirtual

Method to control if plugin requires all module definitions to be resolved.

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

virtual int CBackend::ResolveInstance ( CModule module,
CInstance inst 
)
pure virtual

Method to control the resolution of individual module instances.

Parameters
moduleto the module that contains the instance.
instpointer 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 enables all module definitions to be searched for returns true if tool enables 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: