characterClasses().setNameClass(alpha,alpha+"0123456789.:");
QString oc=characterClasses().operatorClass();
characterClasses().setOperatorClass(oc.remove('.').remove(':'));
+ characterClasses().setAssignmentChars('\0','=');
if(!characterClasses().isConsistent())
qDebug()<<"Warning: built-in calculator is inconsistent.";
//load default engines
BoolEngine::configureBoolEngine(*this);
BoolEngine::configureLogicEngine(*this);
StringEngine::configureStringEngine(*this);
+ configureReflection(*this);
//add money class
setFunction("toMoney",toMoneyFuncLoc);
setFunction("toMoneyLocal",toMoneyFuncLoc);
setFunction("unix2date",unix2DateFunc);
setFunction("unix2time",unix2TimeFunc);
setFunction("unix2datetime",unix2DateTimeFunc);
+ //legacy functions for ODF renderer
+ setFunction("cent2str",[](const QList<QVariant>&args,Engine&)->QVariant{
+ if(args.size()!=1)
+ return Exception(Exception::ArgumentListError,"expected one argument to cent2str");
+ else
+ return cent2str(args[0].toInt());
+ });
+ setFunction("str2cent",[](const QList<QVariant>&args,Engine&)->QVariant{
+ if(args.size()!=1)
+ return Exception(Exception::ArgumentListError,"expected one argument to str2cent");
+ else
+ return str2cent(args[0].toString());
+ });
//register casts for nullable
setAutoCast(qMetaTypeId<qlonglong>(),
QList<int>()
$$PWD/waitcursor.h \
$$PWD/sclock.h \
$$PWD/formula.h \
- $$PWD/msengine.h \
$$PWD/dommodel.h
SOURCES += \
$$PWD/waitcursor.cpp \
$$PWD/sclock.cpp \
$$PWD/formula.cpp \
- $$PWD/msengine.cpp \
$$PWD/dommodel.cpp
INCLUDEPATH += $$PWD
+++ /dev/null
-//
-// C++ Implementation: MSmoke ELAM Engine
-//
-//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2012
-//
-// Copyright: See README/COPYING.GPL files that come with this distribution
-//
-//
-
-#include "msengine.h"
-
-#include "misc.h"
-
-#include <ELAM/IntEngine>
-#include <ELAM/BoolEngine>
-#include <ELAM/FloatEngine>
-#include <ELAM/StringEngine>
-
-
-using namespace ELAM;
-
-MSEngine::MSEngine(QObject* parent)
- :Engine(parent)
-{
- IntEngine::configureIntEngine(*this);
- StringEngine::configureStringEngine(*this);
- BoolEngine::configureBoolEngine(*this);
- BoolEngine::configureLogicEngine(*this);
- FloatEngine::configureFloatEngine(*this);
- configureReflection(*this);
- setFunction("cent2str",[](const QList<QVariant>&args,Engine&)->QVariant{
- if(args.size()!=1)
- return Exception(Exception::ArgumentListError,"expected one argument to cent2str");
- else
- return cent2str(args[0].toInt());
- });
- setFunction("str2cent",[](const QList<QVariant>&args,Engine&)->QVariant{
- if(args.size()!=1)
- return Exception(Exception::ArgumentListError,"expected one argument to str2cent");
- else
- return str2cent(args[0].toString());
- });
- setFunction("unix2time",[](const QList<QVariant>&args,Engine&)->QVariant{
- if(args.size()!=1)
- return Exception(Exception::ArgumentListError,"expected one argument to unix2time");
- else
- return unix2time(args[0].toInt());
- });
- setFunction("unix2date",[](const QList<QVariant>&args,Engine&)->QVariant{
- if(args.size()!=1)
- return Exception(Exception::ArgumentListError,"expected one argument to unix2date");
- else
- return unix2date(args[0].toInt());
- });
- setFunction("unix2dateTime",[](const QList<QVariant>&args,Engine&)->QVariant{
- if(args.size()!=1)
- return Exception(Exception::ArgumentListError,"expected one argument to unix2dateTime");
- else
- return unix2dateTime(args[0].toInt());
- });
-}
-
-void MSEngine::enableLoopVars()
-{
- CharacterClassSettings ccs=characterClasses();
- //simplify assignment
- ccs.setAssignmentChars('\0','=');
- //remove :. from operators
- QString str=ccs.operatorClass();
- str.remove(':');str.remove('.');
- ccs.setOperatorClass(str);
- //add :. to variables
- QPair<QString,QString>nc=ccs.nameClass();
- if(!nc.second.contains(':'))nc.second+=":";
- if(!nc.second.contains('.'))nc.second+=".";
- ccs.setNameClass(nc);
-}
+++ /dev/null
-//
-// C++ Interface: MSmoke Elam Engine with specialized functions
-//
-//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2012
-//
-// Copyright: See README/COPYING.GPL files that come with this distribution
-//
-//
-
-#ifndef MAGICSMOKE_MSENGINE_H
-#define MAGICSMOKE_MSENGINE_H
-
-#include <ELAM/Engine>
-
-///convenience ELAM engine that comes preconfigured for all types and with special MSmoke functions
-class MSEngine:public ELAM::Engine
-{
- public:
- ///instantiate the engine
- explicit MSEngine(QObject*parent=0);
-
- ///moves the ":." chars from the operator class to the variable class to enable the
- ///loop variable syntax, assignment becomes a simple "="
- void enableLoopVars();
-};
-
-#endif
#include <Unzip>
#include <Zip>
-#include "msengine.h"
+#include "formula.h"
using namespace ELAM;
-class MOdfEngine:public MSEngine
+class MOdfEngine:public MElamEngine
{
MOdtRenderer*parent;
public:
if(parent->getVariable(v).isValid())
return true;
else
- return MSEngine::hasConstant(v);
+ return MElamEngine::hasConstant(v);
}
QVariant getConstant(QString v)const
{
if(vv.isValid())
return vv;
else
- return MSEngine::getConstant(v);
+ return MElamEngine::getConstant(v);
}
};