WsParser_VS/StoryPresent/storyline_compare.h

42 lines
1.0 KiB
C++

#pragma once
#include "xast_parse.h"
#include <QHash>
namespace compare {
enum class Type {
UpstreamAlter,
FragmentAlter
};
class Compare {
private:
QHash<QString, std::shared_ptr<xast_parse::StoryDefine>> _graph_base;
public:
explicit Compare(const QHash<QString, std::shared_ptr<xast_parse::StoryDefine>>& graph);
const QHash<QString, std::shared_ptr<xast_parse::StoryDefine>> &graphBind() const;
QList<std::shared_ptr<xast_parse::PointDefines>> changeCompare(Type type,
const QHash<QString, std::shared_ptr<xast_parse::StoryDefine>>& g_old) const;
private:
/*
* @brief 情节相关内容比较
* @param a 本情节
* @param b 旧情节
* @return true-有变更
*/
bool fragment_check(std::shared_ptr<xast_parse::PointDefines> a, std::shared_ptr<xast_parse::PointDefines> b) const;
/*
* @brief 情节上游内容比较
* @param a 本情节
* @param b 旧情节
* @return true-有变更
*/
bool upstream_check(std::shared_ptr<xast_parse::IElementSlice> a, std::shared_ptr<xast_parse::IElementSlice> b) const;
};
}