0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

Finish 1.5.86

This commit is contained in:
Arin Alexander 2021-05-24 22:38:15 +03:00
commit 04c3a5a37f
3 changed files with 19 additions and 18 deletions

View File

@ -126,7 +126,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 85
LIMEREPORT_VERSION_RELEASE = 86
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -488,9 +488,9 @@ QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue,
return context;
}
QString ScriptEngineManager::replaceScripts(QString context, QVariant &varValue, QObject *reportItem, ScriptEngineType* se, ScriptNode *scriptTree)
QString ScriptEngineManager::replaceScripts(QString context, QVariant &varValue, QObject *reportItem, ScriptEngineType* se, ScriptNode::Ptr scriptTree)
{
foreach(ScriptNode* item, scriptTree->children()){
foreach(ScriptNode::Ptr item, scriptTree->children()){
QString scriptBody = expandDataFields(item->body(), EscapeSymbols, varValue, reportItem);
if (item->children().size() > 0)
scriptBody = replaceScripts(scriptBody, varValue, reportItem, se, item);
@ -529,7 +529,7 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){
ScriptExtractor scriptExtractor(script);
if (scriptExtractor.parse()){
QString scriptBody = expandDataFields(scriptExtractor.scriptTree()[0].body(), EscapeSymbols, varValue, 0);
QString scriptBody = expandDataFields(scriptExtractor.scriptTree()->body(), EscapeSymbols, varValue, 0);
scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue);
ScriptValueType value = se->evaluate(scriptBody);
#ifdef USE_QJSENGINE
@ -987,7 +987,7 @@ bool ScriptExtractor::parse()
return m_scriptTree->children().count() > 0;
}
bool ScriptExtractor::parse(int &curPos, const State& state, ScriptNode* scriptNode)
bool ScriptExtractor::parse(int &curPos, const State& state, ScriptNode::Ptr scriptNode)
{
while (curPos<m_context.length()){
switch (state) {
@ -1014,7 +1014,7 @@ bool ScriptExtractor::parse(int &curPos, const State& state, ScriptNode* scriptN
return false;
}
void ScriptExtractor::extractScript(int &curPos, const QString& startStr, ScriptNode* scriptNode)
void ScriptExtractor::extractScript(int &curPos, const QString& startStr, ScriptNode::Ptr scriptNode)
{
int startPos = curPos;
if (extractBracket(curPos, scriptNode)){
@ -1034,7 +1034,7 @@ void ScriptExtractor::skipField(int &curPos){
}
}
bool ScriptExtractor::extractBracket(int &curPos, ScriptNode* scriptNode)
bool ScriptExtractor::extractBracket(int &curPos, ScriptNode::Ptr scriptNode)
{
curPos++;
return parse(curPos,OpenBracketFound, scriptNode);

View File

@ -400,18 +400,19 @@ private:
class ScriptNode{
public:
typedef QSharedPointer<ScriptNode> Ptr;
QString body(){return m_body;}
void setBody(const QString& body){ m_body = body;}
void setStartLex(const QString startLex){ m_startLex = startLex;}
QString script(){return m_startLex + m_body + '}';}
ScriptNode* createChildNode(){
ScriptNode* result = new ScriptNode();
Ptr createChildNode(){
Ptr result = Ptr(new ScriptNode());
m_children.append(result);
return result;
}
QVector<ScriptNode*> children() const {return m_children;}
QVector<Ptr> children() const {return m_children;}
private:
QVector<ScriptNode*> m_children;
QVector<Ptr> m_children;
QString m_body;
QString m_startLex;
};
@ -421,22 +422,22 @@ class ScriptExtractor
public:
enum State{None,BuksFound,SFound,StartScriptFound,OpenBracketFound,CloseBracketFound,DFound,VFound, SignFound};
explicit ScriptExtractor(const QString& value):
m_context(value), m_scriptTree(new ScriptNode()){}
m_context(value), m_scriptTree(ScriptNode::Ptr(new ScriptNode())){}
bool parse();
ScriptNode* scriptTree(){return m_scriptTree;}
ScriptNode::Ptr scriptTree(){return m_scriptTree;}
private:
bool isStartLexem(int &curPos, QChar value);
bool parse(int& curPos, const State &state, ScriptNode *scriptNode);
bool parse(int& curPos, const State &state, ScriptNode::Ptr scriptNode);
void skipField(int &curPos);
void extractScript(int& curPos, const QString &startStr, ScriptNode *scriptNode);
bool extractBracket(int& curPos, ScriptNode *scriptNode);
void extractScript(int& curPos, const QString &startStr, ScriptNode::Ptr scriptNode);
bool extractBracket(int& curPos, ScriptNode::Ptr scriptNode);
bool isStartScriptLexem(int &curPos);
bool isStartFieldLexem(int &curPos);
bool isStartVariableLexem(int &curPos);
QString substring(const QString& value, int start, int end);
private:
QString m_context;
ScriptNode* m_scriptTree;
ScriptNode::Ptr m_scriptTree;
};
class ScriptEngineManager : public QObject, public Singleton<ScriptEngineManager>, public IScriptEngineManager
@ -467,7 +468,7 @@ public:
QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem);
QString expandScripts(QString context, QVariant &varValue, QObject* reportItem);
QString replaceScripts(QString context, QVariant& varValue, QObject *reportItem, ScriptEngineType *se, ScriptNode* scriptTree);
QString replaceScripts(QString context, QVariant& varValue, QObject *reportItem, ScriptEngineType *se, ScriptNode::Ptr scriptTree);
QVariant evaluateScript(const QString &script);
void addBookMark(const QString &uniqKey, const QString &content);