重构,功能聚集
This commit is contained in:
parent
0ca56d9906
commit
c0051e4ab8
|
|
@ -36,22 +36,21 @@ int main(int argc, char *argv[])
|
|||
// auto retlist = frame.analysis(&doc, "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyboard");
|
||||
|
||||
|
||||
ParseCore core;
|
||||
MakeTools::StoryTool tool(&core);
|
||||
MakeTools::StoryTool tool;
|
||||
|
||||
// auto path = "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyvolume";
|
||||
auto path = "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyunit";
|
||||
tool.compile(QFileInfo(path), "后台编译");
|
||||
|
||||
auto doc = core.queryDocument(QFileInfo(path));
|
||||
auto retlist = core.queryRootNodes(doc);
|
||||
auto doc = tool.getCore()->queryDocument(QFileInfo(path));
|
||||
auto retlist = doc->syntaxNodes();
|
||||
for (auto x : qAsConst(retlist)) {
|
||||
qDebug().noquote() << x->toString();
|
||||
}
|
||||
|
||||
QList<ErrorMessage> errors;
|
||||
if(!tool.checkPass(errors))
|
||||
for(auto x : errors)
|
||||
for(auto &x : errors)
|
||||
qDebug() << QString("%1, %2, %3, %4, %5").arg(x.Reason).arg(x.Text).arg(x.FilePath).arg(x.CodeRow).arg(x.CodeCol);
|
||||
|
||||
return a.exec();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,188 @@
|
|||
#include "DocsManager.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QTextStream>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace MakeTools;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
DocsManager::DocsManager(StoryTool *tool, AppCore *host, MainWindow *views)
|
||||
: host_core(host), views_holder(views), make_core(tool)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DocsManager::saveAll() const
|
||||
{
|
||||
for(auto &it : sourcecode_map)
|
||||
it->save();
|
||||
for(auto &it : plaintext_map)
|
||||
it->save();
|
||||
}
|
||||
|
||||
void DocsManager::closeAll()
|
||||
{
|
||||
for(auto &it : sourcecode_map.keys())
|
||||
closeTextComponent(QFileInfo(it));
|
||||
|
||||
for(auto &it : plaintext_map.keys())
|
||||
closeTextComponent(QFileInfo(it));
|
||||
|
||||
host_core->getMakeCore()->getCore()->clear();
|
||||
}
|
||||
|
||||
bool DocsManager::contains(const QFileInfo &target) const
|
||||
{
|
||||
for(auto &it : sourcecode_map.keys())
|
||||
if(it == target.absoluteFilePath())
|
||||
return true;
|
||||
for(auto &it : plaintext_map.keys())
|
||||
if(it == target.absoluteFilePath())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
TextView *DocsManager::queryTextComponent(const QWidget *child_view) const
|
||||
{
|
||||
for(auto ins : sourcecode_map)
|
||||
if(ins->textView() == child_view)
|
||||
return ins;
|
||||
for(auto ins : plaintext_map)
|
||||
if(ins->textView() == child_view)
|
||||
return ins;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TextView *DocsManager::queryTextComponent(const QFileInfo &target) const
|
||||
{
|
||||
for(auto &it : sourcecode_map.keys())
|
||||
if(it == target.absoluteFilePath())
|
||||
return sourcecode_map[it];
|
||||
for(auto &it : plaintext_map.keys())
|
||||
if(it == target.absoluteFilePath())
|
||||
return plaintext_map[it];
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DocsManager::closeTextComponent(const QFileInfo &target)
|
||||
{
|
||||
auto key = target.absoluteFilePath();
|
||||
|
||||
if(sourcecode_map.contains(key)){
|
||||
sourcecode_map[key]->save();
|
||||
delete sourcecode_map[key];
|
||||
sourcecode_map.remove(key);
|
||||
}
|
||||
else if(plaintext_map.contains(key)){
|
||||
plaintext_map[key]->save();
|
||||
delete plaintext_map[key];
|
||||
plaintext_map.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
void DocsManager::openTextDocument(const QString &src, const QString &name)
|
||||
{
|
||||
auto xfactorys = host_core->extensions(QFileInfo(src).suffix());
|
||||
if(contains(src)){
|
||||
auto ins = queryTextComponent(QFileInfo(src));
|
||||
|
||||
dynamic_cast<Core::Extension*>(ins)->reloadConfigrations(host_core->getConfigs(xfactorys[0]->configs()));
|
||||
views_holder->contentViewAppend(ins->textView(), name);
|
||||
return;
|
||||
}
|
||||
|
||||
make_core->compile(QFileInfo(src), name);
|
||||
|
||||
TextView *tview = dynamic_cast<TextView*>(xfactorys[0]->newInstance(host_core));
|
||||
tview->initSource(host_core, QFileInfo(src), name, views_holder);
|
||||
addPerceptionList(tview);
|
||||
|
||||
dynamic_cast<Core::Extension*>(tview)->resetProcsType(QFileInfo(src).suffix());
|
||||
dynamic_cast<Core::Extension*>(tview)->reloadConfigrations(host_core->getConfigs(xfactorys[0]->configs()));
|
||||
|
||||
QFile fin(src);
|
||||
if(!fin.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
QMessageBox::critical(views_holder, "系统错误", QString("无法打开指定文件:%1(%2)").arg(name, src));
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream tin(&fin);
|
||||
tview->textContentReset(tin.readAll());
|
||||
|
||||
views_holder->contentViewAppend(tview->textView(), name);
|
||||
}
|
||||
|
||||
void DocsManager::addPerceptionList(TextView *ins, SensitiveType type)
|
||||
{
|
||||
if(type == SensitiveType::CompileAtChanged){
|
||||
connect(ins, &TextView::dataChanged, [ins, this](const QString &path){
|
||||
this->recompile(path, ins->docName());
|
||||
});
|
||||
this->sourcecode_map[ins->absoluteFilePath()] = ins;
|
||||
}
|
||||
else{
|
||||
this->plaintext_map[ins->absoluteFilePath()] = ins;
|
||||
}
|
||||
}
|
||||
|
||||
void DocsManager::addProcTrigger(std::function<void ()> exc)
|
||||
{
|
||||
this->trigger_list << exc;
|
||||
}
|
||||
|
||||
void DocsManager::recompile(const QString &file_path, const QString &doc_name)
|
||||
{
|
||||
if(!sourcecode_map.contains(file_path))
|
||||
return;
|
||||
|
||||
auto view = this->sourcecode_map[file_path];
|
||||
make_core->compileSource(QFileInfo(file_path), view->textContent(), doc_name);
|
||||
|
||||
for(auto &ex : trigger_list)
|
||||
ex();
|
||||
}
|
||||
|
||||
TextView::TextView()
|
||||
: QObject(nullptr){}
|
||||
|
||||
void TextView::initSource(Core::AppCore *core, const QFileInfo &src, const QString &name, QWidget *parent)
|
||||
{
|
||||
this->doc_name = name;
|
||||
this->initSource(core, src, parent);
|
||||
}
|
||||
|
||||
QString TextView::absoluteFilePath() const
|
||||
{
|
||||
return source_x;
|
||||
}
|
||||
|
||||
void TextView::save() const
|
||||
{
|
||||
QFile bout(absoluteFilePath());
|
||||
if(!bout.open(QIODevice::WriteOnly|QIODevice::Text)){
|
||||
QMessageBox::critical(nullptr, "系统错误", absoluteFilePath()+"文件无法打开");
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream tout(&bout);
|
||||
tout << textContent();
|
||||
tout.flush();
|
||||
}
|
||||
|
||||
QString TextView::docName() const
|
||||
{
|
||||
return doc_name;
|
||||
}
|
||||
|
||||
void TextView::initSource(Core::AppCore *core, const QFileInfo &src, QWidget *parent)
|
||||
{
|
||||
this->source_x = src.absoluteFilePath();
|
||||
if(parent)
|
||||
this->setParent(parent);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SENSITIVECORE_H
|
||||
#define SENSITIVECORE_H
|
||||
#ifndef DOCSMANAGER_H
|
||||
#define DOCSMANAGER_H
|
||||
|
||||
#include "ContentPresent.h"
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ namespace MakeTools {
|
|||
|
||||
void initSource(Core::AppCore *core, const QFileInfo &src, const QString &name, QWidget *parent=nullptr);
|
||||
|
||||
QString filePath() const;
|
||||
QString absoluteFilePath() const;
|
||||
void save() const;
|
||||
|
||||
virtual void jumpTo(const QList<QString> &path) = 0;
|
||||
|
|
@ -50,7 +50,7 @@ namespace MakeTools {
|
|||
/**
|
||||
* @brief 自动编译管理框架
|
||||
*/
|
||||
class SensitiveCore : public QObject
|
||||
class DocsManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
@ -58,13 +58,15 @@ namespace MakeTools {
|
|||
* @brief 内容自动构建和管理核心
|
||||
* @param tool
|
||||
*/
|
||||
SensitiveCore(StoryTool *tool);
|
||||
DocsManager(StoryTool *tool, Core::AppCore *host, MainWindow *views);
|
||||
|
||||
/**
|
||||
* @brief 保存当前所有文档内容
|
||||
*/
|
||||
void saveAll() const;
|
||||
|
||||
void closeAll();
|
||||
|
||||
/**
|
||||
* @brief 文档打开状态查询
|
||||
* @param target
|
||||
|
|
@ -82,17 +84,26 @@ namespace MakeTools {
|
|||
* @param target
|
||||
* @return
|
||||
*/
|
||||
TextView * queryTextComponent(const QFileInfo &target) const;
|
||||
TextView *queryTextComponent(const QFileInfo &target) const;
|
||||
/**
|
||||
* @brief 关闭文档内存实例,关闭之前保存内容
|
||||
* @param target
|
||||
*/
|
||||
void closeTextComponent(const QFileInfo &target);
|
||||
|
||||
/**
|
||||
* @brief 打开指定路径的文档
|
||||
* @param src
|
||||
* @param name
|
||||
*/
|
||||
void openTextDocument(const QString &src, const QString &name);
|
||||
|
||||
void addPerceptionList(TextView *ins, SensitiveType type = SensitiveType::CompileAtChanged);
|
||||
void addProcTrigger(std::function<void()> exc);
|
||||
|
||||
private:
|
||||
Core::AppCore *const host_core;
|
||||
MainWindow *const views_holder;
|
||||
StoryTool *const make_core;
|
||||
QHash<QString, TextView*> sourcecode_map;
|
||||
QHash<QString, TextView*> plaintext_map;
|
||||
|
|
@ -102,4 +113,4 @@ namespace MakeTools {
|
|||
};
|
||||
}
|
||||
|
||||
#endif // SENSITIVECORE_H
|
||||
#endif // DOCSMANAGER_H
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
#include "SensitiveCore.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QTextStream>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace MakeTools;
|
||||
|
||||
SensitiveCore::SensitiveCore(StoryTool *tool)
|
||||
: make_core(tool)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SensitiveCore::saveAll() const
|
||||
{
|
||||
for(auto &it : sourcecode_map)
|
||||
it->save();
|
||||
for(auto &it : plaintext_map)
|
||||
it->save();
|
||||
}
|
||||
|
||||
bool SensitiveCore::contains(const QFileInfo &target) const
|
||||
{
|
||||
for(auto &it : sourcecode_map.keys())
|
||||
if(it == target.absoluteFilePath())
|
||||
return true;
|
||||
for(auto &it : plaintext_map.keys())
|
||||
if(it == target.absoluteFilePath())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
TextView *SensitiveCore::queryTextComponent(const QWidget *child_view) const
|
||||
{
|
||||
for(auto ins : sourcecode_map)
|
||||
if(ins->textView() == child_view)
|
||||
return ins;
|
||||
for(auto ins : plaintext_map)
|
||||
if(ins->textView() == child_view)
|
||||
return ins;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TextView *SensitiveCore::queryTextComponent(const QFileInfo &target) const
|
||||
{
|
||||
for(auto &it : sourcecode_map.keys())
|
||||
if(it == target.absoluteFilePath())
|
||||
return sourcecode_map[it];
|
||||
for(auto &it : plaintext_map.keys())
|
||||
if(it == target.absoluteFilePath())
|
||||
return plaintext_map[it];
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SensitiveCore::closeTextComponent(const QFileInfo &target)
|
||||
{
|
||||
|
||||
for(auto &it : sourcecode_map.keys()){
|
||||
if(it == target.absoluteFilePath()){
|
||||
sourcecode_map[it]->save();
|
||||
delete sourcecode_map[it];
|
||||
sourcecode_map.remove(it);
|
||||
}
|
||||
}
|
||||
for(auto &it : plaintext_map.keys())
|
||||
if(it == target.absoluteFilePath()){
|
||||
sourcecode_map[it]->save();
|
||||
delete sourcecode_map[it];
|
||||
sourcecode_map.remove(it);
|
||||
}
|
||||
}
|
||||
|
||||
void SensitiveCore::addPerceptionList(TextView *ins, SensitiveType type)
|
||||
{
|
||||
if(type == SensitiveType::CompileAtChanged){
|
||||
connect(ins, &TextView::dataChanged, [ins, this](const QString &path){
|
||||
this->recompile(path, ins->docName());
|
||||
});
|
||||
this->sourcecode_map[ins->filePath()] = ins;
|
||||
}
|
||||
else{
|
||||
this->plaintext_map[ins->filePath()] = ins;
|
||||
}
|
||||
}
|
||||
|
||||
void SensitiveCore::addProcTrigger(std::function<void ()> exc)
|
||||
{
|
||||
this->trigger_list << exc;
|
||||
}
|
||||
|
||||
void SensitiveCore::recompile(const QString &file_path, const QString &doc_name)
|
||||
{
|
||||
if(!sourcecode_map.contains(file_path))
|
||||
return;
|
||||
|
||||
auto view = this->sourcecode_map[file_path];
|
||||
make_core->compileSource(QFileInfo(file_path), view->textContent(), doc_name);
|
||||
|
||||
for(auto &ex : trigger_list)
|
||||
ex();
|
||||
}
|
||||
|
||||
TextView::TextView()
|
||||
: QObject(nullptr){}
|
||||
|
||||
void TextView::initSource(Core::AppCore *core, const QFileInfo &src, const QString &name, QWidget *parent)
|
||||
{
|
||||
this->doc_name = name;
|
||||
this->initSource(core, src, parent);
|
||||
}
|
||||
|
||||
QString TextView::filePath() const
|
||||
{
|
||||
return source_x;
|
||||
}
|
||||
|
||||
void TextView::save() const
|
||||
{
|
||||
QFile bout(filePath());
|
||||
if(!bout.open(QIODevice::WriteOnly|QIODevice::Text)){
|
||||
QMessageBox::critical(nullptr, "系统错误", filePath()+"文件无法打开");
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream tout(&bout);
|
||||
tout << textContent();
|
||||
tout.flush();
|
||||
}
|
||||
|
||||
QString TextView::docName() const
|
||||
{
|
||||
return doc_name;
|
||||
}
|
||||
|
||||
void TextView::initSource(Core::AppCore *core, const QFileInfo &src, QWidget *parent)
|
||||
{
|
||||
this->source_x = src.absoluteFilePath();
|
||||
if(parent)
|
||||
this->setParent(parent);
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ FormattedTextEdit::FormattedTextEdit()
|
|||
{
|
||||
ex_unit = [](QMenu*){};
|
||||
connect(edit_square, &QTextEdit::textChanged, [this](){
|
||||
emit this->dataChanged(this->filePath());
|
||||
emit this->dataChanged(this->absoluteFilePath());
|
||||
});
|
||||
|
||||
edit_square->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SOURCEEDITVIEW_H
|
||||
#define SOURCEEDITVIEW_H
|
||||
|
||||
#include "SensitiveCore.h"
|
||||
#include "DocsManager.h"
|
||||
#include "ContentPresent.h"
|
||||
#include <QSyntaxHighlighter>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ CONFIG += c++11
|
|||
|
||||
SOURCES += \
|
||||
ContentPresent.cpp \
|
||||
SensitiveCore.cpp \
|
||||
DocsManager.cpp \
|
||||
SourceEditView.cpp \
|
||||
appcore.cpp \
|
||||
fragmentsorderview.cpp \
|
||||
|
|
@ -32,7 +32,7 @@ SOURCES += \
|
|||
|
||||
HEADERS += \
|
||||
ContentPresent.h \
|
||||
SensitiveCore.h \
|
||||
DocsManager.h \
|
||||
SourceEditView.h \
|
||||
appcore.h \
|
||||
fragmentsorderview.h \
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "storyunitsourceedit.h"
|
||||
#include "storyboardsourceedit.h"
|
||||
#include "storyvolumesourceedit.h"
|
||||
#include "SensitiveCore.h"
|
||||
#include "DocsManager.h"
|
||||
#include "mainwindow.h"
|
||||
#include "sourcecodeeditor.h"
|
||||
|
||||
|
|
@ -21,9 +21,8 @@ using namespace MakeTools;
|
|||
AppCore::AppCore(MainWindow *win, QObject *parent)
|
||||
: QObject(parent), views_holder(win),
|
||||
global_config(new Config::XMLConfig(this)),
|
||||
parse_core(new ParseCore()),
|
||||
make_tool(new StoryTool(parse_core)),
|
||||
framework(new SensitiveCore(make_tool))
|
||||
makes_core(new StoryTool()),
|
||||
docs_manager(new DocsManager(makes_core, this, win))
|
||||
{
|
||||
global_config->loadFile(QDir(QApplication::applicationDirPath()).filePath(".software.xml"));
|
||||
extensions_list << new StoryChainSourceEditFactory()
|
||||
|
|
@ -70,7 +69,7 @@ QList<Config::Configration *> AppCore::getConfigs(QList<Scale> types) const
|
|||
|
||||
Parse::Result::ParseCore *AppCore::parseCore() const
|
||||
{
|
||||
return parse_core;
|
||||
return makes_core->getCore();
|
||||
}
|
||||
|
||||
QList<FileExtensionFactory *> AppCore::extensions(const QString &suffix) const
|
||||
|
|
@ -90,46 +89,14 @@ QList<FileExtensionFactory *> AppCore::extensions(const QString &suffix) const
|
|||
return rets;
|
||||
}
|
||||
|
||||
MakeTools::StoryTool *AppCore::getMake_tool() const
|
||||
MakeTools::StoryTool *AppCore::getMakeCore() const
|
||||
{
|
||||
return make_tool;
|
||||
return makes_core;
|
||||
}
|
||||
|
||||
MakeTools::SensitiveCore *AppCore::getFramework() const
|
||||
MakeTools::DocsManager *AppCore::getDocsManager() const
|
||||
{
|
||||
return framework;
|
||||
}
|
||||
|
||||
void AppCore::openTextDocument(const QString &src, const QString &name)
|
||||
{
|
||||
auto xfactorys = extensions(QFileInfo(src).suffix());
|
||||
if(framework->contains(src)){
|
||||
auto ins = framework->queryTextComponent(QFileInfo(src));
|
||||
|
||||
dynamic_cast<Core::Extension*>(ins)->reloadConfigrations(this->getConfigs(xfactorys[0]->configs()));
|
||||
views_holder->contentViewAppend(ins->textView(), name);
|
||||
return;
|
||||
}
|
||||
|
||||
this->make_tool->compile(QFileInfo(src), name);
|
||||
|
||||
TextView *tview = dynamic_cast<TextView*>(xfactorys[0]->newInstance(this));
|
||||
tview->initSource(this, QFileInfo(src), name, views_holder);
|
||||
framework->addPerceptionList(tview);
|
||||
|
||||
dynamic_cast<Extension*>(tview)->resetProcsType(QFileInfo(src).suffix());
|
||||
dynamic_cast<Core::Extension*>(tview)->reloadConfigrations(this->getConfigs(xfactorys[0]->configs()));
|
||||
|
||||
QFile fin(src);
|
||||
if(!fin.open(QIODevice::ReadOnly | QIODevice::Text)){
|
||||
QMessageBox::critical(views_holder, "系统错误", QString("无法打开指定文件:%1(%2)").arg(name, src));
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream tin(&fin);
|
||||
tview->textContentReset(tin.readAll());
|
||||
|
||||
views_holder->contentViewAppend(tview->textView(), name);
|
||||
return docs_manager;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class MainWindow;
|
|||
|
||||
namespace MakeTools {
|
||||
class StoryTool;
|
||||
class SensitiveCore;
|
||||
class DocsManager;
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
|
|
@ -104,14 +104,24 @@ namespace Core {
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief 软件内核类型
|
||||
*/
|
||||
class AppCore : public QObject
|
||||
{
|
||||
public:
|
||||
AppCore(MainWindow *win, QObject *parent = nullptr);
|
||||
virtual ~AppCore() = default;
|
||||
|
||||
/**
|
||||
* @brief 全局保存操作
|
||||
*/
|
||||
void save();
|
||||
|
||||
/**
|
||||
* @brief 全局配置端口
|
||||
* @return
|
||||
*/
|
||||
Config::Configration * globalConfig() const;
|
||||
|
||||
void setCurrentProject(Project::ProjectManager *project);
|
||||
|
|
@ -121,22 +131,18 @@ namespace Core {
|
|||
|
||||
QList<Core::FileExtensionFactory*> extensions(const QString &suffix = QString()) const;
|
||||
|
||||
MakeTools::StoryTool *getMake_tool() const;
|
||||
MakeTools::StoryTool *getMakeCore() const;
|
||||
|
||||
MakeTools::SensitiveCore *getFramework() const;
|
||||
|
||||
|
||||
void openTextDocument(const QString &src, const QString &name);
|
||||
MakeTools::DocsManager *getDocsManager() const;
|
||||
|
||||
private:
|
||||
MainWindow *const views_holder;
|
||||
Config::Configration *const global_config;
|
||||
Project::ProjectManager * current_project;
|
||||
QList<Core::FileExtensionFactory*> extensions_list;
|
||||
Parse::Result::ParseCore *const parse_core;
|
||||
|
||||
MakeTools::StoryTool *const make_tool;
|
||||
MakeTools::SensitiveCore *const framework;
|
||||
MakeTools::StoryTool *const makes_core;
|
||||
MakeTools::DocsManager *const docs_manager;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "fragmentsorderview.h"
|
||||
#include "SensitiveCore.h"
|
||||
#include "DocsManager.h"
|
||||
#include <comdef.h>
|
||||
#include <StoryUnitDocumentParser.h>
|
||||
#include <QVBoxLayout>
|
||||
|
|
@ -52,8 +52,8 @@ void FragmentsOrderView::double_click(const QModelIndex &index)
|
|||
|
||||
auto unit_ins = this->core_ins->parseCore()->queryStoryUnit(path[0]).first();
|
||||
auto unit_doc = unit_ins->doc();
|
||||
this->core_ins->openTextDocument(unit_doc->filePath(), unit_doc->docName());
|
||||
auto present = this->core_ins->getFramework()->queryTextComponent(QFileInfo(unit_doc->filePath()));
|
||||
this->core_ins->getDocsManager()->openTextDocument(unit_doc->filePath(), unit_doc->docName());
|
||||
auto present = this->core_ins->getDocsManager()->queryTextComponent(QFileInfo(unit_doc->filePath()));
|
||||
|
||||
if(path.size()){
|
||||
present->jumpTo(path);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
project_structure(new ProjectView(app_core, project_manager, this)),
|
||||
chains_view(new StoryChainsPresent(app_core, this)),
|
||||
units_view(new StoryUnitsPresent(app_core, this)),
|
||||
errors_present(new MessagePresent(app_core->getMake_tool(), this)),
|
||||
errors_present(new MessagePresent(app_core->getMakeCore(), this)),
|
||||
boards_view(new StoryBoardsPresent(app_core, this)),
|
||||
concept_view(new StoryConceptsPresent(app_core, this)),
|
||||
fragments_order(new FragmentsOrderView(app_core, this))
|
||||
|
|
@ -106,7 +106,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
sync_kernel->registerActionSync(sav, [this]()->bool{return project_manager->isOpen();});
|
||||
connect(sav, &QAction::triggered, [this](){
|
||||
this->project_manager->save();
|
||||
app_core->getFramework()->saveAll();
|
||||
app_core->getDocsManager()->saveAll();
|
||||
});
|
||||
project->addSeparator();
|
||||
auto opnp = project->addAction("打开项目");
|
||||
|
|
@ -308,9 +308,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
auto build = tool->addAction("编译", [this](){
|
||||
this->build_internal();
|
||||
});
|
||||
sync_kernel->registerActionSync(build, [this]()->bool{
|
||||
return project_manager->isOpen();
|
||||
});
|
||||
sync_kernel->registerActionSync(build, [this]()->bool{ return project_manager->isOpen(); });
|
||||
|
||||
// 窗口菜单
|
||||
auto window = mbar->addMenu("窗口");
|
||||
|
|
@ -350,23 +348,23 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
[this](int index){
|
||||
auto view = center_funcs->widget(index);
|
||||
toggle_widget_visible(false, center_funcs, view);
|
||||
auto comp = app_core->getFramework()->queryTextComponent(view);
|
||||
auto comp = app_core->getDocsManager()->queryTextComponent(view);
|
||||
if(comp)
|
||||
app_core->getFramework()->closeTextComponent(QFileInfo(comp->filePath()));
|
||||
app_core->getDocsManager()->closeTextComponent(QFileInfo(comp->absoluteFilePath()));
|
||||
});
|
||||
|
||||
connect(project_structure, &ProjectView::aboutToBoDelete,
|
||||
[this](QList<QFileInfo> infos){
|
||||
for(auto &key : infos){
|
||||
auto comp = app_core->getFramework()->queryTextComponent(key);
|
||||
auto comp = app_core->getDocsManager()->queryTextComponent(key);
|
||||
if(comp){
|
||||
toggle_widget_visible(false, center_funcs, comp->textView());
|
||||
app_core->getFramework()->closeTextComponent(key);
|
||||
app_core->getDocsManager()->closeTextComponent(key);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this->app_core->getFramework()->addProcTrigger([this](){
|
||||
this->app_core->getDocsManager()->addProcTrigger([this](){
|
||||
this->chains_view->refresh();
|
||||
this->units_view->refresh();
|
||||
this->errors_present->refresh();
|
||||
|
|
@ -379,7 +377,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
center_funcs->addTab(current_projects, "欢迎界面");
|
||||
|
||||
connect(project_structure, &ProjectView::activeDocument,
|
||||
app_core, &AppCore::openTextDocument);
|
||||
app_core->getDocsManager(), &MakeTools::DocsManager::openTextDocument);
|
||||
|
||||
uilayout_load();
|
||||
|
||||
|
|
@ -410,27 +408,27 @@ void MainWindow::contentViewAppend(QWidget *widget, const QString &name)
|
|||
void MainWindow::build_internal(bool all_from_disk)
|
||||
{
|
||||
if(!all_from_disk)
|
||||
app_core->getFramework()->saveAll();
|
||||
app_core->getDocsManager()->saveAll();
|
||||
|
||||
auto chains = project_manager->filesWithEnds("storychain");
|
||||
for(auto &it : chains)
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
app_core->getMakeCore()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
auto units = project_manager->filesWithEnds("storyunit");
|
||||
for(auto &it : units)
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
app_core->getMakeCore()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
auto storys = project_manager->filesWithEnds("storyboard");
|
||||
for(auto &it : storys)
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
app_core->getMakeCore()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
auto volumes = project_manager->filesWithEnds("storyvolume");
|
||||
for(auto &it : volumes)
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
app_core->getMakeCore()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
auto concepts = project_manager->filesWithEnds("storyconcept");
|
||||
for(auto &it : concepts)
|
||||
app_core->getMake_tool()->compile(std::get<0>(it), std::get<1>(it));
|
||||
app_core->getMakeCore()->compile(std::get<0>(it), std::get<1>(it));
|
||||
|
||||
errors_present->refresh();
|
||||
chains_view->refresh();
|
||||
|
|
@ -514,7 +512,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||
// 关闭事件
|
||||
if(project_manager->isOpen()){
|
||||
project_manager->save();
|
||||
app_core->getFramework()->saveAll();
|
||||
app_core->getDocsManager()->saveAll();
|
||||
}
|
||||
|
||||
uilayout_save();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include <StoryTool.h>
|
||||
#include <QTreeView>
|
||||
#include <QListView>
|
||||
#include "SensitiveCore.h"
|
||||
#include "DocsManager.h"
|
||||
#include "messagepresent.h"
|
||||
#include "storychainspresent.h"
|
||||
#include "storyunitspresent.h"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ SourceCodeEditor::SourceCodeEditor(Core::FileExtensionFactory *factory)
|
|||
|
||||
void SourceCodeEditor::concept_jump(const QList<QString> &path)
|
||||
{
|
||||
auto fpath = this->filePath();
|
||||
auto fpath = this->absoluteFilePath();
|
||||
auto core = core_ins->parseCore();
|
||||
if(path.size()){
|
||||
auto storynode = core->queryStoryConcept(path[0]).first();
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void StoryBoardSourceEdit::initSource(Core::AppCore *core, const QFileInfo &src,
|
|||
|
||||
void StoryBoardSourceEdit::jumpTo(const QList<QString> &path)
|
||||
{
|
||||
auto fpath = this->filePath();
|
||||
auto fpath = this->absoluteFilePath();
|
||||
auto core = core_temp->parseCore();
|
||||
if(path.size()){
|
||||
auto storynode = core->queryStoryBoard(path[0]).first();
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void StoryChainSourceEdit::resetProcsType(const QString &suffix)
|
|||
|
||||
void StoryChainSourceEdit::jumpTo(const QList<QString> &path)
|
||||
{
|
||||
auto fpath = this->filePath();
|
||||
auto fpath = this->absoluteFilePath();
|
||||
auto core = core_ins->parseCore();
|
||||
if(path.size()){
|
||||
auto storynode = core->queryStoryChain(path[0]).first();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define STORYCHAINSOURCEEDITOR_H
|
||||
|
||||
#include "ContentPresent.h"
|
||||
#include "SensitiveCore.h"
|
||||
#include "DocsManager.h"
|
||||
#include "SourceEditView.h"
|
||||
|
||||
#include <QObject>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "storychainspresent.h"
|
||||
#include "SensitiveCore.h"
|
||||
#include "DocsManager.h"
|
||||
|
||||
#include <QSplitter>
|
||||
#include <QVBoxLayout>
|
||||
|
|
@ -93,8 +93,8 @@ void StoryChainsPresent::click_to(const QModelIndex &curr)
|
|||
|
||||
auto chain_ins = this->core_ins->parseCore()->queryStoryChain(path[0]).first();
|
||||
auto chain_doc = chain_ins->doc();
|
||||
this->core_ins->openTextDocument(chain_doc->filePath(), chain_doc->docName());
|
||||
auto present = this->core_ins->getFramework()->queryTextComponent(QFileInfo(chain_doc->filePath()));
|
||||
this->core_ins->getDocsManager()->openTextDocument(chain_doc->filePath(), chain_doc->docName());
|
||||
auto present = this->core_ins->getDocsManager()->queryTextComponent(QFileInfo(chain_doc->filePath()));
|
||||
|
||||
if(path.size()){
|
||||
present->jumpTo(path);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "storyconceptspresent.h"
|
||||
#include "SensitiveCore.h"
|
||||
#include "DocsManager.h"
|
||||
#include "opstream.h"
|
||||
|
||||
#include <QSplitter>
|
||||
|
|
@ -101,8 +101,8 @@ void StoryConceptsPresent::click_to(const QModelIndex &curr)
|
|||
|
||||
auto unit_ins = this->core_ins->parseCore()->queryStoryConcept(path[0]).first();
|
||||
auto chain_doc = unit_ins->doc();
|
||||
this->core_ins->openTextDocument(chain_doc->filePath(), chain_doc->docName());
|
||||
auto present = this->core_ins->getFramework()->queryTextComponent(QFileInfo(chain_doc->filePath()));
|
||||
this->core_ins->getDocsManager()->openTextDocument(chain_doc->filePath(), chain_doc->docName());
|
||||
auto present = this->core_ins->getDocsManager()->queryTextComponent(QFileInfo(chain_doc->filePath()));
|
||||
|
||||
if(path.size()){
|
||||
present->jumpTo(path);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void StoryUnitSourceEdit::cursor_contex_query()
|
|||
refers_model->setHorizontalHeaderLabels(QStringList() << "故事" << "内容");
|
||||
|
||||
auto cursor = edit_square->textCursor();
|
||||
auto doc = this->core_ins->parseCore()->queryDocument(QFileInfo(filePath()));
|
||||
auto doc = this->core_ins->parseCore()->queryDocument(QFileInfo(absoluteFilePath()));
|
||||
auto words = doc->getWords(cursor.block().blockNumber());
|
||||
|
||||
QList<DesNode*> frags;
|
||||
|
|
@ -172,7 +172,7 @@ void StoryUnitSourceEdit::present_refersed_tips(const QString &unit, const QStri
|
|||
|
||||
void StoryUnitSourceEdit::jumpTo(const QList<QString> &path)
|
||||
{
|
||||
auto fpath = this->filePath();
|
||||
auto fpath = this->absoluteFilePath();
|
||||
auto core = core_ins->parseCore();
|
||||
if(path.size()){
|
||||
auto storynode = core->queryStoryUnit(path[0]).first();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "storyunitspresent.h"
|
||||
#include "SensitiveCore.h"
|
||||
#include "DocsManager.h"
|
||||
|
||||
#include <QSplitter>
|
||||
#include <QVBoxLayout>
|
||||
|
|
@ -93,8 +93,8 @@ void StoryUnitsPresent::click_to(const QModelIndex &curr)
|
|||
|
||||
auto unit_ins = this->core_ins->parseCore()->queryStoryUnit(path[0]).first();
|
||||
auto chain_doc = unit_ins->doc();
|
||||
this->core_ins->openTextDocument(chain_doc->filePath(), chain_doc->docName());
|
||||
auto present = this->core_ins->getFramework()->queryTextComponent(QFileInfo(chain_doc->filePath()));
|
||||
this->core_ins->getDocsManager()->openTextDocument(chain_doc->filePath(), chain_doc->docName());
|
||||
auto present = this->core_ins->getDocsManager()->queryTextComponent(QFileInfo(chain_doc->filePath()));
|
||||
|
||||
if(path.size()){
|
||||
present->jumpTo(path);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ using namespace Parse;
|
|||
using namespace Parse::Result;
|
||||
using namespace CheckTools;
|
||||
|
||||
StoryTool::StoryTool(Parse::Result::ParseCore *core)
|
||||
: parse_core(core), fragment_check(new FragmentsCheck(core)){}
|
||||
StoryTool::StoryTool()
|
||||
: parse_core(new ParseCore()), fragment_check(new FragmentsCheck(parse_core)){}
|
||||
|
||||
QList<QString> StoryTool::compile(const QFileInfo &file, const QString &doc_name)
|
||||
{
|
||||
|
|
@ -59,7 +59,7 @@ QList<QString> StoryTool::compile(const QFileInfo &file, const QString &doc_name
|
|||
if(doc_core){
|
||||
parse_core->registerDoc(doc_core);
|
||||
for(auto n : results)
|
||||
parse_core->registerNode(doc_core, n);
|
||||
doc_core->append(n);
|
||||
}
|
||||
return QList<QString>();
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ QList<QString> StoryTool::compileSource(const QFileInfo &_file, const QString &s
|
|||
if(doc_core){
|
||||
parse_core->registerDoc(doc_core);
|
||||
for(auto n : results)
|
||||
parse_core->registerNode(doc_core, n);
|
||||
doc_core->append(n);
|
||||
}
|
||||
return QList<QString>();
|
||||
}
|
||||
|
|
@ -129,13 +129,18 @@ bool StoryTool::checkPass(QList<ErrorMessage> &errors)
|
|||
errors << error;
|
||||
}
|
||||
|
||||
for(auto &n : this->parse_core->queryRootNodes(d))
|
||||
for(auto &n : d->syntaxNodes())
|
||||
error_check(n, errors);
|
||||
}
|
||||
fragment_check->check(errors);
|
||||
return errors.size() == 0;
|
||||
}
|
||||
|
||||
ParseCore *StoryTool::getCore() const
|
||||
{
|
||||
return parse_core;
|
||||
}
|
||||
|
||||
bool StoryTool::error_check(Parse::Result::DesNode * node, QList<ErrorMessage> &err_out)
|
||||
{
|
||||
node->check(err_out);
|
||||
|
|
|
|||
|
|
@ -14,12 +14,13 @@ namespace MakeTools {
|
|||
class LIBPARSE_EXPORT StoryTool
|
||||
{
|
||||
public:
|
||||
StoryTool(Parse::Result::ParseCore *core);
|
||||
StoryTool();
|
||||
|
||||
QList<QString> compile(const QFileInfo &file, const QString &doc_name);
|
||||
QList<QString> compileSource(const QFileInfo &file, const QString &src, const QString &doc_name);
|
||||
|
||||
bool checkPass(QList<Parse::ErrorMessage> &errors);
|
||||
Parse::Result::ParseCore *getCore() const;
|
||||
|
||||
private:
|
||||
Parse::Result::ParseCore *const parse_core;
|
||||
|
|
|
|||
|
|
@ -109,46 +109,18 @@ ParseCore::ParseCore()
|
|||
|
||||
void ParseCore::registerDoc(DocCore *ins)
|
||||
{
|
||||
if(!nodes_map.contains(ins))
|
||||
nodes_map[ins] = new QList<DesNode*>();
|
||||
}
|
||||
|
||||
void ParseCore::registerNode(DocCore *doc, DesNode *node)
|
||||
{
|
||||
if(!nodes_map.contains(doc))
|
||||
nodes_map[doc] = new QList<DesNode*>();
|
||||
|
||||
nodes_map[doc]->append(node);
|
||||
}
|
||||
|
||||
void ParseCore::clearNodes(DocCore *ins)
|
||||
{
|
||||
if(!nodes_map.contains(ins))
|
||||
return;
|
||||
|
||||
auto c = nodes_map[ins];
|
||||
for(auto &i : *c)
|
||||
delete i;
|
||||
|
||||
c->clear();
|
||||
if(!doc_nodes.contains(ins))
|
||||
doc_nodes << ins;
|
||||
}
|
||||
|
||||
QList<DocCore *> ParseCore::allDocuments() const
|
||||
{
|
||||
return nodes_map.keys();
|
||||
}
|
||||
|
||||
QList<DesNode *> ParseCore::queryRootNodes(DocCore *doc) const
|
||||
{
|
||||
if(!nodes_map.contains(doc))
|
||||
return QList<DesNode*>();
|
||||
|
||||
return *nodes_map[doc];
|
||||
return doc_nodes;
|
||||
}
|
||||
|
||||
DocCore *ParseCore::queryDocument(const QFileInfo &file_src) const
|
||||
{
|
||||
for(auto &d : nodes_map.keys()){
|
||||
for(auto &d : doc_nodes){
|
||||
auto anchor_file = d->filePath();
|
||||
if(anchor_file == file_src.absoluteFilePath())
|
||||
return d;
|
||||
|
|
@ -159,17 +131,27 @@ DocCore *ParseCore::queryDocument(const QFileInfo &file_src) const
|
|||
void ParseCore::deleteDocument(DocCore *ins)
|
||||
{
|
||||
ins->clear();
|
||||
nodes_map.remove(ins);
|
||||
doc_nodes.removeAll(ins);
|
||||
delete ins;
|
||||
}
|
||||
|
||||
void ParseCore::clear()
|
||||
{
|
||||
for(auto &ins : doc_nodes) {
|
||||
ins->clear();
|
||||
delete ins;
|
||||
}
|
||||
|
||||
doc_nodes.clear();
|
||||
}
|
||||
|
||||
QList<DesNode *> ParseCore::allStoryChains() const
|
||||
{
|
||||
QList<Result::DesNode*> retlist;
|
||||
auto keys = nodes_map.keys();
|
||||
for(auto &k : keys)
|
||||
|
||||
for(auto &k : doc_nodes)
|
||||
if(k->docType() == DocType::STORYCHAIN)
|
||||
for(auto &n : *nodes_map[k])
|
||||
for(auto &n : k->syntaxNodes())
|
||||
if(n->typeValue()==NODE_STORYCHAIN)
|
||||
retlist << n;
|
||||
|
||||
|
|
@ -201,10 +183,10 @@ QList<Result::DesNode*> ParseCore::queryStoryPoint(DesNode *chain, const QString
|
|||
QList<DesNode *> ParseCore::allStoryUnits() const
|
||||
{
|
||||
QList<Result::DesNode*> retlist;
|
||||
auto keys = nodes_map.keys();
|
||||
for(auto &k : keys)
|
||||
|
||||
for(auto &k : doc_nodes)
|
||||
if(k->docType() == DocType::STORYUNIT)
|
||||
for(auto &n : *nodes_map[k]){
|
||||
for(auto &n : k->syntaxNodes()){
|
||||
if(n->typeValue()==NODE_STORYUNIT)
|
||||
retlist << n;
|
||||
}
|
||||
|
|
@ -264,10 +246,9 @@ QList<DesNode *> ParseCore::allStoryBoards() const
|
|||
{
|
||||
QList<Result::DesNode*> retlist;
|
||||
|
||||
auto keys = nodes_map.keys();
|
||||
for(auto &k : keys)
|
||||
for(auto &k : doc_nodes)
|
||||
if(k->docType() == DocType::STORYBOARD)
|
||||
for(auto &n : *nodes_map[k]){
|
||||
for(auto &n : k->syntaxNodes()){
|
||||
if(n->typeValue() == NODE_STORYBOARD)
|
||||
retlist << n;
|
||||
}
|
||||
|
|
@ -300,9 +281,10 @@ QList<DesNode *> ParseCore::queryStoryFragmentRefer(DesNode *unit, const QString
|
|||
QList<DesNode *> ParseCore::allStoryConcept() const
|
||||
{
|
||||
QList<DesNode*> rets;
|
||||
for(auto &it : nodes_map.keys()){
|
||||
|
||||
for(auto &it : doc_nodes){
|
||||
if(it->docType() == DocType::STORYCONCEPTS)
|
||||
for(auto n : *nodes_map[it])
|
||||
for(auto n : it->syntaxNodes())
|
||||
if(n->typeValue() == NODE_STORYCONCEPT)
|
||||
rets << n;
|
||||
}
|
||||
|
|
@ -336,9 +318,10 @@ QList<DesNode *> ParseCore::queryStoryStrongPoint(DesNode *concept, const QStrin
|
|||
QList<DesNode *> ParseCore::queryStoryDepiction(const QString &name) const
|
||||
{
|
||||
QList<Result::DesNode*> retlist;
|
||||
for(auto &it : nodes_map.keys()) {
|
||||
|
||||
for(auto &it : doc_nodes) {
|
||||
if(it->docType() == DocType::STORYOUTLINES)
|
||||
for(auto &n : *nodes_map[it])
|
||||
for(auto &n : it->syntaxNodes())
|
||||
if(n->typeValue() == NODE_STORYDEPICTION &&
|
||||
static_cast<NamedNode*>(n)->name()[0] == name)
|
||||
retlist << n;
|
||||
|
|
@ -419,9 +402,12 @@ void DocCore::clear()
|
|||
{
|
||||
for(auto &it : words_store)
|
||||
delete it;
|
||||
|
||||
words_store.clear();
|
||||
core()->clearNodes(this);
|
||||
|
||||
for(auto &it : root_nodes)
|
||||
delete it;
|
||||
root_nodes.clear();
|
||||
|
||||
static_cast<Unknown*>(unknown_host)->xClear();
|
||||
}
|
||||
|
||||
|
|
@ -446,3 +432,14 @@ QList<Words *> DocCore::getWords(int row, int col) const
|
|||
|
||||
return list;
|
||||
}
|
||||
|
||||
int DocCore::append(DesNode *ins)
|
||||
{
|
||||
this->root_nodes.append(ins);
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<DesNode *> DocCore::syntaxNodes() const
|
||||
{
|
||||
return this->root_nodes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,9 @@ namespace Parse
|
|||
*/
|
||||
QList<Words *> getWords(int row, int col=-1) const;
|
||||
|
||||
int append(DesNode *ins);
|
||||
QList<DesNode*> syntaxNodes() const;
|
||||
|
||||
private:
|
||||
Result::DesNode *const unknown_host;
|
||||
ParseCore *const core_store;
|
||||
|
|
@ -284,6 +287,7 @@ namespace Parse
|
|||
DocType type_store;
|
||||
|
||||
QList<Words*> words_store;
|
||||
QList<DesNode*> root_nodes;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -292,20 +296,16 @@ namespace Parse
|
|||
class LIBPARSE_EXPORT ParseCore
|
||||
{
|
||||
private:
|
||||
QHash<DocCore*, QList<DesNode*>*> nodes_map;
|
||||
QList<DocCore*> doc_nodes;
|
||||
|
||||
public:
|
||||
explicit ParseCore();
|
||||
virtual ~ParseCore() = default;
|
||||
|
||||
virtual void registerDoc(DocCore *ins);
|
||||
virtual void registerNode(DocCore *doc, DesNode *node);
|
||||
virtual void clearNodes(DocCore *ins);
|
||||
|
||||
virtual QList<DocCore *> allDocuments() const;
|
||||
|
||||
virtual QList<DesNode*> queryRootNodes(DocCore *doc) const;
|
||||
|
||||
/**
|
||||
* 获取文档内存实例,如果不存在指定实例,返回nullptr.
|
||||
*
|
||||
|
|
@ -314,6 +314,7 @@ namespace Parse
|
|||
*/
|
||||
virtual Result::DocCore* queryDocument(const QFileInfo &file_src) const;
|
||||
virtual void deleteDocument(Result::DocCore *ins);
|
||||
virtual void clear();
|
||||
|
||||
virtual QList<Result::DesNode*> allStoryChains() const;
|
||||
virtual QList<Result::DesNode*> queryStoryChain(const QString & name) const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue