WsParser_VS/libParse/parse_novel.h

94 lines
3.1 KiB
C
Raw Normal View History

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 01:18:33 +00:00
virtual QString name() const override {
return u8"FragmentExistsCheck";
}
2024-03-17 07:58:28 +00:00
};
class StorySortHelper;
class FragmentSortHelper;
class LIBPARSE_EXPORT FragmentOrdersCheck : public lib_parse::CheckProvider {
protected:
QList<std::shared_ptr<StorySortHelper>> stories_list;
void elements_link_build(const QList<std::shared_ptr<StorySortHelper>>& stories);
void sort_cycle_check(const QList<std::shared_ptr<FragmentSortHelper>>& tracks, std::shared_ptr<FragmentSortHelper> current,
int story_sort_source);
2024-05-04 15:34:21 +00:00
std::shared_ptr<FragmentSortHelper> peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n) const;
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 01:18:33 +00:00
virtual QString name() const override {
return u8"FragmentOrdersCheck";
}
2024-03-17 07:58:28 +00:00
};
/**
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
class LIBPARSE_EXPORT FragmentSortHelper : public std::enable_shared_from_this<FragmentSortHelper> {
public:
enum class Type {
REFER, ELEMENT
};
FragmentSortHelper(std::shared_ptr<const ast_gen::ElementAccess> node_bind, int story_sort);
Type nodeType() const;
std::shared_ptr<const ast_gen::ElementAccess> nodeBind() const;
int storySort() const;
std::shared_ptr<FragmentSortHelper> next() const;
void attachNext(std::shared_ptr<FragmentSortHelper> fragment);
void assignSibling(std::shared_ptr<FragmentSortHelper> other);
QList<std::shared_ptr<FragmentSortHelper>> siblings() const;
private:
Type type_marks;
int story_sort;
std::shared_ptr<const ast_gen::ElementAccess> element_bind;
std::shared_ptr<FragmentSortHelper> next_attachment;
QList<std::shared_ptr<FragmentSortHelper>> siblings_store;
};
/**
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
class LIBPARSE_EXPORT StorySortHelper {
private:
std::shared_ptr<const ast_gen::ElementAccess> story_bind;
std::shared_ptr<FragmentSortHelper> fragments_bind;
public:
StorySortHelper(std::shared_ptr<const ast_gen::ElementAccess> story_bind);
std::shared_ptr<const example_novel::StoryDefine> storyElement() const;
QString storyName() const;
int sortValue() const;
std::shared_ptr<FragmentSortHelper> fragmentSort() const;
void attachFragmentSort(std::shared_ptr<FragmentSortHelper> refer);
std::shared_ptr<FragmentSortHelper> fragment(const QString& name) const;
};
} // namespace example_novel