GemaLib
The GeMA library
Loading...
Searching...
No Matches
gmSharedCodeLoader.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_SHARED_CODE_LOADER_H_
25#define _GEMA_SHARED_CODE_LOADER_H_
26
27class GmLogCategory;
29
30class LuaTable;
31class QString;
33
34#include <QVector>
35#include <QStringList>
36
39{
40public:
41 GmSharedCodeLoader(const GmLogCategory& logger, GmSimulationData* simData,
42 const QStringList& pluginDataAliases);
44
45 bool load(LuaTable& sharedCodeData);
46
47private:
48 bool loadFileCode(QString fileName, const QVector<QPair<int, int> >& blockList, QString& code);
49
50 QString removePrefix (QString line, bool isImplicit) const;
51 int findParPos (QString line, bool isImplicit) const;
52 QString removeComments(QString line) const;
54
58};
59
60#endif
61
Auxiliary class responsible for loading shared code information from a Lua table.
Definition gmSharedCodeLoader.h:39
QStringList _implicitBlockNames
The list with names that implicitely start a shared block.
Definition gmSharedCodeLoader.h:57
bool load(LuaTable &sharedCodeData)
Loads shared code block data from the Lua table received as a parameter.
Definition gmSharedCodeLoader.cpp:163
int findParPos(QString line, bool isImplicit) const
Finds the position in string where the SharedCodeEnd/NodeFunction/CellFunction/pluginObject tag ends ...
Definition gmSharedCodeLoader.cpp:299
~GmSharedCodeLoader()
Destructor.
Definition gmSharedCodeLoader.cpp:145
QString removeComments(QString line) const
Remove comments from the line. Only handles line comments (– ones), not block comments.
Definition gmSharedCodeLoader.cpp:327
QStringList readParameter(GmSharedCodeLoaderReadBuffer &b, QString line) const
Reads and returns the text for a function parameter list, either enclosed in () or {}...
Definition gmSharedCodeLoader.cpp:360
const GmLogCategory & _logger
Reference to the logger object used to emmit messages.
Definition gmSharedCodeLoader.h:55
QString removePrefix(QString line, bool isImplicit) const
Removes data from the line before the block start.
Definition gmSharedCodeLoader.cpp:275
GmSharedCodeLoader(const GmLogCategory &logger, GmSimulationData *simData, const QStringList &pluginDataAliases)
Constructor. Receives as a parameters the logger object that will be used to emmit messages,...
Definition gmSharedCodeLoader.cpp:131
GmSimulationData * _simData
Simulation data object.
Definition gmSharedCodeLoader.h:56
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....
Definition gmSharedCodeLoader.cpp:213
An auxiliar class to implement a simple form of look ahead while reading file data.
Definition gmSharedCodeLoader.cpp:44