55 lines
1.9 KiB
C++
55 lines
1.9 KiB
C++
#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:
|
|
// ͨ¹ý CheckProvider ¼Ì³Ð
|
|
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const override;
|
|
virtual QString name() const override;
|
|
};
|
|
|
|
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;
|
|
|
|
public:
|
|
void setElement(std::shared_ptr<FragmentGraphHelper> inst);
|
|
std::shared_ptr<FragmentGraphHelper> getElement(const QString &signature) const;
|
|
|
|
QList<std::shared_ptr<FragmentGraphHelper>> getHangoutNodes();
|
|
bool nodeDismantle(std::shared_ptr<FragmentGraphHelper> inst);
|
|
|
|
// CheckProvider interface
|
|
public:
|
|
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const override;
|
|
virtual QString name() const override;
|
|
};
|
|
|
|
class FragmentGraphHelper : public std::enable_shared_from_this<FragmentGraphHelper> {
|
|
private:
|
|
std::shared_ptr<const example_novel::FragmentDefine> node_peer;
|
|
QList<std::shared_ptr<FragmentGraphHelper>> next_nodes;
|
|
uint indegree = 0;
|
|
|
|
public:
|
|
FragmentGraphHelper(std::shared_ptr<const example_novel::FragmentDefine> node);
|
|
|
|
std::shared_ptr<const example_novel::FragmentDefine> nodePeer() const;
|
|
|
|
void appendNext(std::shared_ptr<FragmentGraphHelper> node);
|
|
QList<std::shared_ptr<FragmentGraphHelper>> nextList() const;
|
|
|
|
uint& inDegree();
|
|
};
|
|
|
|
|
|
} // namespace example_novel
|