Provides the basic methods for a code generator system including access to a building engine (Smarty), assignment of data, ability to build dynamic template paths and names and an options system for extended properties.
All generators extend from this base class and implement whatever additional logic is required to build the component.
Generated content can be stored in the internal array $_GeneratedContent how this is indexed is up to the generator class. It might be classname class data, or path and class data depending on requirements.
public __construct([$inOptions = array()])
Creates a new generator object
public initialise()
Performs custom initialisation on the object
public buildDataSource()
Acquires external data required for building objects
public abstract build()
Builds the code from the specified data
public reset()
Resets the object
public isModified()
Returns true if object has been modified
public setModified([$status = true])
Set the status of the object if it has been changed
public getGeneratorName()
Returns $_GeneratorName
public setGeneratorName($inGeneratorName)
Set $_GeneratorName to $inGeneratorName
public getEngine()
Returns $_Engine
public setEngine($inEngine)
Set $_Engine to $inEngine
public getDataSources()
Returns $_DataSources
public addDataSource($inValue, [$inKey = null])
Adds a data source with an optional key name - Note the order: VALUE first
public hasDataSources()
Returns true if there are data sources to process
public setDataSources($inDataSources)
Set $_DataSources to $inDataSources
public getGeneratedContent()
Returns $_GeneratedContent
public addGeneratedContent($inValue, [$inKey = null])
Adds generated content to the internal array, note the order: VALUE first
public hasGeneratedContent()
Returns true if there is generated content in the class
public setGeneratedContent($inGeneratedContent)
Set $_GeneratedContent to $inGeneratedContent
public getTemplateFile($inTemplate)
Returns the full path to $inTemplate, resolving the name and path as appropriate
protected _doesTemplateFileExistInPaths($inTemplate)
Returns the full path to the template, or false if not found in either user or default templates
protected _getTemplateFile($inTemplate)
Returns the full path to the template, or false if not found in either user or default templates
protected _resolveUserTemplateName($inTemplate)
Resolves the user template name by appending or prepending the name with specific attributes for the generator e.g. a site name or version
protected _resolveDefaultTemplateName($inTemplate)
Resolves the default template name by appending or prepending the name with specific attributes for the generator e.g. a site name or version
protected _findTemplate($inTemplate)
Performs whatever steps necessary to locate a template for the current generator. This method requires an implementation e.g. site lookup etc.
public getTemplateDir()
Returns $_TemplateDir
public setTemplateDir($inTemplateDir)
Set $_TemplateDir to $inTemplateDir
public getUserTemplateDir()
Returns $_UserTemplateDir
public setUserTemplateDir($inTemplateDir)
Set $_UserTemplateDir to $inTemplateDir
public getPackage()
Returns $_Package
public setPackage($inPackage)
Set $_Package to $inPackage
public getSubPackage()
Returns $_SubPackage
public setSubPackage($inSubPackage)
Set $_SubPackage to $inSubPackage
public getCategory()
Returns $_Category
public setCategory($inCategory)
Set $_Category to $inCategory
public getTemplate()
Returns the name of the template to be used during generation
public getUserTemplate()
Returns the name of the user specified template
public getDefaultTemplate()
Returns the name of the default specified template
public setTemplate($inTemplate)
Set the user specified template name
public getOptionsSet()
Returns the options set object, creating it if not set
public setOptionsSet($inOptions)
Sets the options object externally
Posted by: Scorpio Documentor (Writer), in Generator on 19 Nov 2009 @ 20:30
Tags: generator, generatorbase,
This
work is licenced under a
Creative Commons Licence.