2024-03-17 07:58:28 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "libparse.h"
|
|
|
|
|
#include <ast_novel.h>
|
|
|
|
|
|
|
|
|
|
namespace example_novel {
|
|
|
|
|
|
|
|
|
|
class LIBPARSE_EXPORT FragmentExistsCheck : public lib_parse::CheckProvider {
|
|
|
|
|
private:
|
|
|
|
|
void exists_check(std::shared_ptr<const ast_gen::GlobalElement> root, std::shared_ptr<const ast_gen::ElementAccess> target) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// ͨ<><CDA8> CheckProvider <20>̳<EFBFBD>
|
|
|
|
|
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const override;
|
2024-06-15 08:09:19 +00:00
|
|
|
|
virtual QString name() const override;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-06-15 08:09:19 +00:00
|
|
|
|
class FragmentGraphHelper;
|
|
|
|
|
class LIBPARSE_EXPORT FragmentGraphCheck : public std::enable_shared_from_this<FragmentGraphCheck>, public lib_parse::CheckProvider {
|
|
|
|
|
private:
|
|
|
|
|
QHash<QString, std::shared_ptr<FragmentGraphHelper>> elements_store;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2024-06-15 08:52:16 +00:00
|
|
|
|
QList<std::shared_ptr<FragmentGraphHelper>> refers_cycle_check(
|
|
|
|
|
std::shared_ptr<FragmentGraphHelper> item, QList<std::shared_ptr<FragmentGraphHelper>> prevs = QList<std::shared_ptr<FragmentGraphHelper>>()) const;
|
|
|
|
|
|
2024-06-15 08:09:19 +00:00
|
|
|
|
public:
|
|
|
|
|
void setElement(std::shared_ptr<FragmentGraphHelper> inst);
|
|
|
|
|
std::shared_ptr<FragmentGraphHelper> getElement(const QString &signature) const;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2024-06-15 08:09:19 +00:00
|
|
|
|
QList<std::shared_ptr<FragmentGraphHelper>> getHangoutNodes();
|
|
|
|
|
bool nodeDismantle(std::shared_ptr<FragmentGraphHelper> inst);
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
|
|
|
|
// CheckProvider interface
|
|
|
|
|
public:
|
|
|
|
|
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const override;
|
2024-06-15 08:09:19 +00:00
|
|
|
|
virtual QString name() const override;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-06-15 08:09:19 +00:00
|
|
|
|
class FragmentGraphHelper : public std::enable_shared_from_this<FragmentGraphHelper> {
|
2024-03-17 07:58:28 +00:00
|
|
|
|
private:
|
2024-06-15 08:09:19 +00:00
|
|
|
|
std::shared_ptr<const example_novel::FragmentDefine> node_peer;
|
|
|
|
|
QList<std::shared_ptr<FragmentGraphHelper>> next_nodes;
|
|
|
|
|
uint indegree = 0;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2024-06-15 08:09:19 +00:00
|
|
|
|
FragmentGraphHelper(std::shared_ptr<const example_novel::FragmentDefine> node);
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<const example_novel::FragmentDefine> nodePeer() const;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2024-06-15 08:09:19 +00:00
|
|
|
|
void appendNext(std::shared_ptr<FragmentGraphHelper> node);
|
|
|
|
|
QList<std::shared_ptr<FragmentGraphHelper>> nextList() const;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2024-06-15 08:09:19 +00:00
|
|
|
|
uint& inDegree();
|
2024-03-17 07:58:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace example_novel
|