# Ogre::ScriptCompilerListener Class Reference

This is a listener for the compiler. More...

`#include <OgreScriptCompiler.h>`

Inheritance diagram for Ogre::ScriptCompilerListener:

[legend]

List of all members.

## Public Member Functions

| ScriptCompilerListener ()
virtual | ~ScriptCompilerListener ()
virtual ConcreteNodeListPtr | importFile (ScriptCompiler *compiler, const String &name)
| Returns the concrete node list from the given file.
virtual void | preConversion (ScriptCompiler *compiler, ConcreteNodeListPtr nodes)
| Allows for responding to and overriding behavior before a CST is translated into an AST.
virtual bool | postConversion (ScriptCompiler *compiler, const AbstractNodeListPtr &)
| Allows vetoing of continued compilation after the entire AST conversion process finishes.
virtual void | handleError (ScriptCompiler *compiler, uint32 code, const String &file, int line, const String &msg)
| Called when an error occurred.
virtual bool | handleEvent (ScriptCompiler *compiler, const String &name, const std::vector< Ogre::Any > &args, Ogre::Any *retval)
| Called when an event occurs during translation, return true if handled.
virtual Ogre::Any | createObject (ScriptCompiler *compiler, const String &type, const std::vector< Ogre::Any > &args)
| Called when a translator requests a concrete object to be created.

## Detailed Description

This is a listener for the compiler.

The compiler can be customized with this listener. It lets you listen in on events occuring during compilation, hook them, and change the behavior.

Definition at line 319 of file OgreScriptCompiler.h.

## Constructor & Destructor Documentation

Ogre::ScriptCompilerListener::ScriptCompilerListener | ( |  | ) |

virtual Ogre::ScriptCompilerListener::~ScriptCompilerListener | ( |  | ) | `[virtual]`

Definition at line 323 of file OgreScriptCompiler.h.

## Member Function Documentation

virtual ConcreteNodeListPtr Ogre::ScriptCompilerListener::importFile | ( | ScriptCompiler * | compiler,
|  | const String & | name |
| ) |  |  | `[virtual]`

Returns the concrete node list from the given file.

virtual void Ogre::ScriptCompilerListener::preConversion | ( | ScriptCompiler * | compiler,
|  | ConcreteNodeListPtr | nodes |
| ) |  |  | `[virtual]`

Allows for responding to and overriding behavior before a CST is translated into an AST.

virtual bool Ogre::ScriptCompilerListener::postConversion | ( | ScriptCompiler * | compiler,
|  | const AbstractNodeListPtr & |  |
| ) |  |  | `[virtual]`

Allows vetoing of continued compilation after the entire AST conversion process finishes.

Remarks:
  Once the script is turned completely into an AST, including import and override handling, this function allows a listener to exit the compilation process.

Returns:
  True continues compilation, false aborts

virtual void Ogre::ScriptCompilerListener::handleError | ( | ScriptCompiler * | compiler,
|  | uint32 | code,
|  | const String & | file,
|  | int | line,
|  | const String & | msg |
| ) |  |  | `[virtual]`

Called when an error occurred.

virtual bool Ogre::ScriptCompilerListener::handleEvent | ( | ScriptCompiler * | compiler,
|  | const String & | name,
|  | const std::vector< Ogre::Any > & | args,
|  | Ogre::Any * | retval |
| ) |  |  | `[virtual]`

Called when an event occurs during translation, return true if handled.

Remarks:
  This function is called from the translators when an event occurs that that can be responded to. Often this is overriding names. The support events are: preApplyTextureAliases - Allows overriding texture aliases before they are set arg1 is a Material* arg2 is an AliasTextureNamePairList* holding the aliases processTextureNames - Allows overriding referenced textures arg1 is a String* arg2 is the size of the array No return value processMaterialName - Allows overriding referenced materials arg1 is a single String* No return value processGpuProgramName - Allows overriding referenced gpu programs arg1 is a single String* No return value processNameExclusion - Allows forcing a name exclusion arg1 is a String of the node object's class ("material", "particle_system", etc.) arg2 is an AbstractNode* which is the object's parent No return value
  - compiler A reference to the compiler
  - name The name of the event
  - args The vector of argument for the event
  - retval A possible return value from handlers

Returns:
  True if the handler processed the event

virtual Ogre::Any Ogre::ScriptCompilerListener::createObject | ( | ScriptCompiler * | compiler,
|  | const String & | type,
|  | const std::vector< Ogre::Any > & | args |
| ) |  |  | `[virtual]`

Called when a translator requests a concrete object to be created.

Remarks:
  This function is called when a translator needs to create an Ogre object during comilation. If a valid object is returned from this function it is used instead of a default object created from Ogre's resource managers. The object types are: Material arg1 is a string holding the file where the object is compiled from arg2 is the name for the material specified in the script file arg3 is the resource group of the compiling script file GpuProgram arg1 is a string holding the file where the object is compiled from arg2 is the name for the material specified in the script file arg3 is the resource group of the compiling script file arg4 is the specified source file arg5 is the GpuProgramType arg6 is the program's syntax code UnifiedGpuProgram arg1 is a string holding the file where the object is compiled from arg2 is the name for the material specified in the script file arg3 is the resource group of the compiling script file arg4 is the GpuProgramType HighLevelGpuProgram arg1 is a string holding the file where the object is compiled from arg2 is the name for the material specified in the script file arg3 is the resource group of the compiling script file arg4 is the specified language arg5 is the GpuProgramType arg6 is the specified source file ParticleSystem arg1 is a string holding the file where the object is compiled from arg2 is the name for the material specified in the script file arg3 is the resource group of the compiling script file Compositor arg1 is a string holding the file where the object is compiled from arg2 is the name for the material specified in the script file arg3 is the resource group of the compiling script file
  - compiler A reference to the compiler
  - type The type of the requested object
  - args Creation arguments for the object

Returns:
  A reference (pointer) to the created object wrapped in an Any

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

- OgreScriptCompiler.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Dec 27 17:35:29 2009