Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files) - Formatted LtsAppDescriptor module files - Formatted LtsAppManager/AppChooser files - Applied clang-format to all DTC and enum headers across modules - Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/) Cosmetic changes only, no functional modifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
848 files changed
+89305
-100020
No files matched your search
Executable → Regular
+144
-120
@@ -2,11 +2,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QStringList>
|
||||
#include <QSharedPointer>
|
||||
#include "StructBuilder.h"
|
||||
#include "codegen_base_export.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <QStringList>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
@@ -23,152 +24,175 @@ class XmlReader;
|
||||
|
||||
class CODEGEN_BASE_EXPORT SqlGenerator final
|
||||
{
|
||||
public:
|
||||
struct SqlStatements
|
||||
{
|
||||
QStringList dropViews;
|
||||
QStringList dropTables;
|
||||
QStringList dropSequences;
|
||||
QStringList dropConstraints;
|
||||
|
||||
QStringList createTables;
|
||||
QStringList createSequences;
|
||||
QStringList createPrimaryKeys;
|
||||
QStringList createForeignKeys;
|
||||
QStringList createViews;
|
||||
QStringList createConstraints;
|
||||
|
||||
QStringList enumerationValues;
|
||||
QStringList dbFunctions;
|
||||
QStringList dbFunctionTrigger;
|
||||
|
||||
bool isEmpty() const
|
||||
public:
|
||||
struct SqlStatements
|
||||
{
|
||||
return dropViews.isEmpty() && dropTables.isEmpty() && dropSequences.isEmpty() && dropConstraints.isEmpty();
|
||||
QStringList dropViews;
|
||||
QStringList dropTables;
|
||||
QStringList dropSequences;
|
||||
QStringList dropConstraints;
|
||||
|
||||
QStringList createTables;
|
||||
QStringList createSequences;
|
||||
QStringList createPrimaryKeys;
|
||||
QStringList createForeignKeys;
|
||||
QStringList createViews;
|
||||
QStringList createConstraints;
|
||||
|
||||
QStringList enumerationValues;
|
||||
QStringList dbFunctions;
|
||||
QStringList dbFunctionTrigger;
|
||||
|
||||
bool isEmpty() const
|
||||
{
|
||||
return dropViews.isEmpty() && dropTables.isEmpty() && dropSequences.isEmpty() && dropConstraints.isEmpty();
|
||||
}
|
||||
};
|
||||
|
||||
struct SqlItems
|
||||
{
|
||||
QStringList tables;
|
||||
QStringList sequences;
|
||||
QStringList primaryKeys;
|
||||
QStringList foreignKeys;
|
||||
QStringList constraints;
|
||||
};
|
||||
|
||||
public:
|
||||
Q_DISABLE_COPY(SqlGenerator)
|
||||
|
||||
explicit SqlGenerator(XmlReader* xmlReader, StructBuilder* structBuilder);
|
||||
explicit SqlGenerator(const QString& xmlFile);
|
||||
|
||||
~SqlGenerator();
|
||||
|
||||
bool isValid() const
|
||||
{
|
||||
return m_isValid;
|
||||
}
|
||||
};
|
||||
|
||||
struct SqlItems
|
||||
{
|
||||
QStringList tables;
|
||||
QStringList sequences;
|
||||
QStringList primaryKeys;
|
||||
QStringList foreignKeys;
|
||||
QStringList constraints;
|
||||
};
|
||||
bool generateData(int exerciseId);
|
||||
|
||||
public:
|
||||
Q_DISABLE_COPY(SqlGenerator)
|
||||
bool createStatementsForTable(const QString& tableName, const QString& tableNameOut);
|
||||
|
||||
explicit SqlGenerator(XmlReader *xmlReader, StructBuilder *structBuilder);
|
||||
explicit SqlGenerator(const QString &xmlFile);
|
||||
SqlStatements getStatements(ExerciseDependency ed) const
|
||||
{
|
||||
return (ed == ExerciseDependency::Exercise ? m_sqlExercise : m_sqlGlobal);
|
||||
}
|
||||
|
||||
~SqlGenerator();
|
||||
SqlItems getSqlItems(ExerciseDependency ed) const
|
||||
{
|
||||
return (ed == ExerciseDependency::Exercise ? m_sqlItemsExercise : m_sqlItemsGlobal);
|
||||
}
|
||||
|
||||
bool isValid() const { return m_isValid; }
|
||||
|
||||
bool generateData(int exerciseId);
|
||||
QStringList getEnumerationInsertValues(const QString& table, const QString& dbSchema) const;
|
||||
|
||||
bool createStatementsForTable(const QString &tableName, const QString &tableNameOut);
|
||||
QStringList getReferencedServices() const
|
||||
{
|
||||
return m_referencedSevices;
|
||||
}
|
||||
|
||||
SqlStatements getStatements(ExerciseDependency ed) const
|
||||
{
|
||||
return (ed == ExerciseDependency::Exercise ? m_sqlExercise : m_sqlGlobal);
|
||||
}
|
||||
QStringList getDbSettings(const QString& dbSchema) const;
|
||||
|
||||
SqlItems getSqlItems(ExerciseDependency ed) const
|
||||
{
|
||||
return (ed == ExerciseDependency::Exercise ? m_sqlItemsExercise : m_sqlItemsGlobal);
|
||||
}
|
||||
bool writeSql(const QString& filePath, ExerciseDependency ed);
|
||||
|
||||
QStringList getEnumerationInsertValues(const QString &table, const QString &dbSchema) const;
|
||||
QStringList getReferencedServices() const
|
||||
{
|
||||
return m_referencedSevices;
|
||||
}
|
||||
bool writeSqlToFile(const QString& dbSchema, const QString& sqlFile, ExerciseDependency ed) const;
|
||||
|
||||
QStringList getDbSettings(const QString &dbSchema) const;
|
||||
QString getServiceAbbr() const
|
||||
{
|
||||
return m_xmlReader->getServiceAbbr();
|
||||
}
|
||||
|
||||
|
||||
bool writeSql(const QString &filePath, ExerciseDependency ed);
|
||||
bool isServiceExerciseIndependent() const
|
||||
{
|
||||
return m_xmlReader->isServiceExerciseIndependent();
|
||||
}
|
||||
|
||||
bool writeSqlToFile(const QString &dbSchema, const QString &sqlFile, ExerciseDependency ed) const;
|
||||
bool isServiceGlobal() const
|
||||
{
|
||||
return (m_xmlReader->defaultExerciseDependency() == CodeGen::ExerciseDependency::Global ||
|
||||
m_xmlReader->defaultExerciseDependency() == CodeGen::ExerciseDependency::GlobalAndExercise);
|
||||
}
|
||||
|
||||
|
||||
QString getServiceAbbr() const { return m_xmlReader->getServiceAbbr(); }
|
||||
bool isServiceExerciseIndependent() const { return m_xmlReader->isServiceExerciseIndependent(); }
|
||||
bool isServiceGlobal() const { return (m_xmlReader->defaultExerciseDependency() == CodeGen::ExerciseDependency::Global || m_xmlReader->defaultExerciseDependency() == CodeGen::ExerciseDependency::GlobalAndExercise); }
|
||||
CodeGen::ExerciseDependency getExerciseDependency() const { return m_xmlReader->defaultExerciseDependency();}
|
||||
QStringList getGroupNames() const { return m_xmlReader->getGroupNames(); }
|
||||
CodeGen::ExerciseDependency getExerciseDependency() const
|
||||
{
|
||||
return m_xmlReader->defaultExerciseDependency();
|
||||
}
|
||||
|
||||
QStringList getAllSqlStmts(const QString &dbSchema, ExerciseDependency ed) const;
|
||||
QStringList getGroupNames() const
|
||||
{
|
||||
return m_xmlReader->getGroupNames();
|
||||
}
|
||||
|
||||
QStringList getAllSqlStmts(const QString& dbSchema, ExerciseDependency ed) const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
NGL::INGLLogger& m_logger;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
bool handleTables();
|
||||
bool handleViews();
|
||||
bool handleTable(const CompleteTableInformation &cti);
|
||||
bool handleView(const ViewInformation &vi);
|
||||
QString getTableColumnCreateStatements(const QString &tableName,
|
||||
const QVector<MemberInformation> &columns,
|
||||
QStringList *tableComments, ExerciseDependency ed);
|
||||
QString generateSequence(const QString &tableName, const FullQualifiedColumnInformation &ci, ExerciseDependency ed);
|
||||
void generatePrimaryKey(const QString &tableName, const FullQualifiedColumnInformation &ci, ExerciseDependency ed);
|
||||
void generateForeignKeys(const QVector<QSharedPointer<ForeignKeyInformation> > &foreignKeys, ExerciseDependency ed);
|
||||
void generateForeignKey(const QSharedPointer<ForeignKeyInformation> &foreignKey, ExerciseDependency ed);
|
||||
void generateConstraints(const QString &tableName, const QVector<ConstraintInformation> &constraints, ExerciseDependency ed);
|
||||
void generateConstraint(const QString &tableName, const ConstraintInformation &constraint, ExerciseDependency ed);
|
||||
bool handleEnumerations();
|
||||
bool handleEnumeration(const EnumInformation &ei);
|
||||
QStringList handleEnumeration(const EnumInformation &ei, const QString &dbSchema) const;
|
||||
bool generateDbNotifications(const QString &tableName, const QVector<DbNotifcationInformation> ¬ifications, ExerciseDependency ed);
|
||||
void generateDbNotification(const DbNotifcationInformation ¬ification, ExerciseDependency ed);
|
||||
bool generateDbNotificationTrigger(const QString &tableName, const DbNotifcationInformation ¬ification, ExerciseDependency ed);
|
||||
QString getNotificationFunctionName(const DbNotifcationInformation ¬ification) const;
|
||||
static QString fixupComment(const QString &comment);
|
||||
private:
|
||||
bool handleTables();
|
||||
bool handleViews();
|
||||
bool handleTable(const CompleteTableInformation& cti);
|
||||
bool handleView(const ViewInformation& vi);
|
||||
QString getTableColumnCreateStatements(const QString& tableName, const QVector<MemberInformation>& columns,
|
||||
QStringList* tableComments, ExerciseDependency ed);
|
||||
QString generateSequence(const QString& tableName, const FullQualifiedColumnInformation& ci, ExerciseDependency ed);
|
||||
void generatePrimaryKey(const QString& tableName, const FullQualifiedColumnInformation& ci, ExerciseDependency ed);
|
||||
void generateForeignKeys(const QVector<QSharedPointer<ForeignKeyInformation>>& foreignKeys, ExerciseDependency ed);
|
||||
void generateForeignKey(const QSharedPointer<ForeignKeyInformation>& foreignKey, ExerciseDependency ed);
|
||||
void generateConstraints(const QString& tableName, const QVector<ConstraintInformation>& constraints,
|
||||
ExerciseDependency ed);
|
||||
void generateConstraint(const QString& tableName, const ConstraintInformation& constraint, ExerciseDependency ed);
|
||||
bool handleEnumerations();
|
||||
bool handleEnumeration(const EnumInformation& ei);
|
||||
QStringList handleEnumeration(const EnumInformation& ei, const QString& dbSchema) const;
|
||||
bool generateDbNotifications(const QString& tableName, const QVector<DbNotifcationInformation>& notifications,
|
||||
ExerciseDependency ed);
|
||||
void generateDbNotification(const DbNotifcationInformation& notification, ExerciseDependency ed);
|
||||
bool generateDbNotificationTrigger(const QString& tableName, const DbNotifcationInformation& notification,
|
||||
ExerciseDependency ed);
|
||||
QString getNotificationFunctionName(const DbNotifcationInformation& notification) const;
|
||||
static QString fixupComment(const QString& comment);
|
||||
|
||||
private:
|
||||
XmlReader *m_xmlReader;
|
||||
StructBuilder *m_structBuilder;
|
||||
bool m_createdByXmlFile;
|
||||
private:
|
||||
XmlReader* m_xmlReader;
|
||||
StructBuilder* m_structBuilder;
|
||||
bool m_createdByXmlFile;
|
||||
|
||||
void addToDropSequences(const QString &stmt, ExerciseDependency ed);
|
||||
void addToDropTables(const QString &stmt, ExerciseDependency ed);
|
||||
void addToDropViews(const QString &stmt, ExerciseDependency ed);
|
||||
void addToDropConstraints(const QString &stmt, ExerciseDependency ed);
|
||||
void addToDropSequences(const QString& stmt, ExerciseDependency ed);
|
||||
void addToDropTables(const QString& stmt, ExerciseDependency ed);
|
||||
void addToDropViews(const QString& stmt, ExerciseDependency ed);
|
||||
void addToDropConstraints(const QString& stmt, ExerciseDependency ed);
|
||||
|
||||
void addToCreateConstraints(const QString &stmt, ExerciseDependency ed);
|
||||
void addToCreateFks(const QString &stmt, ExerciseDependency ed);
|
||||
void addToCreatePks(const QString &stmt, ExerciseDependency ed);
|
||||
void addToCreateSequences(const QString &stmt, ExerciseDependency ed);
|
||||
void addToCreateTables(const QString &stmt, ExerciseDependency ed);
|
||||
void addToCreateTables(const QStringList &stmts, ExerciseDependency ed);
|
||||
void addToCreateViews(const QString &stmt, ExerciseDependency ed);
|
||||
void addToCreateConstraints(const QString& stmt, ExerciseDependency ed);
|
||||
void addToCreateFks(const QString& stmt, ExerciseDependency ed);
|
||||
void addToCreatePks(const QString& stmt, ExerciseDependency ed);
|
||||
void addToCreateSequences(const QString& stmt, ExerciseDependency ed);
|
||||
void addToCreateTables(const QString& stmt, ExerciseDependency ed);
|
||||
void addToCreateTables(const QStringList& stmts, ExerciseDependency ed);
|
||||
void addToCreateViews(const QString& stmt, ExerciseDependency ed);
|
||||
|
||||
void addToDbFunctions(const QString &stmt, ExerciseDependency ed);
|
||||
void addToDbFunctionTrigger(const QString &stmt, ExerciseDependency ed);
|
||||
void addToDbFunctions(const QString& stmt, ExerciseDependency ed);
|
||||
void addToDbFunctionTrigger(const QString& stmt, ExerciseDependency ed);
|
||||
|
||||
void addToConstraints(const QString &name, ExerciseDependency ed);
|
||||
void addToFks(const QString &name, ExerciseDependency ed);
|
||||
void addToPks(const QString &name, ExerciseDependency ed);
|
||||
void addToSequences(const QString &name, ExerciseDependency ed);
|
||||
void addToTables(const QString &name, ExerciseDependency ed);
|
||||
void addToConstraints(const QString& name, ExerciseDependency ed);
|
||||
void addToFks(const QString& name, ExerciseDependency ed);
|
||||
void addToPks(const QString& name, ExerciseDependency ed);
|
||||
void addToSequences(const QString& name, ExerciseDependency ed);
|
||||
void addToTables(const QString& name, ExerciseDependency ed);
|
||||
|
||||
bool writeFile(const QString &fn, const QString &content) const;
|
||||
bool writeFile(const QString& fn, const QString& content) const;
|
||||
|
||||
SqlStatements m_sqlGlobal;
|
||||
SqlStatements m_sqlExercise;
|
||||
SqlStatements m_sqlGlobal;
|
||||
SqlStatements m_sqlExercise;
|
||||
|
||||
SqlItems m_sqlItemsGlobal;
|
||||
SqlItems m_sqlItemsExercise;
|
||||
SqlItems m_sqlItemsGlobal;
|
||||
SqlItems m_sqlItemsExercise;
|
||||
|
||||
QStringList m_referencedSevices;
|
||||
QStringList m_referencedSevices;
|
||||
|
||||
bool m_isValid;
|
||||
int m_exerciseId;
|
||||
bool m_isValid;
|
||||
int m_exerciseId;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace CodeGen
|
||||
Reference in new issue
Block a user