<commit_before>﻿#include "rulesChecker.h"
#include <QtWidgets/QFileDialog>

using namespace qReal::rulesChecker;

RulesChecker::RulesChecker(qrRepo::GraphicalRepoApi const &graphicalRepoApi
		, qReal::gui::MainWindowInterpretersInterface &interpretersInterface)
	: mGRepoApi(&graphicalRepoApi)
	, mWindowInterface(&interpretersInterface)
	, mNoErrorsOccured(true)
{
	// TODO: get these lists from metamodel somehow
	mLinkTypes << "SequenceFlow" << "MessageFlow" << "SignalFlow" << "TimerFlow";
	mContainerTypes << "Pool" << "Lane" << "BPMN Diagram";
}

void RulesChecker::exportToXml()
{
	QString fileName = QFileDialog::getSaveFileName(mWindowInterface->windowWidget()
			, tr("Save File"), tr("export.xml"), tr("*.xml"));
	if (!fileName.endsWith(".xml")) {
		fileName += ".xml";
	}

	// TODO: get your own pointer to RepoControlInterface, don't cast mGRepoApi
	qrRepo::RepoControlInterface const *repoControlApi = reinterpret_cast<qrRepo::RepoControlInterface const *>(mGRepoApi);
	if (repoControlApi) {
		repoControlApi->exportToXml(fileName);
	}
}

bool RulesChecker::makeDetour(Id const &currentNode, IdList &usedNodes)<commit_msg>fixed segfault on xml export. reinterpret_cast just does not work<commit_after>﻿#include "rulesChecker.h"
#include <QtWidgets/QFileDialog>

#include "../../qrrepo/repoApi.h"

using namespace qReal::rulesChecker;

RulesChecker::RulesChecker(qrRepo::GraphicalRepoApi const &graphicalRepoApi
		, qReal::gui::MainWindowInterpretersInterface &interpretersInterface)
	: mGRepoApi(&graphicalRepoApi)
	, mWindowInterface(&interpretersInterface)
	, mNoErrorsOccured(true)
{
	// TODO: get these lists from metamodel somehow
	mLinkTypes << "SequenceFlow" << "MessageFlow" << "SignalFlow" << "TimerFlow";
	mContainerTypes << "Pool" << "Lane" << "BPMN Diagram";
}

void RulesChecker::exportToXml()
{
	QString fileName = QFileDialog::getSaveFileName(mWindowInterface->windowWidget()
			, tr("Save File"), tr("export.xml"), tr("*.xml"));
	if (!fileName.endsWith(".xml")) {
		fileName += ".xml";
	}

	// TODO: get your own pointer to RepoControlInterface, don't cast mGRepoApi
	qrRepo::RepoControlInterface const *repoControlApi
			= static_cast<qrRepo::RepoControlInterface const *>(static_cast<qrRepo::RepoApi const *>(mGRepoApi));
	if (repoControlApi) {
		repoControlApi->exportToXml(fileName);
	}
}

bool RulesChecker::makeDetour(Id const &currentNode, IdList &usedNodes)
{'fraction_non_alphanumeric': 0.13987473903966596, 'fraction_numerical': 0.0, 'mean_word_length': 7.122033898305085, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 9}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2540796', 'n_tokens_mistral': 782, 'n_tokens_neox': 794, 'n_words': 152}