2021-08-05 23:13:21 +08:00
|
|
|
#ifndef STATEMENTMODEL_H
|
|
|
|
#define STATEMENTMODEL_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2021-08-08 17:22:37 +08:00
|
|
|
#include <QTextStream>
|
2021-08-13 11:18:42 +08:00
|
|
|
#include "parserutils.h"
|
2021-08-05 23:13:21 +08:00
|
|
|
|
|
|
|
class StatementModel : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit StatementModel(QObject *parent = nullptr);
|
|
|
|
|
2021-08-07 14:08:51 +08:00
|
|
|
void add(PStatement statement);
|
|
|
|
// function DeleteFirst: Integer;
|
|
|
|
// function DeleteLast: Integer;
|
|
|
|
void deleteStatement(PStatement statement);
|
2021-08-24 15:05:10 +08:00
|
|
|
const StatementMap& childrenStatements(PStatement statement = PStatement()) const;
|
|
|
|
const StatementMap& childrenStatements(std::weak_ptr<Statement> statement) const;
|
2021-08-07 14:08:51 +08:00
|
|
|
void clear();
|
2021-08-08 17:22:37 +08:00
|
|
|
void dump(const QString& logFile);
|
2021-08-05 23:13:21 +08:00
|
|
|
|
2021-08-07 14:08:51 +08:00
|
|
|
signals:
|
2021-08-07 18:02:57 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
void addMember(StatementMap& map, PStatement statement);
|
|
|
|
int deleteMember(StatementMap& map, PStatement statement);
|
2021-08-08 17:22:37 +08:00
|
|
|
void dumpStatementMap(StatementMap& map, QTextStream& out, int level);
|
2021-08-07 14:08:51 +08:00
|
|
|
private:
|
|
|
|
int mCount;
|
|
|
|
StatementMap mGlobalStatements; //may have overloaded functions, so use PStatementList to store
|
2021-08-05 23:13:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // STATEMENTMODEL_H
|