This is an example of how to use the inheriters of the KDSME::AbstractExporter class.
#include "config-examples.h"
#include <QTextStream>
namespace {
void doOutput(QTextStream &qOut, const QByteArray &output)
{
qOut << output << Qt::endl;
}
}
{
QTextStream qErr(stderr);
QTextStream qOut(stdout);
machine.
setLabel(QStringLiteral(
"root"));
s1.setLabel(QStringLiteral("s1"));
s2.setLabel(QStringLiteral("s2"));
s1.addSignalTransition(&s2);
QByteArray qmlOutput;
if (!qmlExporter.exportMachine(&machine)) {
qErr << "Failed to export to QML:" << qmlExporter.errorString();
return 1;
}
doOutput(qOut, "=== Output [QML] ===");
doOutput(qOut, qmlOutput);
doOutput(qOut, {});
QByteArray scxmlOutput;
if (!scxmlExporter.exportMachine(&machine)) {
qErr << "Failed to export to SCXML:" << scxmlExporter.errorString();
return 1;
}
doOutput(qOut, "=== Output [SCXML] ===");
doOutput(qOut, scxmlOutput);
doOutput(qOut, {});
}
void setLabel(const QString &label)
int main(int argc, char **argv)