GemaLib
The GeMA library
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GmSharedCodeLoader Class Reference

Auxiliary class responsible for loading shared code information from a Lua table. More...

#include <gmSharedCodeLoader.h>

Collaboration diagram for GmSharedCodeLoader:
Collaboration graph
[legend]

Public Member Functions

 GmSharedCodeLoader (const GmLogCategory &logger, GmSimulationData *simData, const QStringList &pluginDataAliases)
 Constructor. Receives as a parameters the logger object that will be used to emmit messages, the simulation data object and the list of registered plugin data aliases.
 
 ~GmSharedCodeLoader ()
 Destructor.
 
bool load (LuaTable &sharedCodeData)
 Loads shared code block data from the Lua table received as a parameter. More...
 

Private Member Functions

bool loadFileCode (QString fileName, const QVector< QPair< int, int > > &blockList, QString &code)
 Loads shared blocks / function definitions from the given file, appending the data to code. Returns false on errors.
 
QString removePrefix (QString line, bool isImplicit) const
 Removes data from the line before the block start.
 
int findParPos (QString line, bool isImplicit) const
 Finds the position in string where the SharedCodeEnd/NodeFunction/CellFunction/pluginObject tag ends and its parameter begins.
 
QString removeComments (QString line) const
 Remove comments from the line. Only handles line comments (– ones), not block comments.
 
QStringList readParameter (GmSharedCodeLoaderReadBuffer &b, QString line) const
 Reads and returns the text for a function parameter list, either enclosed in () or {}, starting at line but possibly continuing in other lines. We do assume that the code is well formed.
 

Private Attributes

const GmLogCategory_logger
 Reference to the logger object used to emmit messages.
 
GmSimulationData_simData
 Simulation data object.
 
QStringList _implicitBlockNames
 The list with names that implicitely start a shared block.
 

Detailed Description

Auxiliary class responsible for loading shared code information from a Lua table.

Member Function Documentation

◆ load()

bool GmSharedCodeLoader::load ( LuaTable sharedCodeData)

Loads shared code block data from the Lua table received as a parameter.

The results table contains all subtables that where created by the SharedCodeBegin() and SharedCodeEnd() lua functions in simulationLoader.lua.

Returns false if any errors, uncought by the Lua functions, where found.

This should really be impossible since the original files where already parsed and found to be ok, unless a file is removed after the first parse and before this call, or in case of very weird syntax constructions using long strings or long comments...


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