- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document
C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+
Build status: BUILD_RTI=OFF successful (0 errors, warnings only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
71 lines
1.9 KiB
C++
71 lines
1.9 KiB
C++
#include <QtCore/QCoreApplication>
|
|
#include <QtCore/QDebug>
|
|
#include <QtCore/QDir>
|
|
#include <grantlee/engine.h>
|
|
#include <grantlee/templateloader.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
QCoreApplication app(argc, argv);
|
|
|
|
QString templatesDir = QDir::currentPath();
|
|
if (argc > 1)
|
|
{
|
|
templatesDir = QString::fromLocal8Bit(argv[1]);
|
|
}
|
|
|
|
Grantlee::Engine engine;
|
|
auto loader = QSharedPointer<Grantlee::FileSystemTemplateLoader>::create();
|
|
loader->setTemplateDirs(QStringList() << templatesDir);
|
|
engine.addTemplateLoader(loader);
|
|
|
|
QDir d(templatesDir);
|
|
QStringList files = d.entryList(QStringList() << QStringLiteral("*.grantlee"), QDir::Files);
|
|
if (files.isEmpty())
|
|
{
|
|
qDebug() << "No .grantlee templates found in" << templatesDir;
|
|
// Treat absence as successful parse (nothing to check) to avoid failing
|
|
// when directory is empty in different setups.
|
|
return 0;
|
|
}
|
|
|
|
bool ok = true;
|
|
for (const QString& f : files)
|
|
{
|
|
Grantlee::Template t;
|
|
try
|
|
{
|
|
t = engine.loadByName(f);
|
|
}
|
|
catch (...)
|
|
{
|
|
qDebug() << "Exception while loading" << f;
|
|
ok = false;
|
|
continue;
|
|
}
|
|
if (!t)
|
|
{
|
|
qDebug() << "Failed to load template" << f;
|
|
ok = false;
|
|
continue;
|
|
}
|
|
if (t->error() != Grantlee::NoError)
|
|
{
|
|
qDebug() << "Parse error in" << f << ":" << t->errorString();
|
|
ok = false;
|
|
continue;
|
|
}
|
|
// Render with empty context to ensure rendering path also works.
|
|
Grantlee::Context ctx;
|
|
QString out = t->render(&ctx);
|
|
if (out.isNull())
|
|
{
|
|
qDebug() << "Rendering produced null for" << f;
|
|
ok = false;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
return ok ? 0 : 2;
|
|
}
|