7#include "scriptfunction.h"
12ScriptFunction::ScriptFunction(
const QString &name,
const QString &desc,
bool clockfcn,
const QString &at1,
19 ClockFunction = clockfcn;
22 ArgDBusType[0] = DBusType(at1);
25 ArgDBusType[1] = DBusType(at2);
28 ArgDBusType[2] = DBusType(at3);
31 ArgDBusType[3] = DBusType(at4);
34 ArgDBusType[4] = DBusType(at5);
37 ArgDBusType[5] = DBusType(at6);
41 QString nameStyle =
"<span style=\"font-family:monospace;font-weight:600\">%1</span>";
42 QString typeStyle =
"<span style=\"font-family:monospace;color:#009d00\">%1</span>";
43 QString paramStyle =
"<span style=\"font-family:monospace;color:#00007f\">%1</span>";
45 Description =
"<html><head><meta name=\"qrichtext\" content=\"1\" /></head>";
46 Description +=
"<body style=\"font-size:11pt;font-family:sans\">";
113 Description = sf->description();
114 ClockFunction = sf->isClockFunction();
115 NumArgs = sf->numArgs();
116 INDIProp = sf->INDIProperty();
119 for (
unsigned int i = 0; i < 6; i++)
121 ArgType[i] = sf->argType(i);
122 ArgName[i] = sf->argName(i);
123 ArgDBusType[i] = sf->argDBusType(i);
126 ArgVal[i] = sf->argVal(i);
134 else if (type ==
QString(
"uint"))
136 else if (type ==
QString(
"double"))
138 else if (type ==
QString(
"QString"))
140 else if (type ==
QString(
"bool"))
146QString ScriptFunction::prototype()
const
151 if (!ArgType[0].isEmpty() && !ArgName[0].isEmpty())
153 p +=
' ' + ArgType[0];
154 p +=
' ' + ArgName[0];
158 if (!ArgType[1].isEmpty() && !ArgName[1].isEmpty())
160 p +=
", " + ArgType[1];
161 p +=
' ' + ArgName[1];
164 if (!ArgType[2].isEmpty() && !ArgName[2].isEmpty())
166 p +=
", " + ArgType[2];
167 p +=
' ' + ArgName[2];
170 if (!ArgType[3].isEmpty() && !ArgName[3].isEmpty())
172 p +=
", " + ArgType[3];
173 p +=
' ' + ArgName[3];
176 if (!ArgType[4].isEmpty() && !ArgName[4].isEmpty())
178 p +=
", " + ArgType[4];
179 p +=
' ' + ArgName[4];
182 if (!ArgType[5].isEmpty() && !ArgName[5].isEmpty())
184 p +=
", " + ArgType[5];
185 p +=
' ' + ArgName[5];
195QString ScriptFunction::scriptLine()
const
200 while (i < 6 && !ArgName[i].isEmpty())
204 if (ArgDBusType[i] ==
"string")
212 if (value.
at(0) !=
'\"' && value.
at(0) !=
'\'')
214 value =
'\"' + value;
216 if (value.
right(1) !=
"\"" && value.
right(1) !=
"\'")
218 value = value +
'\"';
224 out +=
' ' + ArgDBusType[i] +
':' + value;
QString name(GameStandardAction id)
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
QString arg(Args &&... args) const const
const QChar at(qsizetype position) const const
bool isEmpty() const const
QString right(qsizetype n) const const