diff --git a/.gitignore b/.gitignore index 761aba5..3ba454f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build-*/* all-build-desktop/* +thirdparty *.qm *.user *.user.* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ec76903 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "thirdparty/sc-machine"] + path = thirdparty/sc-machine + url = https://github.com/ostis-dev/sc-machine.git diff --git a/sources/kbe/mainwindow.cpp b/sources/kbe/mainwindow.cpp index 3c8b2b4..c0acdb0 100644 --- a/sources/kbe/mainwindow.cpp +++ b/sources/kbe/mainwindow.cpp @@ -480,7 +480,6 @@ void MainWindow::onFileSaveAs(QWidget* window) } mBlurEffect->setEnabled(false); - } void MainWindow::onFileSaveAll() diff --git a/sources/kbe/media/translations/lang_ru_RU.qm b/sources/kbe/media/translations/lang_ru_RU.qm index dad9bbb..cc75871 100644 Binary files a/sources/kbe/media/translations/lang_ru_RU.qm and b/sources/kbe/media/translations/lang_ru_RU.qm differ diff --git a/sources/plugins/scg/fileloader.h b/sources/plugins/scg/fileloader.h new file mode 100644 index 0000000..6853aaa --- /dev/null +++ b/sources/plugins/scg/fileloader.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include + +class FileLoader +{ +public: + //! Loads file. + virtual bool load(QString file_name, QObject *output) = 0; +}; diff --git a/sources/plugins/scg/filewriter.h b/sources/plugins/scg/filewriter.h new file mode 100644 index 0000000..ea41898 --- /dev/null +++ b/sources/plugins/scg/filewriter.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include + +class FileWriter +{ +public: + // Saves scg format to file. + virtual bool save(QString file_name, QObject *input) = 0; +}; + + diff --git a/sources/plugins/scg/gwf/gwffileloader.h b/sources/plugins/scg/gwf/gwffileloader.h index 2cad47b..0048f5f 100644 --- a/sources/plugins/scg/gwf/gwffileloader.h +++ b/sources/plugins/scg/gwf/gwffileloader.h @@ -13,11 +13,12 @@ #include #include +#include + class SCgScene; class SCgObject; -class GWFFileLoader - +class GWFFileLoader : public FileLoader { public: GWFFileLoader(); diff --git a/sources/plugins/scg/gwf/gwffilewriter.cpp b/sources/plugins/scg/gwf/gwffilewriter.cpp index 3199c41..2a16866 100644 --- a/sources/plugins/scg/gwf/gwffilewriter.cpp +++ b/sources/plugins/scg/gwf/gwffilewriter.cpp @@ -32,13 +32,14 @@ bool GWFFileWriter::save(QString file_name, QObject *input) SCgScene *scene = qobject_cast(input); QFile fileOut(file_name); - if (!fileOut.open(QFile::WriteOnly | QFile::Text)) { + if (!fileOut.open(QFile::WriteOnly | QFile::Text)) + { QMessageBox::warning(0, qAppName(), QObject::tr("File saving error.\nCannot write file %1:\n%2.") .arg(file_name) .arg(fileOut.errorString())); return false; - } + } stream.setDevice(&fileOut); stream.startWriting("UTF-8"); diff --git a/sources/plugins/scg/gwf/gwffilewriter.h b/sources/plugins/scg/gwf/gwffilewriter.h index e1b0194..640bef2 100644 --- a/sources/plugins/scg/gwf/gwffilewriter.h +++ b/sources/plugins/scg/gwf/gwffilewriter.h @@ -6,6 +6,7 @@ #pragma once +#include "filewriter.h" #include "gwfstreamwriter.h" //! TODO: add error messages @@ -13,7 +14,7 @@ class SCgObject; class SCgNode; -class GWFFileWriter +class GWFFileWriter : public FileWriter { public: GWFFileWriter(); diff --git a/sources/plugins/scg/gwf/gwfobjectinforeader.cpp b/sources/plugins/scg/gwf/gwfobjectinforeader.cpp index 1574850..f862746 100644 --- a/sources/plugins/scg/gwf/gwfobjectinforeader.cpp +++ b/sources/plugins/scg/gwf/gwfobjectinforeader.cpp @@ -120,9 +120,9 @@ void GwfObjectInfoReader::createTypesMap() mGWFType2TypeAlias["pair/-/-/-/orient"] = "pair/-/-/-/orient"; //const - mGWFType2TypeAlias["pair/const/-/perm/noorien"] = "pair/const/-/perm/noorien"; + mGWFType2TypeAlias["pair/const/-/perm/noorient"] = "pair/const/-/perm/noorient"; mGWFType2TypeAlias["pair/const/-/perm/orient"] = "pair/const/-/perm/orient"; - mGWFType2TypeAlias["pair/const/-/temp/noorien"] = "pair/const/-/temp/noorien"; + mGWFType2TypeAlias["pair/const/-/temp/noorient"] = "pair/const/-/temp/noorient"; mGWFType2TypeAlias["pair/const/-/temp/orient"] = "pair/const/-/temp/orient"; mGWFType2TypeAlias["pair/const/pos/perm/orient/membership"] = "pair/const/pos/perm/orient/membership"; mGWFType2TypeAlias["pair/const/neg/perm/orient/membership"] = "pair/const/neg/perm/orient/membership"; @@ -132,9 +132,9 @@ void GwfObjectInfoReader::createTypesMap() mGWFType2TypeAlias["pair/const/fuz/temp/orient/membership"] = "pair/const/fuz/temp/orient/membership"; //var - mGWFType2TypeAlias["pair/var/-/perm/noorien"] = "pair/var/-/perm/noorien"; + mGWFType2TypeAlias["pair/var/-/perm/noorient"] = "pair/var/-/perm/noorient"; mGWFType2TypeAlias["pair/var/-/perm/orient"] = "pair/var/-/perm/orient"; - mGWFType2TypeAlias["pair/var/-/temp/noorien"] = "pair/var/-/temp/noorien"; + mGWFType2TypeAlias["pair/var/-/temp/noorient"] = "pair/var/-/temp/noorient"; mGWFType2TypeAlias["pair/var/-/temp/orient"] = "pair/var/-/temp/orient"; mGWFType2TypeAlias["pair/var/pos/perm/orient/membership"] = "pair/var/pos/perm/orient/membership"; mGWFType2TypeAlias["pair/var/neg/perm/orient/membership"] = "pair/var/neg/perm/orient/membership"; @@ -144,9 +144,9 @@ void GwfObjectInfoReader::createTypesMap() mGWFType2TypeAlias["pair/var/fuz/temp/orient/membership"] = "pair/var/fuz/temp/orient/membership"; //meta - mGWFType2TypeAlias["pair/meta/-/perm/noorien"] = "pair/meta/-/perm/noorien"; + mGWFType2TypeAlias["pair/meta/-/perm/noorient"] = "pair/meta/-/perm/noorient"; mGWFType2TypeAlias["pair/meta/-/perm/orient"] = "pair/meta/-/perm/orient"; - mGWFType2TypeAlias["pair/meta/-/temp/noorien"] = "pair/meta/-/temp/noorien"; + mGWFType2TypeAlias["pair/meta/-/temp/noorient"] = "pair/meta/-/temp/noorient"; mGWFType2TypeAlias["pair/meta/-/temp/orient"] = "pair/meta/-/temp/orient"; mGWFType2TypeAlias["pair/meta/pos/perm/orient/membership"] = "pair/meta/pos/perm/orient/membership"; mGWFType2TypeAlias["pair/meta/neg/perm/orient/membership"] = "pair/meta/neg/perm/orient/membership"; @@ -229,17 +229,17 @@ void GwfObjectInfoReader::createTypesMap() mGWFType2TypeAlias["arc/var/fuz/temp"] = "pair/var/fuz/temp/orient/membership"; mGWFType2TypeAlias["arc/meta/fuz/temp"] = "pair/var/fuz/temp/orient/membership"; - mGWFType2TypeAlias["pair/const/synonym"] = "pair/const/-/perm/noorien"; - mGWFType2TypeAlias["pair/var/noorient"] = "pair/var/-/perm/noorien"; - mGWFType2TypeAlias["pair/meta/noorient"] = "pair/var/-/perm/noorien"; + mGWFType2TypeAlias["pair/const/synonym"] = "pair/const/-/perm/noorient"; + mGWFType2TypeAlias["pair/var/noorient"] = "pair/var/-/perm/noorient"; + mGWFType2TypeAlias["pair/meta/noorient"] = "pair/var/-/perm/noorient"; mGWFType2TypeAlias["pair/const/orient"] = "pair/const/-/perm/orient"; mGWFType2TypeAlias["pair/var/orient"] = "pair/var/-/perm/orient"; mGWFType2TypeAlias["pair/meta/orient"] = "pair/var/-/perm/orient"; - mGWFType2TypeAlias["pair/rail/noorient"] = "pair/var/-/perm/noorien"; + mGWFType2TypeAlias["pair/rail/noorient"] = "pair/var/-/perm/noorient"; mGWFType2TypeAlias["pair/rail/orient"] = "pair/var/-/perm/orient"; - mGWFType2TypeAlias["pair/rail2/noorient"] = "pair/var/-/perm/noorien"; + mGWFType2TypeAlias["pair/rail2/noorient"] = "pair/var/-/perm/noorient"; mGWFType2TypeAlias["pair/rail2/orient"] = "pair/var/-/perm/orient"; } diff --git a/sources/plugins/scg/media/translations/scg_ru_RU.qm b/sources/plugins/scg/media/translations/scg_ru_RU.qm index 2f757f9..befe57f 100644 Binary files a/sources/plugins/scg/media/translations/scg_ru_RU.qm and b/sources/plugins/scg/media/translations/scg_ru_RU.qm differ diff --git a/sources/plugins/scg/scg.pro b/sources/plugins/scg/scg.pro index f02268c..ce8ebb8 100644 --- a/sources/plugins/scg/scg.pro +++ b/sources/plugins/scg/scg.pro @@ -1,9 +1,15 @@ QT += xml widgets concurrent + +ANTLR_LIB_PATH = "../../../thirdparty/sc-machine/thirdparty/antlr" +SC_MEMORY_PATH = "../../../thirdparty/sc-machine/sc-memory" + TARGET = $$qtLibraryTarget(scg) TEMPLATE = lib INCLUDEPATH += ../../kbe \ - ./ + ./ \ + "$$SC_MEMORY_PATH" \ + "$$ANTLR_LIB_PATH"/runtime/src DESTDIR = ../../bin/plugins @@ -19,6 +25,177 @@ win32 { } HEADERS += \ + "$$SC_MEMORY_PATH"/sc-memory/sc_debug.hpp \ + "$$SC_MEMORY_PATH"/sc-memory/sc_type.hpp \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scs.g4 \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scsLexer.h \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scsParser.h \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scs_parser.hpp \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scs_types.hpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ANTLRErrorListener.h \ + "$$ANTLR_LIB_PATH"/runtime/src/ANTLRErrorStrategy.h \ + "$$ANTLR_LIB_PATH"/runtime/src/ANTLRFileStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/ANTLRInputStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/BailErrorStrategy.h \ + "$$ANTLR_LIB_PATH"/runtime/src/BaseErrorListener.h \ + "$$ANTLR_LIB_PATH"/runtime/src/BufferedTokenStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/CharStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/CommonToken.h \ + "$$ANTLR_LIB_PATH"/runtime/src/CommonTokenFactory.h \ + "$$ANTLR_LIB_PATH"/runtime/src/CommonTokenStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/ConsoleErrorListener.h \ + "$$ANTLR_LIB_PATH"/runtime/src/DefaultErrorStrategy.h \ + "$$ANTLR_LIB_PATH"/runtime/src/DiagnosticErrorListener.h \ + "$$ANTLR_LIB_PATH"/runtime/src/Exceptions.h \ + "$$ANTLR_LIB_PATH"/runtime/src/FailedPredicateException.h \ + "$$ANTLR_LIB_PATH"/runtime/src/InputMismatchException.h \ + "$$ANTLR_LIB_PATH"/runtime/src/IntStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/InterpreterRuleContext.h \ + "$$ANTLR_LIB_PATH"/runtime/src/Lexer.h \ + "$$ANTLR_LIB_PATH"/runtime/src/LexerInterpreter.h \ + "$$ANTLR_LIB_PATH"/runtime/src/LexerNoViableAltException.h \ + "$$ANTLR_LIB_PATH"/runtime/src/ListTokenSource.h \ + "$$ANTLR_LIB_PATH"/runtime/src/NoViableAltException.h \ + "$$ANTLR_LIB_PATH"/runtime/src/Parser.h \ + "$$ANTLR_LIB_PATH"/runtime/src/ParserInterpreter.h \ + "$$ANTLR_LIB_PATH"/runtime/src/ParserRuleContext.h \ + "$$ANTLR_LIB_PATH"/runtime/src/ProxyErrorListener.h \ + "$$ANTLR_LIB_PATH"/runtime/src/RecognitionException.h \ + "$$ANTLR_LIB_PATH"/runtime/src/Recognizer.h \ + "$$ANTLR_LIB_PATH"/runtime/src/RuleContext.h \ + "$$ANTLR_LIB_PATH"/runtime/src/RuleContextWithAltNum.h \ + "$$ANTLR_LIB_PATH"/runtime/src/RuntimeMetaData.h \ + "$$ANTLR_LIB_PATH"/runtime/src/Token.h \ + "$$ANTLR_LIB_PATH"/runtime/src/TokenFactory.h \ + "$$ANTLR_LIB_PATH"/runtime/src/TokenSource.h \ + "$$ANTLR_LIB_PATH"/runtime/src/TokenStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/TokenStreamRewriter.h \ + "$$ANTLR_LIB_PATH"/runtime/src/UnbufferedCharStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/UnbufferedTokenStream.h \ + "$$ANTLR_LIB_PATH"/runtime/src/Vocabulary.h \ + "$$ANTLR_LIB_PATH"/runtime/src/WritableToken.h \ + "$$ANTLR_LIB_PATH"/runtime/src/antlr4-common.h \ + "$$ANTLR_LIB_PATH"/runtime/src/antlr4-runtime.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATN.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNConfig.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNConfigSet.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNDeserializationOptions.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNDeserializer.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNSerializer.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNSimulator.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNType.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/AbstractPredicateTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ActionTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/AmbiguityInfo.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ArrayPredictionContext.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/AtomTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/BasicBlockStartState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/BasicState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/BlockEndState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/BlockStartState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ContextSensitivityInfo.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/DecisionEventInfo.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/DecisionInfo.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/DecisionState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/EmptyPredictionContext.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/EpsilonTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ErrorInfo.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LL1Analyzer.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerATNConfig.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerATNSimulator.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerActionExecutor.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerActionType.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerChannelAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerCustomAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerIndexedCustomAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerModeAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerMoreAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerPopModeAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerPushModeAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerSkipAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerTypeAction.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LookaheadEventInfo.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LoopEndState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/NotSetTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/OrderedATNConfigSet.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ParseInfo.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ParserATNSimulator.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PlusBlockStartState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PlusLoopbackState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PrecedencePredicateTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PredicateEvalInfo.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PredicateTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PredictionContext.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PredictionMode.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ProfilingATNSimulator.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/RangeTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/RuleStartState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/RuleStopState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/RuleTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/SemanticContext.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/SetTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/SingletonPredictionContext.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/StarBlockStartState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/StarLoopEntryState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/StarLoopbackState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/TokensStartState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/Transition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/WildcardTransition.h \ + "$$ANTLR_LIB_PATH"/runtime/src/dfa/DFA.h \ + "$$ANTLR_LIB_PATH"/runtime/src/dfa/DFASerializer.h \ + "$$ANTLR_LIB_PATH"/runtime/src/dfa/DFAState.h \ + "$$ANTLR_LIB_PATH"/runtime/src/dfa/LexerDFASerializer.h \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/InterpreterDataReader.h \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/Interval.h \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/IntervalSet.h \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/MurmurHash.h \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/Predicate.h \ + "$$ANTLR_LIB_PATH"/runtime/src/support/Any.h \ + "$$ANTLR_LIB_PATH"/runtime/src/support/Arrays.h \ + "$$ANTLR_LIB_PATH"/runtime/src/support/BitSet.h \ + "$$ANTLR_LIB_PATH"/runtime/src/support/CPPUtils.h \ + "$$ANTLR_LIB_PATH"/runtime/src/support/Declarations.h \ + "$$ANTLR_LIB_PATH"/runtime/src/support/StringUtils.h \ + "$$ANTLR_LIB_PATH"/runtime/src/support/guid.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/AbstractParseTreeVisitor.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ErrorNode.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ErrorNodeImpl.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/IterativeParseTreeWalker.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTree.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTreeListener.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTreeProperty.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTreeVisitor.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTreeWalker.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/TerminalNode.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/TerminalNodeImpl.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/Trees.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/Chunk.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/ParseTreeMatch.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/ParseTreePattern.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/ParseTreePatternMatcher.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/RuleTagToken.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/TagChunk.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/TextChunk.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/TokenTagToken.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPath.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathElement.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathLexer.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathLexerErrorListener.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathRuleAnywhereElement.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathRuleElement.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathTokenAnywhereElement.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathTokenElement.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathWildcardElement.h \ + scs/scgconsts.h \ + scs/scgfileloader.h \ + scs/scgfilewriter.h \ + scs/scgobjectinforeader.h \ + scs/scgstreamwriter.h \ + fileloader.h \ + filewriter.h \ scgwindow.h \ scgview.h \ scgtemplateobjectbuilder.h \ @@ -81,6 +258,10 @@ HEADERS += \ arrangers/scgarrangerhorizontal.h \ arrangers/scgarrangergrid.h \ arrangers/scgarranger.h \ + scs/scgfileloader.h \ + scs/scgfilewriter.h \ + scs/scgobjectinforeader.h \ + scs/scgstreamwriter.h \ select/scgselectinputoutput.h \ select/scgselect.h \ select/scgselectsubgraph.h \ @@ -98,6 +279,165 @@ HEADERS += \ scgtypedialog.h SOURCES += \ + "$$SC_MEMORY_PATH"/sc-memory/sc_debug.cpp \ + "$$SC_MEMORY_PATH"/sc-memory/sc_type.cpp \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scsLexer.cpp \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scsParser.cpp \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scs_parser.cpp \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scs_types.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ANTLRErrorListener.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ANTLRErrorStrategy.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ANTLRFileStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ANTLRInputStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/BailErrorStrategy.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/BaseErrorListener.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/BufferedTokenStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/CharStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/CommonToken.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/CommonTokenFactory.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/CommonTokenStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ConsoleErrorListener.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/DefaultErrorStrategy.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/DiagnosticErrorListener.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/Exceptions.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/FailedPredicateException.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/InputMismatchException.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/IntStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/InterpreterRuleContext.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/Lexer.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/LexerInterpreter.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/LexerNoViableAltException.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ListTokenSource.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/NoViableAltException.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/Parser.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ParserInterpreter.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ParserRuleContext.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/ProxyErrorListener.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/RecognitionException.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/Recognizer.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/RuleContext.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/RuleContextWithAltNum.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/RuntimeMetaData.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/Token.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/TokenSource.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/TokenStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/TokenStreamRewriter.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/UnbufferedCharStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/UnbufferedTokenStream.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/Vocabulary.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/WritableToken.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATN.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNConfig.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNConfigSet.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNDeserializationOptions.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNDeserializer.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNSerializer.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNSimulator.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ATNState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/AbstractPredicateTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ActionTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/AmbiguityInfo.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ArrayPredictionContext.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/AtomTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/BasicBlockStartState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/BasicState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/BlockEndState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/BlockStartState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ContextSensitivityInfo.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/DecisionEventInfo.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/DecisionInfo.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/DecisionState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/EmptyPredictionContext.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/EpsilonTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ErrorInfo.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LL1Analyzer.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerATNConfig.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerATNSimulator.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerActionExecutor.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerChannelAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerCustomAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerIndexedCustomAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerModeAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerMoreAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerPopModeAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerPushModeAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerSkipAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LexerTypeAction.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LookaheadEventInfo.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/LoopEndState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/NotSetTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/OrderedATNConfigSet.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ParseInfo.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ParserATNSimulator.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PlusBlockStartState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PlusLoopbackState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PrecedencePredicateTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PredicateEvalInfo.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PredicateTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PredictionContext.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/PredictionMode.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/ProfilingATNSimulator.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/RangeTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/RuleStartState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/RuleStopState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/RuleTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/SemanticContext.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/SetTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/SingletonPredictionContext.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/StarBlockStartState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/StarLoopEntryState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/StarLoopbackState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/TokensStartState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/Transition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/atn/WildcardTransition.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/dfa/DFA.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/dfa/DFASerializer.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/dfa/DFAState.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/dfa/LexerDFASerializer.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/InterpreterDataReader.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/Interval.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/IntervalSet.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/MurmurHash.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/misc/Predicate.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/support/Any.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/support/Arrays.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/support/CPPUtils.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/support/StringUtils.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/support/guid.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ErrorNode.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ErrorNodeImpl.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/IterativeParseTreeWalker.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTree.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTreeListener.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTreeVisitor.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/ParseTreeWalker.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/TerminalNode.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/TerminalNodeImpl.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/Trees.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/Chunk.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/ParseTreeMatch.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/ParseTreePattern.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/RuleTagToken.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/TagChunk.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/TextChunk.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/pattern/TokenTagToken.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPath.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathElement.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathLexer.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathLexerErrorListener.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathRuleElement.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathTokenElement.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathWildcardElement.cpp \ + scs/scgconsts.cpp \ + scs/scgfileloader.cpp \ + scs/scgfilewriter.cpp \ + scs/scgobjectinforeader.cpp \ + scs/scgstreamwriter.cpp \ scgwindow.cpp \ scgview.cpp \ scgtemplateobjectbuilder.cpp \ @@ -179,11 +519,23 @@ SOURCES += \ TRANSLATIONS += media/translations/scg_en_EN.ts \ media/translations/scg_ru_RU.ts +JAVA_PATH = "/usr/bin/java" +ANTLR_COMMAND = "$$JAVA_PATH -jar \"$$ANTLR_LIB_PATH/antlr-4.7.1-complete.jar\" \"$$SC_MEMORY_PATH/sc-memory/scs/scs.g4\" -no-listener -package scs" + lrelease.input = TRANSLATIONS lrelease.output = ${QMAKE_FILE_IN_PATH}/${QMAKE_FILE_IN_BASE}.qm -lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_IN_PATH}/${QMAKE_FILE_IN_BASE}.qm +lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_IN_PATH}/${QMAKE_FILE_IN_BASE}.qm; + system($$ANTLR_COMMAND) lrelease.CONFIG += no_link target_predeps QMAKE_EXTRA_COMPILERS += lrelease OTHER_FILES += \ scgplugin.json + +DISTFILES += \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scs.interp \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scs.tokens \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scsLexer.interp \ + "$$SC_MEMORY_PATH"/sc-memory/scs/scsLexer.tokens \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathLexer.g4 \ + "$$ANTLR_LIB_PATH"/runtime/src/tree/xpath/XPathLexer.tokens \ diff --git a/sources/plugins/scg/scgalphabet.cpp b/sources/plugins/scg/scgalphabet.cpp index 361f5c5..a05dc04 100644 --- a/sources/plugins/scg/scgalphabet.cpp +++ b/sources/plugins/scg/scgalphabet.cpp @@ -229,9 +229,9 @@ void SCgAlphabet::initialize() mObjectTypes["pair/-/-/-/orient"] = createPairIcon(pairSize, "pair/-/-/-/orient"); // const - mObjectTypes["pair/const/-/perm/noorien"] = createPairIcon(pairSize, "pair/const/-/perm/noorien"); + mObjectTypes["pair/const/-/perm/noorient"] = createPairIcon(pairSize, "pair/const/-/perm/noorient"); mObjectTypes["pair/const/-/perm/orient"] = createPairIcon(pairSize, "pair/const/-/perm/orient"); - mObjectTypes["pair/const/-/temp/noorien"] = createPairIcon(pairSize, "pair/const/-/temp/noorien"); + mObjectTypes["pair/const/-/temp/noorient"] = createPairIcon(pairSize, "pair/const/-/temp/noorient"); mObjectTypes["pair/const/-/temp/orient"] = createPairIcon(pairSize, "pair/const/-/temp/orient"); mObjectTypes["pair/const/pos/perm/orient/membership"] = createPairIcon(pairSize, "pair/const/pos/perm/orient/membership"); mObjectTypes["pair/const/pos/temp/orient/membership"] = createPairIcon(pairSize, "pair/const/pos/temp/orient/membership"); @@ -241,9 +241,9 @@ void SCgAlphabet::initialize() mObjectTypes["pair/const/fuz/temp/orient/membership"] = createPairIcon(pairSize, "pair/const/fuz/temp/orient/membership"); // var - mObjectTypes["pair/var/-/perm/noorien"] = createPairIcon(pairSize, "pair/var/-/perm/noorien"); + mObjectTypes["pair/var/-/perm/noorient"] = createPairIcon(pairSize, "pair/var/-/perm/noorient"); mObjectTypes["pair/var/-/perm/orient"] = createPairIcon(pairSize, "pair/var/-/perm/orient"); - mObjectTypes["pair/var/-/temp/noorien"] = createPairIcon(pairSize, "pair/var/-/temp/noorien"); + mObjectTypes["pair/var/-/temp/noorient"] = createPairIcon(pairSize, "pair/var/-/temp/noorient"); mObjectTypes["pair/var/-/temp/orient"] = createPairIcon(pairSize, "pair/var/-/temp/orient"); mObjectTypes["pair/var/pos/perm/orient/membership"] = createPairIcon(pairSize, "pair/var/pos/perm/orient/membership"); mObjectTypes["pair/var/pos/temp/orient/membership"] = createPairIcon(pairSize, "pair/var/pos/temp/orient/membership"); @@ -253,9 +253,9 @@ void SCgAlphabet::initialize() mObjectTypes["pair/var/fuz/temp/orient/membership"] = createPairIcon(pairSize, "pair/var/fuz/temp/orient/membership"); // meta - mObjectTypes["pair/meta/-/perm/noorien"] = createPairIcon(pairSize, "pair/meta/-/perm/noorien"); + mObjectTypes["pair/meta/-/perm/noorient"] = createPairIcon(pairSize, "pair/meta/-/perm/noorient"); mObjectTypes["pair/meta/-/perm/orient"] = createPairIcon(pairSize, "pair/meta/-/perm/orient"); - mObjectTypes["pair/meta/-/temp/noorien"] = createPairIcon(pairSize, "pair/meta/-/temp/noorien"); + mObjectTypes["pair/meta/-/temp/noorient"] = createPairIcon(pairSize, "pair/meta/-/temp/noorient"); mObjectTypes["pair/meta/-/temp/orient"] = createPairIcon(pairSize, "pair/meta/-/temp/orient"); mObjectTypes["pair/meta/pos/perm/orient/membership"] = createPairIcon(pairSize, "pair/meta/pos/perm/orient/membership"); mObjectTypes["pair/meta/pos/temp/orient/membership"] = createPairIcon(pairSize, "pair/meta/pos/temp/orient/membership"); diff --git a/sources/plugins/scg/scgobjectsinfo.cpp b/sources/plugins/scg/scgobjectsinfo.cpp index 9c9d600..63c733f 100644 --- a/sources/plugins/scg/scgobjectsinfo.cpp +++ b/sources/plugins/scg/scgobjectsinfo.cpp @@ -136,6 +136,11 @@ int SCgNodeInfo::idtfPos() const return d->mIdtfPos; } +QString SCgNodeInfo::scsId() const +{ + return d->scsId; +} + QPointF& SCgNodeInfo::posRef() { return d->mPos; @@ -171,6 +176,11 @@ int& SCgNodeInfo::idtfPosRef() return d->mIdtfPos; } +QString& SCgNodeInfo::scsIdRef() +{ + return d->scsId; +} + //________________________________________________ SCgPairInfo::SCgPairInfo(const SCgPair* obj) { @@ -201,42 +211,61 @@ const QVector& SCgPairInfo::points() const { return d->mPoints; } + const QString& SCgPairInfo::beginObjectId() const { return d->mBeginObjectId; } + const QString& SCgPairInfo::endObjectId() const { return d->mEndObjectId; } + double SCgPairInfo::beginDot() const { return d->mBeginDot; } + double SCgPairInfo::endDot() const { return d->mEndDot; } + +QString SCgPairInfo::scsId() const +{ + return d->scsId; +} + QVector& SCgPairInfo::pointsRef() { return d->mPoints; } + QString& SCgPairInfo::beginObjectIdRef() { return d->mBeginObjectId; } + QString& SCgPairInfo::endObjectIdRef() { return d->mEndObjectId; } + double& SCgPairInfo::beginDotRef() { return d->mBeginDot; } + double& SCgPairInfo::endDotRef() { return d->mEndDot; } + +QString& SCgPairInfo::scsIdRef() +{ + return d->scsId; +} //________________________________________________ SCgBusInfo::SCgBusInfo(const SCgBus* obj) { diff --git a/sources/plugins/scg/scgobjectsinfo.h b/sources/plugins/scg/scgobjectsinfo.h index d809132..b91c581 100644 --- a/sources/plugins/scg/scgobjectsinfo.h +++ b/sources/plugins/scg/scgobjectsinfo.h @@ -92,6 +92,7 @@ class SCgNodeInfo: public SCgObjectInfo const QString& contentFilename() const; const QVariant& contentData() const; int idtfPos() const; + QString scsId() const; /**@}*/ /** @@ -107,6 +108,7 @@ class SCgNodeInfo: public SCgObjectInfo QString& contentFilenameRef(); QVariant& contentDataRef(); int& idtfPosRef(); + QString& scsIdRef(); /**@}*/ private: @@ -136,6 +138,7 @@ class SCgPairInfo: public SCgObjectInfo const QString& endObjectId() const; double beginDot() const; double endDot() const; + QString scsId() const; /**@}*/ /** @@ -148,6 +151,7 @@ class SCgPairInfo: public SCgObjectInfo QString& endObjectIdRef(); double& beginDotRef(); double& endDotRef(); + QString& scsIdRef(); /**@}*/ private: diff --git a/sources/plugins/scg/scgobjectsinfodata.cpp b/sources/plugins/scg/scgobjectsinfodata.cpp index 58433bf..8410bad 100644 --- a/sources/plugins/scg/scgobjectsinfodata.cpp +++ b/sources/plugins/scg/scgobjectsinfodata.cpp @@ -57,7 +57,8 @@ SCgNodeInfoData::SCgNodeInfoData(const SCgNodeInfoData &other): QSharedData(othe mContentVisible(other.mContentVisible), mContentFilename(other.mContentFilename), mContentData(other.mContentData), - mIdtfPos(other.mIdtfPos) + mIdtfPos(other.mIdtfPos), + scsId(other.scsId) { } diff --git a/sources/plugins/scg/scgobjectsinfodata.h b/sources/plugins/scg/scgobjectsinfodata.h index 343e58e..1071de4 100644 --- a/sources/plugins/scg/scgobjectsinfodata.h +++ b/sources/plugins/scg/scgobjectsinfodata.h @@ -71,6 +71,7 @@ class SCgNodeInfoData:public QSharedData QString mContentFilename; QVariant mContentData; int mIdtfPos; + QString scsId; }; @@ -94,6 +95,7 @@ class SCgPairInfoData:public QSharedData QString mEndObjectId; double mBeginDot; double mEndDot; + QString scsId; }; diff --git a/sources/plugins/scg/scgwindow.cpp b/sources/plugins/scg/scgwindow.cpp index df489f3..0f52573 100644 --- a/sources/plugins/scg/scgwindow.cpp +++ b/sources/plugins/scg/scgwindow.cpp @@ -44,6 +44,10 @@ #include "config.h" #include "scgundoview.h" +#include "scs/scgfileloader.h" +#include "scs/scgfilewriter.h" +#include "fileloader.h" + const QString SCgWindow::SupportedPasteMimeType = "text/KBE-gwf"; @@ -316,23 +320,33 @@ QIcon SCgWindow::icon() const bool SCgWindow::loadFromFile(const QString &fileName) { - GWFFileLoader loader; + std::unique_ptr loader; + if (fileName.endsWith(".scs")) + loader = std::make_unique(); + else if (fileName.endsWith(".gwf")) + loader = std::make_unique(); + else return false; - if (loader.load(fileName, mView->scene())) + if (loader->load(fileName, mView->scene())) { mFileName = fileName; setWindowTitle(mFileName); emitEvent(EditorObserverInterface::ContentLoaded); return true; - }else - return false; + } + return false; } bool SCgWindow::saveToFile(const QString &fileName) { - GWFFileWriter writer; + std::unique_ptr writer; + if (fileName.endsWith(".scs")) + writer = std::make_unique(); + else if (fileName.endsWith(".gwf")) + writer = std::make_unique(); + else return false; - if (writer.save(fileName, mView->scene())) + if (writer->save(fileName, mView->scene())) { mFileName = fileName; setWindowTitle(mFileName); @@ -340,7 +354,7 @@ bool SCgWindow::saveToFile(const QString &fileName) emitEvent(EditorObserverInterface::ContentSaved); return true; - }else + } else return false; } @@ -642,7 +656,8 @@ bool SCgWindow::isSaved() const QStringList SCgWindow::supportedFormatsExt() const { QStringList res; - res << "gwf"; + res.append("gwf"); + res.append("scs"); return res; } @@ -699,7 +714,8 @@ EditorInterface* SCgWindowFactory::createInstance() QStringList SCgWindowFactory::supportedFormatsExt() { QStringList res; - res << "gwf"; + res.append("gwf"); + res.append("scs"); return res; } diff --git a/sources/plugins/scg/scs/scgconsts.cpp b/sources/plugins/scg/scs/scgconsts.cpp new file mode 100644 index 0000000..106ae4c --- /dev/null +++ b/sources/plugins/scg/scs/scgconsts.cpp @@ -0,0 +1,71 @@ +#include "scgconsts.h" + +const QString SCgConsts::CONCEPT_SCG_CONTOUR = "concept_scg_contour"; +const QString SCgConsts::NREL_SCG_REPRESENTATION = "nrel_scg_representation"; +const QString SCgConsts::NREL_INCLUDING = "nrel_including"; +const QString SCgConsts::CONCEPT_SCG_BUS = "concept_scg_bus"; +const QString SCgConsts::NREL_X = "nrel_x"; +const QString SCgConsts::NREL_Y = "nrel_y"; +const QString SCgConsts::NREL_IDTF_POS = "nrel_idtf_pos"; +const QString SCgConsts::NREL_CONTENT_TYPE = "nrel_content_type"; +const QString SCgConsts::NREL_CONTENT_MIME_TYPE = "nrel_content_mime_type"; +const QString SCgConsts::NREL_CONTENT_VISIBLE = "nrel_content_visible"; +const QString SCgConsts::NREL_CONTENT_FILENAME = "nrel_content_filename"; +const QString SCgConsts::NREL_START_RATIO = "nrel_start_ratio"; +const QString SCgConsts::NREL_END_RATIO = "nrel_end_ratio"; +const QString SCgConsts::NREL_DECOMPOSITION = "nrel_decomposition"; +const QString SCgConsts::NREL_OWNER = "nrel_owner"; +const QString SCgConsts::NREL_BASIC_SEQUENCE = "nrel_basic_sequence"; + +//nodes +const QString SCgConsts::SC_NODE_NOT_DEFINE = "sc_node_not_define"; +const QString SCgConsts::SC_NODE_SUPER_GROUP = "sc_node_super_group"; +const QString SCgConsts::SC_NODE_SUPER_GROUP_VAR = "sc_node_super_group_var"; +const QString SCgConsts::SC_NODE_META = "sc_node_meta"; +const QString SCgConsts::SC_NODE_ABSTRACT_META = "sc_node_abstract_meta"; +const QString SCgConsts::SC_NODE_STRUCT_META = "sc_node_struct_meta"; +const QString SCgConsts::SC_NODE_TUPLE_META = "sc_node_tuple_meta"; +const QString SCgConsts::SC_NODE_ROLE_RELATION_META = "sc_node_role_relation_meta"; +const QString SCgConsts::SC_NODE_NOROLE_RELATION_META = "sc_node_norole_relation_meta"; +const QString SCgConsts::SC_NODE_CLASS_META = "sc_node_class_meta"; +const QString SCgConsts::SC_NODE_SUPER_GROUP_META = "sc_node_super_group_meta"; +const QString SCgConsts::SC_NODE_TEMP = "sc_node_temp"; +const QString SCgConsts::SC_NODE_ABSTRACT_TEMP = "sc_node_abstract_temp"; +const QString SCgConsts::SC_NODE_STRUCT_TEMP = "sc_node_struct_temp"; +const QString SCgConsts::SC_NODE_TUPLE_TEMP = "sc_node_tuple_temp"; +const QString SCgConsts::SC_NODE_ROLE_RELATION_TEMP = "sc_node_role_relation_temp"; +const QString SCgConsts::SC_NODE_NOROLE_RELATION_TEMP = "sc_node_norole_relation_temp"; +const QString SCgConsts::SC_NODE_CLASS_TEMP = "sc_node_class_temp"; +const QString SCgConsts::SC_NODE_SUPER_GROUP_TEMP = "sc_node_super_group_temp"; +const QString SCgConsts::SC_NODE_VAR_TEMP = "sc_node_var_temp"; +const QString SCgConsts::SC_NODE_ABSTRACT_VAR_TEMP = "sc_node_abstract_var_temp"; +const QString SCgConsts::SC_NODE_STRUCT_VAR_TEMP = "sc_node_struct_var_temp"; +const QString SCgConsts::SC_NODE_TUPLE_VAR_TEMP = "sc_node_tuple_var_temp"; +const QString SCgConsts::SC_NODE_ROLE_RELATION_VAR_TEMP = "sc_node_role_relation_var_temp"; +const QString SCgConsts::SC_NODE_NOROLE_RELATION_VAR_TEMP = "sc_node_norole_relation_var_temp"; +const QString SCgConsts::SC_NODE_CLASS_VAR_TEMP = "sc_node_class_var_temp"; +const QString SCgConsts::SC_NODE_SUPER_GROUP_VAR_TEMP = "sc_node_super_group_var_temp"; +const QString SCgConsts::SC_NODE_META_TEMP = "sc_node_meta_temp"; +const QString SCgConsts::SC_NODE_ABSTRACT_META_TEMP = "sc_node_abstract_meta_temp"; +const QString SCgConsts::SC_NODE_STRUCT_META_TEMP = "sc_node_struct_meta_temp"; +const QString SCgConsts::SC_NODE_TUPLE_META_TEMP = "sc_node_tuple_meta_temp"; +const QString SCgConsts::SC_NODE_ROLE_RELATION_META_TEMP = "sc_node_role_relation_meta_temp"; +const QString SCgConsts::SC_NODE_NOROLE_RELATION_META_TEMP = "sc_node_norole_relation_meta_temp"; +const QString SCgConsts::SC_NODE_CLASS_META_TEMP = "sc_node_class_meta_temp"; +const QString SCgConsts::SC_NODE_SUPER_GROUP_META_TEMP = "sc_node_super_group_meta_temp"; + +//pairs +const QString SCgConsts::SC_PAIR_CONST_TEMP_NOORIENT = "sc_pair_const_temp_noorient"; +const QString SCgConsts::SC_PAIR_CONST_TEMP_ORIENT = "sc_pair_const_temp_orient"; +const QString SCgConsts::SC_PAIR_VAR_TEMP_NOORIENT = "sc_pair_var_temp_noorient"; +const QString SCgConsts::SC_PAIR_VAR_TEMP_ORIENT= "sc_pair_var_temp_orient"; +const QString SCgConsts::SC_PAIR_META_PERM_NOORIENT = "sc_pair_meta_perm_noorient"; +const QString SCgConsts::SC_PAIR_META_PERM_ORIENT = "sc_pair_meta_perm_orient"; +const QString SCgConsts::SC_PAIR_META_TEMP_NOORIENT = "sc_pair_meta_temp_noorient"; +const QString SCgConsts::SC_PAIR_META_TEMP_ORIENT = "sc_pair_meta_temp_orient"; +const QString SCgConsts::SC_PAIR_META_POS_PERM_MEMBERSHIP = "sc_pair_meta_pos_perm_orient_membership"; +const QString SCgConsts::SC_PAIR_META_POS_TEMP_MEMBERSHIP = "sc_pair_meta_pos_temp_orient_membership"; +const QString SCgConsts::SC_PAIR_META_NEG_PERM_MEMBERSHIP = "sc_pair_meta_neg_perm_orient_membership"; +const QString SCgConsts::SC_PAIR_META_NEG_TEMP_MEMBERSHIP = "sc_pair_meta_neg_temp_orient_membership"; +const QString SCgConsts::SC_PAIR_META_FUZ_PERM_MEMBERSHIP = "sc_pair_meta_fuz_perm_orient_membership"; +const QString SCgConsts::SC_PAIR_META_FUZ_TEMP_MEMBERSHIP = "sc_pair_meta_fuz_temp_orient_membership"; diff --git a/sources/plugins/scg/scs/scgconsts.h b/sources/plugins/scg/scs/scgconsts.h new file mode 100644 index 0000000..b1e7b90 --- /dev/null +++ b/sources/plugins/scg/scs/scgconsts.h @@ -0,0 +1,79 @@ +#pragma once + +#include +#include + +class SCgConsts +{ +public: + static const QString CONCEPT_SCG_CONTOUR; + static const QString NREL_SCG_REPRESENTATION; + static const QString NREL_INCLUDING; + static const QString CONCEPT_SCG_BUS; + static const QString NREL_X; + static const QString NREL_Y; + static const QString NREL_IDTF_POS; + static const QString NREL_CONTENT_TYPE; + static const QString NREL_CONTENT_MIME_TYPE; + static const QString NREL_CONTENT_VISIBLE; + static const QString NREL_CONTENT_FILENAME; + static const QString NREL_START_RATIO; + static const QString NREL_END_RATIO; + static const QString NREL_DECOMPOSITION; + static const QString NREL_OWNER; + static const QString NREL_BASIC_SEQUENCE; + + //extended types + //nodes + static const QString SC_NODE_NOT_DEFINE; + static const QString SC_NODE_SUPER_GROUP; + static const QString SC_NODE_SUPER_GROUP_VAR; + static const QString SC_NODE_META; + static const QString SC_NODE_ABSTRACT_META; + static const QString SC_NODE_STRUCT_META; + static const QString SC_NODE_TUPLE_META; + static const QString SC_NODE_ROLE_RELATION_META; + static const QString SC_NODE_NOROLE_RELATION_META; + static const QString SC_NODE_CLASS_META; + static const QString SC_NODE_SUPER_GROUP_META; + static const QString SC_NODE_TEMP; + static const QString SC_NODE_ABSTRACT_TEMP; + static const QString SC_NODE_STRUCT_TEMP; + static const QString SC_NODE_TUPLE_TEMP; + static const QString SC_NODE_ROLE_RELATION_TEMP; + static const QString SC_NODE_NOROLE_RELATION_TEMP; + static const QString SC_NODE_CLASS_TEMP; + static const QString SC_NODE_SUPER_GROUP_TEMP; + static const QString SC_NODE_VAR_TEMP; + static const QString SC_NODE_ABSTRACT_VAR_TEMP; + static const QString SC_NODE_STRUCT_VAR_TEMP; + static const QString SC_NODE_TUPLE_VAR_TEMP; + static const QString SC_NODE_ROLE_RELATION_VAR_TEMP; + static const QString SC_NODE_NOROLE_RELATION_VAR_TEMP; + static const QString SC_NODE_CLASS_VAR_TEMP; + static const QString SC_NODE_SUPER_GROUP_VAR_TEMP; + static const QString SC_NODE_META_TEMP; + static const QString SC_NODE_ABSTRACT_META_TEMP; + static const QString SC_NODE_STRUCT_META_TEMP; + static const QString SC_NODE_TUPLE_META_TEMP; + static const QString SC_NODE_ROLE_RELATION_META_TEMP; + static const QString SC_NODE_NOROLE_RELATION_META_TEMP; + static const QString SC_NODE_CLASS_META_TEMP; + static const QString SC_NODE_SUPER_GROUP_META_TEMP; + + //pairs + static const QString SC_PAIR_CONST_TEMP_NOORIENT; + static const QString SC_PAIR_CONST_TEMP_ORIENT; + static const QString SC_PAIR_VAR_TEMP_NOORIENT; + static const QString SC_PAIR_VAR_TEMP_ORIENT; + static const QString SC_PAIR_META_PERM_NOORIENT; + static const QString SC_PAIR_META_PERM_ORIENT; + static const QString SC_PAIR_META_TEMP_NOORIENT; + static const QString SC_PAIR_META_TEMP_ORIENT; + static const QString SC_PAIR_META_POS_PERM_MEMBERSHIP; + static const QString SC_PAIR_META_POS_TEMP_MEMBERSHIP; + static const QString SC_PAIR_META_NEG_PERM_MEMBERSHIP; + static const QString SC_PAIR_META_NEG_TEMP_MEMBERSHIP; + static const QString SC_PAIR_META_FUZ_PERM_MEMBERSHIP; + static const QString SC_PAIR_META_FUZ_TEMP_MEMBERSHIP; +}; diff --git a/sources/plugins/scg/scs/scgfileloader.cpp b/sources/plugins/scg/scs/scgfileloader.cpp new file mode 100644 index 0000000..5629d78 --- /dev/null +++ b/sources/plugins/scg/scs/scgfileloader.cpp @@ -0,0 +1,48 @@ +#include "scgfileloader.h" +#include "scgobjectinforeader.h" +#include "scgdefaultobjectbuilder.h" +#include "scgobject.h" +#include "scgscene.h" + +#include +#include +#include +#include + +#include + +#include "sc-memory/scs/scs_parser.hpp" + + +SCgFileLoader::SCgFileLoader() +{ +} + +SCgFileLoader::~SCgFileLoader() +{ +} + +bool SCgFileLoader::load(QString file_name, QObject *output) +{ + SCgScene *scene = qobject_cast(output); + + //! Read data from file + mFileName = file_name; + QString layoutFileName = file_name.replace(file_name.size() - 3, 3, "layout.scs"); + QFile file(mFileName); + file.open(QIODevice::ReadOnly | QIODevice::Text); + QFile layoutFile(layoutFileName); + layoutFile.open(QIODevice::ReadOnly | QIODevice::Text); + + //! Read files + SCgObjectInfoReader reader; + reader.read(&file, &layoutFile); + file.close(); + layoutFile.close(); + + //! Place objects to the scene + DefaultSCgObjectBuilder objectBuilder(scene); + objectBuilder.buildObjects(reader.objectsInfo()); + + return true; +} diff --git a/sources/plugins/scg/scs/scgfileloader.h b/sources/plugins/scg/scs/scgfileloader.h new file mode 100644 index 0000000..60306d9 --- /dev/null +++ b/sources/plugins/scg/scs/scgfileloader.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "fileloader.h" + +class SCgScene; +class SCgObject; + +class SCgFileLoader : public FileLoader +{ +public: + SCgFileLoader(); + virtual ~SCgFileLoader(); + //! Loads scs format. + bool load(QString file_name, QObject *output); + + +private: + QString mFileName; +}; + diff --git a/sources/plugins/scg/scs/scgfilewriter.cpp b/sources/plugins/scg/scs/scgfilewriter.cpp new file mode 100644 index 0000000..a4dbd6c --- /dev/null +++ b/sources/plugins/scg/scs/scgfilewriter.cpp @@ -0,0 +1,74 @@ +#include "scgfilewriter.h" +#include "scgscene.h" +#include "scgnode.h" +#include "scgpair.h" +#include "scgbus.h" +#include "scgcontour.h" + +#include +#include +#include +#include + +SCgFileWriter::SCgFileWriter() +{ +} + +SCgFileWriter::~SCgFileWriter() +{ +} + +bool SCgFileWriter::save(QString file_name, QObject *input) +{ + SCgScene *scene = qobject_cast(input); + + QFile fileOut(file_name); + QFile layoutFileOut(getLayoutFileName(file_name)); + if (!openFile(fileOut) || !openFile(layoutFileOut)) + return false; + + stream.setOutputFiles(&fileOut, &layoutFileOut); + + auto items = scene->items(); + QGraphicsItem *item; + + QVector objs; + QVector surfaceObjs; + foreach (item, items) + { + if (SCgObject::isSCgObjectType(item->type())) + { + SCgObject *obj = static_cast(item); + objs.push_back(obj); + if (obj->parentId() == 0) + surfaceObjs.push_back(obj); + } + } + stream.preprocess(objs); + stream.writeOrdered(surfaceObjs); + + fileOut.close(); + layoutFileOut.close(); + return true; +} + +QString SCgFileWriter::getLayoutFileName(QString name) +{ + const QString SCS_EXTENSION = ".scs"; + const QString LAYOUT_EXTENSION = ".layout.scs"; + if (name.endsWith(SCS_EXTENSION)) name.remove(name.size() - SCS_EXTENSION.size(), SCS_EXTENSION.size()); + return name.append(LAYOUT_EXTENSION); +} + +bool SCgFileWriter::openFile(QFile &file) +{ + if (!file.open(QFile::WriteOnly | QFile::Text)) + { + QMessageBox::warning(0, qAppName(), + QObject::tr("File saving error.\nCannot write file %1:\n%2.") + .arg(file.fileName()) + .arg(file.errorString())); + return false; + } + return true; +} diff --git a/sources/plugins/scg/scs/scgfilewriter.h b/sources/plugins/scg/scs/scgfilewriter.h new file mode 100644 index 0000000..959f4b7 --- /dev/null +++ b/sources/plugins/scg/scs/scgfilewriter.h @@ -0,0 +1,24 @@ +#pragma once + +#include "scgstreamwriter.h" +#include "filewriter.h" +#include + +class SCgObject; +class SCgNode; + +class SCgFileWriter : public FileWriter +{ +public: + SCgFileWriter(); + virtual ~SCgFileWriter(); + + bool save(QString file_name, QObject *input); +private: + SCgStreamWriter stream; + + QString getLayoutFileName(QString name); + bool openFile(QFile &file); +}; + + diff --git a/sources/plugins/scg/scs/scgobjectinforeader.cpp b/sources/plugins/scg/scs/scgobjectinforeader.cpp new file mode 100644 index 0000000..ef040c3 --- /dev/null +++ b/sources/plugins/scg/scs/scgobjectinforeader.cpp @@ -0,0 +1,529 @@ +#include "scgobjectinforeader.h" + +#include +#include +#include +#include + +#include "scgobjectsinfo.h" +#include "scgnode.h" +#include "scgbus.h" +#include "scgcontour.h" +#include "scgpair.h" +#include "scgconsts.h" + +#include + +SCgObjectInfoReader::SCgObjectInfoReader(bool isOwner) : + mIsOwner(isOwner), + mVersion(qMakePair(0, 0)) +{ +} + +SCgObjectInfoReader::SCgObjectInfoReader(QIODevice *dev, QIODevice *layoutdev, bool isOwner) : + mIsOwner(isOwner) +{ + read(dev, layoutdev); +} + +SCgObjectInfoReader::~SCgObjectInfoReader() +{ + if (mIsOwner) + del(); +} + +void SCgObjectInfoReader::del() +{ + TypeToObjectsMap::iterator it = mObjectsInfo.begin(); + ObjectInfoList::iterator itList; + + for(;it != mObjectsInfo.end(); ++it) + { + for(itList = it.value().begin(); itList != it.value().end(); ++itList) + delete *itList; + it.value().clear(); + } + mObjectsInfo.clear(); +} + +bool SCgObjectInfoReader::read(QIODevice *dev, QIODevice *layoutDev) +{ + if (mIsOwner) + del(); + + scgStream.setDevice(layoutDev); + scsStream.setDevice(dev); + + parser.Parse(scsStream.readAll().append(scgStream.readAll()).toStdString()); + + scs::Parser::TripleVector triples = parser.GetParsedTriples(); + QList contours; + //! Walk through all of the triples + for (auto const & t : triples) + { + auto const & src = parser.GetParsedElement(t.m_source); + if (src.GetIdtf() == SCgConsts::CONCEPT_SCG_CONTOUR.toStdString()) + contours.append(t.m_target); + + addEdge(t.m_edge, t.m_source, t.m_target); + } + //! Set parents + for (auto const & contour : contours) + { + auto set = findRelValueByIdtf(contour, SCgConsts::NREL_INCLUDING); + for (auto member : getOut(set)) + parents[member.second] = contour; + } + //! Parse elements + for (auto const & t : triples) + { + auto const & srcIdtf = parser.GetParsedElement(t.m_source).GetIdtf(); + if (srcIdtf == SCgConsts::NREL_SCG_REPRESENTATION.toStdString()) + { + auto pair = getEdge(t.m_target); + auto type = parser.GetParsedElement(pair.first).GetType(); + + if (type.IsNode() || type.IsLink()) + parseNode(pair.first, pair.second); + else if (type.IsEdge()) + parsePair(pair.first, pair.second); + } + else if (srcIdtf == SCgConsts::CONCEPT_SCG_BUS.toStdString()) + parseBus(t.m_target); + else if (srcIdtf == SCgConsts::CONCEPT_SCG_CONTOUR.toStdString()) + parseContour(t.m_target); + else if (isTypeExtended(QString::fromStdString(srcIdtf))) + { + for (int i = 0; i < mObjectsInfo[SCgNode::Type].size(); i++) + { + QString systemIdtf = QString::fromStdString(parser.GetParsedElement(t.m_target).GetIdtf()); + SCgNodeInfo* nodeInfo = static_cast(mObjectsInfo[SCgNode::Type][i]); + if (nodeInfo->scsId() == systemIdtf) + mObjectsInfo[SCgNode::Type][i]->typeAliasRef() = convertExtendedType(QString::fromStdString(srcIdtf)); + } + for (int i = 0; i < mObjectsInfo[SCgPair::Type].size(); i++) + { + QString systemIdtf = QString::fromStdString(parser.GetParsedElement(t.m_target).GetIdtf()); + SCgPairInfo* pairInfo = static_cast(mObjectsInfo[SCgPair::Type][i]); + if (pairInfo->scsId() == systemIdtf) + mObjectsInfo[SCgPair::Type][i]->typeAliasRef() = convertExtendedType(QString::fromStdString(srcIdtf)); + } + } + } + return true; +} + +void SCgObjectInfoReader::parseNode(const scs::ElementHandle &node, const scs::ElementHandle &scgNode) +{ + ScType type = parser.GetParsedElement(node).GetType(); + QString scgIdtf = QString::fromStdString(parser.GetParsedElement(scgNode).GetIdtf()); + QString systemIdtf = getSystemIdtf(node); + auto values = getRelValues(scgNode); + + std::unique_ptr nodeInfo(new SCgNodeInfo()); + + nodeInfo->posRef() = QPointF(values[SCgConsts::NREL_X].toDouble(), values[SCgConsts::NREL_Y].toDouble()); + nodeInfo->idtfPosRef() = values[SCgConsts::NREL_IDTF_POS].toDouble(); + nodeInfo->idtfValueRef() = systemIdtf; + nodeInfo->idRef() = getId(scgIdtf); + nodeInfo->parentIdRef() = getParentId(scgNode); + nodeInfo->typeAliasRef() = convertType(type); + nodeInfo->scsIdRef() = QString::fromStdString(parser.GetParsedElement(node).GetIdtf()); + + if (type.IsNode()) + { + nodeInfo->contentTypeRef() = 0; + nodeInfo->contentMimeTypeRef() = ""; + nodeInfo->contentVisibleRef() = false; + nodeInfo->contentDataRef() = QVariant(""); + } + else + { + nodeInfo->contentTypeRef() = values[SCgConsts::NREL_CONTENT_TYPE].toInt(); + nodeInfo->contentMimeTypeRef() = values[SCgConsts::NREL_CONTENT_MIME_TYPE].replace('_','/'); + nodeInfo->contentVisibleRef() = values[SCgConsts::NREL_CONTENT_VISIBLE].toInt(); + nodeInfo->contentFilenameRef() = values[SCgConsts::NREL_CONTENT_FILENAME]; + QString content = QString::fromStdString(parser.GetParsedElement(node).GetValue()); + if (nodeInfo->contentType() == CONTENT_TYPE_IMAGE) + { + QByteArray arr = QByteArray::fromBase64(content.toLocal8Bit()); + nodeInfo->contentDataRef() = QVariant(arr); + } + else + { + nodeInfo->contentDataRef() = QVariant(content); + } + } + + mObjectsInfo[SCgNode::Type].append(nodeInfo.release()); +} + +void SCgObjectInfoReader::parsePair(const scs::ElementHandle &pair, const scs::ElementHandle &scgPair) +{ + ScType type = parser.GetParsedElement(pair).GetType(); + QString systemIdtf = getSystemIdtf(pair); + QString scgIdtf = QString::fromStdString(parser.GetParsedElement(scgPair).GetIdtf()); + auto values = getRelValues(scgPair); + + std::unique_ptr pairInfo(new SCgPairInfo()); + + pairInfo->idtfValueRef() = systemIdtf; + pairInfo->idRef() = getId(scgIdtf); + pairInfo->beginDotRef() = values[SCgConsts::NREL_START_RATIO].toDouble(); + pairInfo->endDotRef() = values[SCgConsts::NREL_END_RATIO].toDouble(); + + auto p = getEdge(scgPair); + QString startIdtf = QString::fromStdString(parser.GetParsedElement(p.first).GetIdtf()); + QString endIdtf = QString::fromStdString(parser.GetParsedElement(p.second).GetIdtf()); + pairInfo->beginObjectIdRef() = getId(startIdtf); + pairInfo->endObjectIdRef() = getId(endIdtf); + + pairInfo->typeAliasRef() = convertType(type); + pairInfo->parentIdRef() = getParentId(scgPair); + pairInfo->scsIdRef() = QString::fromStdString(parser.GetParsedElement(pair).GetIdtf()); + + auto set = findRelValueByIdtf(scgPair, SCgConsts::NREL_DECOMPOSITION); + pairInfo->pointsRef().push_back(QPointF()); + if (set.IsValid()) + pairInfo->pointsRef().append(getPoints(set)); + pairInfo->pointsRef().push_back(QPointF()); + + mObjectsInfo[SCgPair::Type].append(pairInfo.release()); +} + +void SCgObjectInfoReader::parseBus(const scs::ElementHandle &bus) +{ + std::unique_ptr busInfo(new SCgBusInfo()); + QString idtf = QString::fromStdString(parser.GetParsedElement(bus).GetIdtf()); + QString systemIdtf = getSystemIdtf(bus); + + auto values = getRelValues(bus); + + busInfo->idtfValueRef() = systemIdtf; + busInfo->typeAliasRef() = "bus"; + busInfo->idRef() = getId(idtf); + auto ownerIdtf = parser.GetParsedElement(findRelValueByIdtf(bus, SCgConsts::NREL_OWNER)).GetIdtf(); + busInfo->ownerIdRef() = getId(QString::fromStdString(ownerIdtf)); + busInfo->parentIdRef() = getParentId(bus); + + auto set = findRelValueByIdtf(bus, SCgConsts::NREL_DECOMPOSITION); + busInfo->pointsRef().push_back(QPointF()); + if (set.IsValid()) + busInfo->pointsRef().append(getPoints(set)); + + mObjectsInfo[SCgBus::Type].append(busInfo.release()); +} + +void SCgObjectInfoReader::parseContour(const scs::ElementHandle &contour) +{ + std::unique_ptr contourInfo(new SCgContourInfo()); + QString idtf = QString::fromStdString(parser.GetParsedElement(contour).GetIdtf()); + QString systemIdtf = getSystemIdtf(contour); + + auto values = getRelValues(contour); + + contourInfo->idRef() = getId(idtf); + contourInfo->idtfValueRef() = systemIdtf; + contourInfo->parentIdRef() = getParentId(contour); + + auto set = findRelValueByIdtf(contour, SCgConsts::NREL_DECOMPOSITION); + if (set.IsValid()) + contourInfo->pointsRef().append(getPoints(set)); + + mObjectsInfo[SCgContour::Type].append(contourInfo.release()); +} + +void SCgObjectInfoReader::addEdge(const scs::ElementHandle &edge, const scs::ElementHandle &src, const scs::ElementHandle &trg) +{ + edges.insert(edge, qMakePair(src, trg)); + + if (outEdges.find(src) == outEdges.end()) + outEdges.insert(src, QVector>()); + outEdges[src].push_back(qMakePair(edge, trg)); + + if (inEdges.find(trg) == inEdges.end()) + inEdges.insert(trg, QVector>()); + inEdges[trg].push_back(qMakePair(edge, src)); +} + +QPair SCgObjectInfoReader::getEdge(const scs::ElementHandle &elHandle) +{ + return edges[elHandle]; +} + +QVector SCgObjectInfoReader::getPoints(const scs::ElementHandle &set) +{ + QVector points; + auto pairs = getOut(set); + if (pairs.isEmpty()) return points; + + scs::ElementHandle start = pairs[0].second; + scs::ElementHandle cur = start; + while (true) + { + if (!cur.IsValid()) break; + auto x = parser.GetParsedElement(findRelValueByIdtf(cur, SCgConsts::NREL_X)).GetValue(); + auto y = parser.GetParsedElement(findRelValueByIdtf(cur, SCgConsts::NREL_Y)).GetValue(); + points.push_back(QPointF(QString::fromStdString(x).toDouble(), + QString::fromStdString(y).toDouble())); + cur = findRelValueByIdtf(cur, SCgConsts::NREL_BASIC_SEQUENCE, false); + if (cur == start) return points; + } + cur = start; + while (true) + { + cur = findRelValueByIdtf(cur, SCgConsts::NREL_BASIC_SEQUENCE); + if (!cur.IsValid()) break; + auto x = parser.GetParsedElement(findRelValueByIdtf(cur, SCgConsts::NREL_X)).GetValue(); + auto y = parser.GetParsedElement(findRelValueByIdtf(cur, SCgConsts::NREL_Y)).GetValue(); + points.push_front(QPointF(QString::fromStdString(x).toDouble(), + QString::fromStdString(y).toDouble())); + } + return points; +} + +QHash SCgObjectInfoReader::getRelValues(const scs::ElementHandle &el) +{ + QHash values; + for (auto outPair : getOut(el)) + { + auto inVec = getIn(outPair.first); + for (auto inPair : getIn(outPair.first)) + { + scs::ParsedElement relNode = parser.GetParsedElement(inPair.second); + scs::ParsedElement relTarget = parser.GetParsedElement(outPair.second); + auto value = relTarget.GetType().IsLink() ? relTarget.GetValue() : relTarget.GetIdtf(); + values.insert(QString::fromStdString(relNode.GetIdtf()), + QString::fromStdString(value)); + } + } + return values; +} + +const QVector> & SCgObjectInfoReader::getIn(const scs::ElementHandle &elHandle) +{ + return inEdges[elHandle]; +} + +const QVector> & SCgObjectInfoReader::getOut(const scs::ElementHandle &elHandle) +{ + return outEdges[elHandle]; +} + +scs::ElementHandle SCgObjectInfoReader::findRelValueByIdtf(const scs::ElementHandle &el, const QString & idtf, bool out) +{ + auto edgePairs = (out ? getOut(el) : getIn(el)); + for (auto pair : edgePairs) + { + for (auto pair2 : getIn(pair.first)) + { + auto rel = pair2.second; + if (QString::fromStdString(parser.GetParsedElement(rel).GetIdtf()) == idtf) return pair.second; + } + } + return scs::ElementHandle(); +} + +QString SCgObjectInfoReader::getId(QString idtf) +{ + if (ids.find(idtf) == ids.end()) ids[idtf] = ++cnt; + return QString::number(ids[idtf]); +} + +QString SCgObjectInfoReader::getParentId(scs::ElementHandle const &el) +{ + if (parents.find(el) != parents.end()) + { + QString idtf = QString::fromStdString(parser.GetParsedElement(parents[el]).GetIdtf()); + return getId(idtf); + } + else + return "0"; +} + +QString SCgObjectInfoReader::getSystemIdtf(scs::ElementHandle const &el) +{ + auto link = parser.GetParsedElement(findRelValueByIdtf(el, "nrel_system_identifier")); + if (!link.GetType().IsLink()) return QString(); + QString systemIdtf = QString::fromStdString(link.GetValue()); + return systemIdtf; +} + +QString SCgObjectInfoReader::convertType(ScType type) +{ + static const QMap myTypes = + { + { ScType::EdgeUCommonConst, "pair/const/-/perm/noorient" }, + { ScType::EdgeDCommonConst, "pair/const/-/perm/orient" }, + { ScType::EdgeAccessConstFuzPerm, "pair/const/fuz/perm/orient/membership" }, + { ScType::EdgeAccessConstNegPerm, "pair/const/neg/perm/orient/membership" }, + { ScType::EdgeAccessConstPosPerm, "pair/const/pos/perm/orient/membership" }, + { ScType::EdgeAccessConstFuzTemp, "pair/const/fuz/temp/orient/membership" }, + { ScType::EdgeAccessConstNegTemp, "pair/const/neg/temp/orient/membership" }, + { ScType::EdgeAccessConstPosTemp, "pair/const/pos/temp/orient/membership" }, + + { ScType::EdgeUCommonVar, "pair/var/-/perm/noorient" }, + { ScType::EdgeDCommonVar, "pair/var/-/perm/orient" }, + { ScType::EdgeAccessVarFuzPerm, "pair/var/fuz/perm/orient/membership" }, + { ScType::EdgeAccessVarNegPerm, "pair/var/neg/perm/orient/membership" }, + { ScType::EdgeAccessVarPosPerm, "pair/var/pos/perm/orient/membership" }, + { ScType::EdgeAccessVarFuzTemp, "pair/var/fuz/temp/orient/membership" }, + { ScType::EdgeAccessVarNegTemp, "pair/var/neg/temp/orient/membership" }, + { ScType::EdgeAccessVarPosTemp, "pair/var/pos/temp/orient/membership" }, + + { ScType::EdgeDCommon, "pair/-/-/-/orient" }, + { ScType::EdgeUCommon, "pair/-/-/-/noorient" }, + + { ScType::LinkConst, "node/const/perm/general" }, + { ScType::NodeConst, "node/const/perm/general" }, + { ScType::NodeConstMaterial, "node/const/perm/general" }, + { ScType::NodeConstAbstract, "node/const/perm/terminal" }, + { ScType::NodeConstStruct, "node/const/perm/struct" }, + { ScType::NodeConstTuple, "node/const/perm/tuple" }, + { ScType::NodeConstRole, "node/const/perm/role" }, + { ScType::NodeConstNoRole, "node/const/perm/relation" }, + { ScType::NodeConstClass, "node/const/perm/group" }, + + { ScType::LinkVar, "node/var/perm/general" }, + { ScType::NodeVar, "node/var/perm/general" }, + { ScType::NodeVarAbstract, "node/var/perm/terminal" }, + { ScType::NodeVarStruct, "node/var/perm/struct" }, + { ScType::NodeVarTuple, "node/var/perm/tuple" }, + { ScType::NodeVarRole, "node/var/perm/role" }, + { ScType::NodeVarNoRole, "node/var/perm/relation" }, + { ScType::NodeVarClass, "node/var/perm/group" }, + }; + + return myTypes[type]; +} + +bool SCgObjectInfoReader::isTypeExtended(QString type) +{ + static const QSet exendedTypes = + { + SCgConsts::SC_NODE_NOT_DEFINE, + SCgConsts::SC_NODE_SUPER_GROUP, + SCgConsts::SC_NODE_SUPER_GROUP_VAR, + SCgConsts::SC_NODE_META, + SCgConsts::SC_NODE_ABSTRACT_META, + SCgConsts::SC_NODE_STRUCT_META, + SCgConsts::SC_NODE_TUPLE_META, + SCgConsts::SC_NODE_ROLE_RELATION_META, + SCgConsts::SC_NODE_NOROLE_RELATION_META, + SCgConsts::SC_NODE_CLASS_META, + SCgConsts::SC_NODE_SUPER_GROUP_META, + SCgConsts::SC_NODE_TEMP, + SCgConsts::SC_NODE_ABSTRACT_TEMP, + SCgConsts::SC_NODE_STRUCT_TEMP, + SCgConsts::SC_NODE_TUPLE_TEMP, + SCgConsts::SC_NODE_ROLE_RELATION_TEMP, + SCgConsts::SC_NODE_NOROLE_RELATION_TEMP, + SCgConsts::SC_NODE_CLASS_TEMP, + SCgConsts::SC_NODE_SUPER_GROUP_TEMP, + SCgConsts::SC_NODE_VAR_TEMP, + SCgConsts::SC_NODE_ABSTRACT_VAR_TEMP, + SCgConsts::SC_NODE_STRUCT_VAR_TEMP, + SCgConsts::SC_NODE_TUPLE_VAR_TEMP, + SCgConsts::SC_NODE_ROLE_RELATION_VAR_TEMP, + SCgConsts::SC_NODE_NOROLE_RELATION_VAR_TEMP, + SCgConsts::SC_NODE_CLASS_VAR_TEMP, + SCgConsts::SC_NODE_SUPER_GROUP_VAR_TEMP, + SCgConsts::SC_NODE_META_TEMP, + SCgConsts::SC_NODE_ABSTRACT_META_TEMP, + SCgConsts::SC_NODE_STRUCT_META_TEMP, + SCgConsts::SC_NODE_TUPLE_META_TEMP, + SCgConsts::SC_NODE_ROLE_RELATION_META_TEMP, + SCgConsts::SC_NODE_NOROLE_RELATION_META_TEMP, + SCgConsts::SC_NODE_CLASS_META_TEMP, + SCgConsts::SC_NODE_SUPER_GROUP_META_TEMP, + SCgConsts::SC_PAIR_CONST_TEMP_NOORIENT, + SCgConsts::SC_PAIR_CONST_TEMP_ORIENT, + SCgConsts::SC_PAIR_VAR_TEMP_NOORIENT, + SCgConsts::SC_PAIR_VAR_TEMP_ORIENT, + SCgConsts::SC_PAIR_META_PERM_NOORIENT, + SCgConsts::SC_PAIR_META_PERM_ORIENT, + SCgConsts::SC_PAIR_META_TEMP_NOORIENT, + SCgConsts::SC_PAIR_META_TEMP_ORIENT, + SCgConsts::SC_PAIR_META_POS_PERM_MEMBERSHIP, + SCgConsts::SC_PAIR_META_POS_TEMP_MEMBERSHIP, + SCgConsts::SC_PAIR_META_NEG_PERM_MEMBERSHIP, + SCgConsts::SC_PAIR_META_NEG_TEMP_MEMBERSHIP, + SCgConsts::SC_PAIR_META_FUZ_PERM_MEMBERSHIP, + SCgConsts::SC_PAIR_META_FUZ_TEMP_MEMBERSHIP + }; + + return exendedTypes.contains(type); +} + +QString SCgObjectInfoReader::convertExtendedType(QString const & type) { + static const QHash exendedTypes = + { + //! not define + { SCgConsts::SC_NODE_NOT_DEFINE, "node/-/-/not_define" }, + + //! const perm + { SCgConsts::SC_NODE_SUPER_GROUP, "node/const/perm/super_group" }, + + //! var perm + { SCgConsts::SC_NODE_SUPER_GROUP_VAR, "node/var/perm/super_group" }, + + //! meta perm + { SCgConsts::SC_NODE_META, "node/meta/perm/general" }, + { SCgConsts::SC_NODE_ABSTRACT_META, "node/meta/perm/terminal" }, + { SCgConsts::SC_NODE_STRUCT_META, "node/meta/perm/struct" }, + { SCgConsts::SC_NODE_TUPLE_META, "node/meta/perm/tuple" }, + { SCgConsts::SC_NODE_ROLE_RELATION_META, "node/meta/perm/role" }, + { SCgConsts::SC_NODE_NOROLE_RELATION_META, "node/meta/perm/relation" }, + { SCgConsts::SC_NODE_CLASS_META, "node/meta/perm/group" }, + { SCgConsts::SC_NODE_SUPER_GROUP_META, "node/meta/perm/super_group" }, + + //! const temp + { SCgConsts::SC_NODE_TEMP, "node/const/temp/general" }, + { SCgConsts::SC_NODE_ABSTRACT_TEMP, "node/const/temp/terminal" }, + { SCgConsts::SC_NODE_STRUCT_TEMP, "node/const/temp/struct" }, + { SCgConsts::SC_NODE_TUPLE_TEMP, "node/const/temp/tuple" }, + { SCgConsts::SC_NODE_ROLE_RELATION_TEMP, "node/const/temp/role" }, + { SCgConsts::SC_NODE_NOROLE_RELATION_TEMP, "node/const/temp/relation" }, + { SCgConsts::SC_NODE_CLASS_TEMP, "node/const/temp/group" }, + { SCgConsts::SC_NODE_SUPER_GROUP_TEMP, "node/const/temp/super_group" }, + + //! var temp + { SCgConsts::SC_NODE_VAR_TEMP, "node/var/temp/general" }, + { SCgConsts::SC_NODE_ABSTRACT_VAR_TEMP, "node/var/temp/terminal" }, + { SCgConsts::SC_NODE_STRUCT_VAR_TEMP, "node/var/temp/struct" }, + { SCgConsts::SC_NODE_TUPLE_VAR_TEMP, "node/var/temp/tuple" }, + { SCgConsts::SC_NODE_ROLE_RELATION_VAR_TEMP, "node/var/temp/role" }, + { SCgConsts::SC_NODE_NOROLE_RELATION_VAR_TEMP, "node/var/temp/relation" }, + { SCgConsts::SC_NODE_CLASS_VAR_TEMP, "node/var/temp/group" }, + { SCgConsts::SC_NODE_SUPER_GROUP_VAR_TEMP, "node/var/temp/super_group" }, + + //! meta temp + { SCgConsts::SC_NODE_TUPLE_META_TEMP, "node/meta/temp/general" }, + { SCgConsts::SC_NODE_ABSTRACT_META_TEMP, "node/meta/temp/terminal" }, + { SCgConsts::SC_NODE_STRUCT_META_TEMP, "node/meta/temp/struct" }, + { SCgConsts::SC_NODE_TUPLE_META_TEMP, "node/meta/temp/tuple" }, + { SCgConsts::SC_NODE_ROLE_RELATION_META_TEMP, "node/meta/temp/role" }, + { SCgConsts::SC_NODE_NOROLE_RELATION_META_TEMP, "node/meta/temp/relation" }, + { SCgConsts::SC_NODE_CLASS_META_TEMP, "node/meta/temp/group" }, + { SCgConsts::SC_NODE_SUPER_GROUP_META_TEMP, "node/meta/temp/super_group" }, + + //! pairs + { SCgConsts::SC_PAIR_CONST_TEMP_NOORIENT, "pair/const/-/temp/noorient" }, + { SCgConsts::SC_PAIR_CONST_TEMP_ORIENT, "pair/const/-/temp/orient" }, + { SCgConsts::SC_PAIR_VAR_TEMP_NOORIENT, "pair/var/-/temp/noorient" }, + { SCgConsts::SC_PAIR_VAR_TEMP_ORIENT, "pair/var/-/temp/orient" }, + + { SCgConsts::SC_PAIR_META_PERM_NOORIENT, "pair/meta/-/perm/noorient" }, + { SCgConsts::SC_PAIR_META_PERM_ORIENT, "pair/meta/-/perm/orient" }, + { SCgConsts::SC_PAIR_META_TEMP_NOORIENT, "pair/meta/-/temp/noorient" }, + { SCgConsts::SC_PAIR_META_TEMP_ORIENT, "pair/meta/-/temp/orient" }, + { SCgConsts::SC_PAIR_META_POS_PERM_MEMBERSHIP, "pair/meta/pos/perm/orient/membership" }, + { SCgConsts::SC_PAIR_META_POS_TEMP_MEMBERSHIP, "pair/meta/pos/temp/orient/membership" }, + { SCgConsts::SC_PAIR_META_NEG_PERM_MEMBERSHIP, "pair/meta/neg/perm/orient/membership" }, + { SCgConsts::SC_PAIR_META_NEG_TEMP_MEMBERSHIP, "pair/meta/neg/temp/orient/membership" }, + { SCgConsts::SC_PAIR_META_FUZ_PERM_MEMBERSHIP, "pair/meta/fuz/perm/orient/membership" }, + { SCgConsts::SC_PAIR_META_FUZ_TEMP_MEMBERSHIP, "pair/meta/fuz/temp/orient/membership" }, + }; + return exendedTypes[type]; + +} diff --git a/sources/plugins/scg/scs/scgobjectinforeader.h b/sources/plugins/scg/scs/scgobjectinforeader.h new file mode 100644 index 0000000..8998cab --- /dev/null +++ b/sources/plugins/scg/scs/scgobjectinforeader.h @@ -0,0 +1,80 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class SCgObjectInfo; + +class SCgObjectInfoReader +{ +public: + typedef QList ObjectInfoList; + typedef QMap TypeToObjectsMap; + + SCgObjectInfoReader(bool isOwner = true); + + explicit SCgObjectInfoReader(QIODevice *dev, QIODevice *layoutdev, bool isOwner = true); + + virtual ~SCgObjectInfoReader(); + + //! This method must be called before any access to elements. + bool read(QIODevice *dev, QIODevice *layoutDev); + + const TypeToObjectsMap& objectsInfo() const + { + return mObjectsInfo; + } +private: + const int CONTENT_TYPE_IMAGE = 4; + + TypeToObjectsMap mObjectsInfo; + scs::Parser parser; + QMap parents; + QHash ids; + int cnt = 0; + + QMap> edges; + QMap>> outEdges; + QMap>> inEdges; + QTextStream scsStream; + QTextStream scgStream; + + void parseNode(const scs::ElementHandle &node, const scs::ElementHandle &scgNode); + void parseNode2(const scs::ElementHandle &node, const scs::ElementHandle &scgNode, QString const & typev); + void parsePair(const scs::ElementHandle &pair, const scs::ElementHandle &scsPair); + void parseBus(const scs::ElementHandle &bus); + void parseContour(const scs::ElementHandle &contour); + + void addEdge(const scs::ElementHandle &edge, const scs::ElementHandle &start, const scs::ElementHandle &end); + QPair getEdge(const scs::ElementHandle &el); + QVector getPoints(const scs::ElementHandle &set); + QHash getRelValues(const scs::ElementHandle &el); + const QVector> & getIn(const scs::ElementHandle &el); + const QVector> & getOut(const scs::ElementHandle &el); + scs::ElementHandle findRelValueByIdtf(const scs::ElementHandle &el, const QString &idtf, bool out = true); + + QString getId(QString idtf); + QString getParentId(const scs::ElementHandle &el); + QString getSystemIdtf(const scs::ElementHandle &el); + + static QString convertType(ScType type); + bool isTypeExtended(QString type); + static QString convertExtendedType(QString const & type); + + //! Deletes all read info. + void del(); + + //! Holds true if this object takes ownership of created info structures. + bool mIsOwner; + + QPair mVersion; +}; diff --git a/sources/plugins/scg/scs/scgstreamwriter.cpp b/sources/plugins/scg/scs/scgstreamwriter.cpp new file mode 100644 index 0000000..ae9f201 --- /dev/null +++ b/sources/plugins/scg/scs/scgstreamwriter.cpp @@ -0,0 +1,542 @@ +#include "scgstreamwriter.h" + +#include "scgobject.h" +#include "scgnode.h" +#include "scgbus.h" +#include "scgcontour.h" +#include "scgpair.h" + +#include "scgtextitem.h" + +#include +#include + +#include "scgconsts.h" + +const QString SCgStreamWriter::END_LINE = "\n"; +const QString SCgStreamWriter::END_PART_SENT = ";\n"; +const QString SCgStreamWriter::END_SENT = ";;\n"; +const QString SCgStreamWriter::TAB = "\t"; + +SCgStreamWriter::SCgStreamWriter() {} + +void SCgStreamWriter::setOutputFiles(QIODevice *device, QIODevice *layoutDevice) +{ + scs.setDevice(device); + scg.setDevice(layoutDevice); +} + +void SCgStreamWriter::preprocess(QVector const & vec) +{ + for (auto obj : vec) + { + int parId = obj->parentId(); + if (parId != 0) + children[parId].push_back(obj); + } + + for (auto obj : vec) + { + if (obj->type() == SCgPair::Type) + { + SCgPair *pair = static_cast(obj); + auto tmp = {pair->beginObject(), pair->endObject()}; + for (auto obj : tmp) + { + if (obj->type() == SCgPair::Type || obj->type() == SCgContour::Type) + deps[pair].push_back(obj); + } + } + } +} + + +void SCgStreamWriter::writeOrdered(QVector const & vec) +{ + for (auto obj : vec) + writeObjectWithDeps(obj); +} + +void SCgStreamWriter::writeObjectWithDeps(SCgObject *obj) +{ + enum {STATUS_NOT_QUEUED, STATUS_QUEUED, STATUS_PROCESSED, STATUS_WRITTEN}; + + if (dfsStatus[obj] == STATUS_WRITTEN) return; + + //! DFS + QStack stack; + stack.push_front(obj); + dfsStatus[obj] = STATUS_QUEUED; + while (!stack.isEmpty()) + { + SCgObject *cur = stack.front(); + if (dfsStatus[cur] == STATUS_PROCESSED) + { + writeObject(cur); + dfsStatus[cur] = STATUS_WRITTEN; + stack.pop_front(); + } + else + { + dfsStatus[cur] = STATUS_PROCESSED; + if (deps.find(cur) == deps.end()) continue; + for (auto dep : deps[cur]) + { + if (dfsStatus[dep] == STATUS_NOT_QUEUED) + { + stack.push_front(dep); + dfsStatus[dep] = STATUS_QUEUED; + } + } + } + } +} + +void SCgStreamWriter::writeObject(SCgObject *obj) +{ + switch (obj->type()) + { + case SCgNode::Type: + writeNode(obj); + break; + case SCgPair::Type: + writePair(obj); + break; + case SCgBus::Type: + writeBus(obj); + break; + case SCgContour::Type: + writeContour(obj); + break; + default: + break; + } + scs.write(getIdtf(obj) + " => nrel_system_identifier: " + linkWrap(obj->idtfValue()) + END_SENT); +} + +void SCgStreamWriter::writeNode(SCgObject *obj) +{ + SCgNode *node = static_cast(obj); + + QString idtf = getIdtf(obj); + QString scgIdtf = getSCgIdtf(obj); + + //! scs + if (node->contentType() != 0) + { + QString content; + if (node->contentType() == 4) + content = node->contentData().toByteArray().toBase64(); + else + content = node->contentData().toString(); + scs.write(idtf + " = " + linkWrap(content) + END_SENT); + } + + //! scg + RelationValueVector values; + values.push_back({ SCgConsts::NREL_SCG_REPRESENTATION, scgIdtf }); + writeSCgProperties(idtf, values); + + values.clear(); + values.push_back({ SCgConsts::NREL_X, linkWrap(node->scenePos().x()) }); + values.push_back({ SCgConsts::NREL_Y, linkWrap(node->scenePos().y()) }); + if (idtf != "") + values.push_back({ SCgConsts::NREL_IDTF_POS, linkWrap(node->idtfPos()) }); + if (node->contentType() != 0) + { + values.push_back({ SCgConsts::NREL_CONTENT_TYPE, linkWrap(node->contentType()) }); + values.push_back({ SCgConsts::NREL_CONTENT_MIME_TYPE, linkWrap(node->contentMimeType()) }); + values.push_back({ SCgConsts::NREL_CONTENT_VISIBLE, node->isContentVisible() ? "1" : "0" }); + values.push_back({ SCgConsts::NREL_CONTENT_FILENAME, linkWrap(node->contentFileName()) }); + } + writeSCgProperties(scgIdtf, values); + scg.write(idtf + " <- " + convertType(obj->typeAlias()) + END_SENT); +} + +void SCgStreamWriter::writePair(SCgObject *obj) +{ + QString idtf = getIdtf(obj); + SCgPair *pair = static_cast(obj); + + QString scgIdtf = getSCgIdtf(obj); + + // scs + SCgObject *begin = pair->beginObject(), + *end = pair->endObject(); + if (begin->type() == SCgBus::Type) begin = static_cast(begin)->owner(); + if (end->type() == SCgBus::Type) end = static_cast(end)->owner(); + + QString buf; + QTextStream s(&buf); + s << idtf << " = (" << getIdtf(begin) << " " << + convertType(obj->typeAlias()) << " " << getIdtf(end) << ")" << END_SENT; + scs.write(s.readAll()); + + //! scg + begin = pair->beginObject(); + end = pair->endObject(); + buf = QString(); + s.setString(&buf); + s << scgIdtf << " = (" << getSCgIdtf(begin) << " " << + convertType(obj->typeAlias()) << " " << getSCgIdtf(end) << ")" << END_SENT; + scg.write(s.readAll()); + + RelationValueVector values; + values.push_back({ SCgConsts::NREL_SCG_REPRESENTATION, scgIdtf }); + writeSCgProperties(idtf, values); + + values.clear(); + values.push_back({ SCgConsts::NREL_START_RATIO, linkWrap(pair->beginDot()) }); + values.push_back({ SCgConsts::NREL_END_RATIO, linkWrap(pair->endDot()) }); + writeSCgProperties(scgIdtf, values); + + QVector points = pair->scenePoints(); + points.pop_back(); + points.pop_front(); + writePoints(scgIdtf, points, false); + + if (convertExtendedType(obj->typeAlias()) != "") + scg.write(idtf + " <- " + convertExtendedType(obj->typeAlias()) + END_SENT); +} + +void SCgStreamWriter::writeBus(SCgObject *obj) +{ + QString idtf = getIdtf(obj); + SCgBus *bus = static_cast(obj); + + QString buf; + QTextStream s(&buf); + + //! scg + s << idtf + END_LINE; + s << TAB + "<- " + SCgConsts::CONCEPT_SCG_BUS + END_PART_SENT; + s << TAB + "=> " + SCgConsts::NREL_OWNER + ": " + getSCgIdtf(bus->owner()) + END_SENT; + scg.write(s.readAll()); + + QVector points = bus->scenePoints(); + points.pop_front(); + writePoints(idtf, points, false); +} + +void SCgStreamWriter::writeContour(SCgObject *obj) +{ + QString idtf = getIdtf(obj); + SCgContour *contour = static_cast(obj); + + QString buf; + QTextStream s(&buf); + + QVector points = contour->scenePoints(); + writePoints(idtf, points, true); + + scs.write(idtf + " = [*" + END_LINE); + scs.indent.append(TAB); + writeOrdered(children[obj->id()]); + scs.indent.chop(1); + scs.write("*]" + END_SENT); + + auto vec = children[obj->id()]; + s << idtf + " <- " + SCgConsts::CONCEPT_SCG_CONTOUR + END_SENT; + if (vec.size() > 0) + { + s << idtf << " => " + SCgConsts::NREL_INCLUDING + ": {" << END_LINE; + for (int i = 0; i < vec.size() - 1; i++) + s << TAB << getSCgIdtf(vec[i]) << END_PART_SENT; + s << TAB << getSCgIdtf(vec[vec.size() - 1]) << END_LINE; + s << "}" << END_SENT; + } + scg.write(s.readAll()); +} + +void SCgStreamWriter::writeSCgProperties(QString const & idtf, RelationValueVector const & relations) +{ + int size = relations.size(); + //assert(size != 0); + QString buf; + QTextStream s(&buf); + s << idtf << END_LINE; + for (int i = 0; i < size; i++) + { + auto relPair = relations[i]; + s << TAB << "=> " << relPair.first << ": " << relPair.second << (i == size - 1 ? END_SENT : END_PART_SENT); + } + scg.write(s.readAll()); +} + +void SCgStreamWriter::writePoints(QString const & idtf, QVector const & points, bool cyclic) +{ + if (points.size() == 0) return; + QString buf; + QTextStream s(&buf); + + int size = points.size(); + QVector names(size); + for (int i = 0; i < size; i++) + names[i] = getTemp("point"); + + s << idtf + " => " + SCgConsts::NREL_DECOMPOSITION + ": {" + END_LINE; + for (int i = 0; i < size; i++) + { + if (i < size - 1) + s << TAB + names[i] + END_PART_SENT; + else + s << TAB + names[size - 1] + END_LINE; + } + s << "}" + END_SENT; + scg.write(s.readAll()); + for (int i = 0; i < size; i++) + { + RelationValueVector values; + values.push_back({ SCgConsts::NREL_X, linkWrap(points.at(i).x()) }); + values.push_back({ SCgConsts::NREL_Y, linkWrap(points.at(i).y()) }); + if (i > 0) + values.push_back({ SCgConsts::NREL_BASIC_SEQUENCE, names[i - 1] }); + else if (cyclic) + values.push_back({ SCgConsts::NREL_BASIC_SEQUENCE, names[size - 1] }); + + writeSCgProperties(names[i], values); + } +} + +QString SCgStreamWriter::linkWrap(QString const & idtf) +{ + return "[" + idtf + "]"; +} + +QString SCgStreamWriter::linkWrap(int number) +{ + return "[" + QString::number(number) + "]"; +} + +QString SCgStreamWriter::linkWrap(double number) +{ + return "[" + QString::number(number) + "]"; +} + +QString SCgStreamWriter::convertType(QString const & type) +{ + static const QHash types = + { + //! not define + { "node/-/-/not_define", SCgConsts::SC_NODE_NOT_DEFINE }, + + //! const perm + { "node/const/perm/general", "sc_node" }, + { "node/const/perm/terminal", "sc_node_abstract" }, + { "node/const/perm/struct", "sc_node_struct" }, + { "node/const/perm/tuple", "sc_node_tuple" }, + { "node/const/perm/role", "sc_node_role_relation" }, + { "node/const/perm/relation", "sc_node_norole_relation" }, + { "node/const/perm/group", "sc_node_class" }, + { "node/const/perm/super_group", SCgConsts::SC_NODE_SUPER_GROUP }, + + //! var perm + { "node/var/perm/general", "sc_node" }, + { "node/var/perm/terminal", "sc_node_abstract" }, + { "node/var/perm/struct", "sc_node_struct" }, + { "node/var/perm/tuple", "sc_node_tuple" }, + { "node/var/perm/role", "sc_node_role_relation" }, + { "node/var/perm/relation", "sc_node_norole_relation" }, + { "node/var/perm/group", "sc_node_class" }, + { "node/var/perm/super_group", SCgConsts::SC_NODE_SUPER_GROUP_VAR }, + + //! meta perm + { "node/meta/perm/general", SCgConsts::SC_NODE_META }, + { "node/meta/perm/terminal", SCgConsts::SC_NODE_ABSTRACT_META }, + { "node/meta/perm/struct", SCgConsts::SC_NODE_STRUCT_META }, + { "node/meta/perm/tuple", SCgConsts::SC_NODE_TUPLE_META }, + { "node/meta/perm/role", SCgConsts::SC_NODE_ROLE_RELATION_META }, + { "node/meta/perm/relation", SCgConsts::SC_NODE_NOROLE_RELATION_META }, + { "node/meta/perm/group", SCgConsts::SC_NODE_CLASS_META }, + { "node/meta/perm/super_group", SCgConsts::SC_NODE_SUPER_GROUP_META }, + + //! const temp + { "node/const/temp/general", SCgConsts::SC_NODE_TEMP }, + { "node/const/temp/terminal", SCgConsts::SC_NODE_ABSTRACT_TEMP }, + { "node/const/temp/struct", SCgConsts::SC_NODE_STRUCT_TEMP }, + { "node/const/temp/tuple", SCgConsts::SC_NODE_TUPLE_TEMP }, + { "node/const/temp/role", SCgConsts::SC_NODE_ROLE_RELATION_TEMP }, + { "node/const/temp/relation", SCgConsts::SC_NODE_NOROLE_RELATION_TEMP }, + { "node/const/temp/group", SCgConsts::SC_NODE_CLASS_TEMP }, + { "node/const/temp/super_group", SCgConsts::SC_NODE_SUPER_GROUP_TEMP }, + + //! var temp + { "node/var/temp/general", SCgConsts::SC_NODE_VAR_TEMP }, + { "node/var/temp/terminal", SCgConsts::SC_NODE_ABSTRACT_VAR_TEMP }, + { "node/var/temp/struct", SCgConsts::SC_NODE_STRUCT_VAR_TEMP }, + { "node/var/temp/tuple", SCgConsts::SC_NODE_TUPLE_VAR_TEMP }, + { "node/var/temp/role", SCgConsts::SC_NODE_ROLE_RELATION_VAR_TEMP }, + { "node/var/temp/relation", SCgConsts::SC_NODE_NOROLE_RELATION_VAR_TEMP }, + { "node/var/temp/group", SCgConsts::SC_NODE_CLASS_VAR_TEMP }, + { "node/var/temp/super_group", SCgConsts::SC_NODE_SUPER_GROUP_VAR_TEMP }, + + //! meta temp + { "node/meta/temp/general", SCgConsts::SC_NODE_META_TEMP }, + { "node/meta/temp/terminal", SCgConsts::SC_NODE_ABSTRACT_META_TEMP }, + { "node/meta/temp/struct", SCgConsts::SC_NODE_STRUCT_META_TEMP }, + { "node/meta/temp/tuple", SCgConsts::SC_NODE_TUPLE_META_TEMP }, + { "node/meta/temp/role", SCgConsts::SC_NODE_ROLE_RELATION_META_TEMP }, + { "node/meta/temp/relation", SCgConsts::SC_NODE_NOROLE_RELATION_META_TEMP }, + { "node/meta/temp/group", SCgConsts::SC_NODE_CLASS_META_TEMP }, + { "node/meta/temp/super_group", SCgConsts::SC_NODE_SUPER_GROUP_META_TEMP }, + + + { "pair/const/-/perm/noorient", "<=>" }, + { "pair/const/-/perm/orient", "=>" }, + { "pair/const/fuz/perm/orient/membership", "-/>" }, + { "pair/const/neg/perm/orient/membership", "-|>" }, + { "pair/const/pos/perm/orient/membership", "->" }, + { "pair/const/fuz/temp/orient/membership", "~/>" }, + { "pair/const/neg/temp/orient/membership", "~|>" }, + { "pair/const/pos/temp/orient/membership", "~>" }, + { "pair/const/-/temp/noorient", "<=>" }, //not supported + { "pair/const/-/temp/orient", "=>" }, //not supported + + { "pair/var/-/perm/noorient", "_<=>" }, + { "pair/var/-/perm/orient", "_=>" }, + { "pair/var/fuz/perm/orient/membership", "_-/>" }, + { "pair/var/neg/perm/orient/membership", "_-|>" }, + { "pair/var/pos/perm/orient/membership", "_->" }, + { "pair/var/fuz/temp/orient/membership", "_~/>" }, + { "pair/var/neg/temp/orient/membership", "_~|>" }, + { "pair/var/pos/temp/orient/membership", "_~>" }, + { "pair/var/-/temp/noorient", ">" }, //not supported + { "pair/var/-/temp/orient", ">" }, //not supported + + { "pair/meta/-/perm/noorient", ">" }, //not supported + { "pair/meta/-/perm/orient", ">" }, //not supported + { "pair/meta/-/temp/noorient", ">" }, //not supported + { "pair/meta/-/temp/orient", ">" }, //not supported + { "pair/meta/pos/perm/orient/membership", ">" }, //not supported + { "pair/meta/pos/temp/orient/membership", ">" }, //not supported + { "pair/meta/neg/perm/orient/membership", ">" }, //not supported + { "pair/meta/neg/temp/orient/membership", ">" }, //not supported + { "pair/meta/fuz/perm/orient/membership", ">" }, //not supported + { "pair/meta/fuz/temp/orient/membership", ">" }, //not supported + + { "pair/-/-/-/orient", ">" }, + { "pair/-/-/-/noorient", "<>" }, + }; + + return types[type]; +} + +QString SCgStreamWriter::convertExtendedType(QString const & type) +{ + static const QHash types = + { + { "pair/const/-/temp/noorient", SCgConsts::SC_PAIR_CONST_TEMP_NOORIENT }, + { "pair/const/-/temp/orient", SCgConsts::SC_PAIR_CONST_TEMP_ORIENT}, + + { "pair/var/-/temp/noorient", SCgConsts::SC_PAIR_VAR_TEMP_NOORIENT }, + { "pair/var/-/temp/orient", SCgConsts::SC_PAIR_VAR_TEMP_ORIENT }, + + { "pair/meta/-/perm/noorient", SCgConsts::SC_PAIR_META_PERM_NOORIENT }, + { "pair/meta/-/perm/orient", SCgConsts::SC_PAIR_META_PERM_ORIENT }, + { "pair/meta/-/temp/noorient", SCgConsts::SC_PAIR_META_TEMP_NOORIENT }, + { "pair/meta/-/temp/orient", SCgConsts::SC_PAIR_META_TEMP_ORIENT }, + { "pair/meta/pos/perm/orient/membership", SCgConsts::SC_PAIR_META_POS_PERM_MEMBERSHIP }, + { "pair/meta/pos/temp/orient/membership", SCgConsts::SC_PAIR_META_POS_TEMP_MEMBERSHIP }, + { "pair/meta/neg/perm/orient/membership", SCgConsts::SC_PAIR_META_NEG_PERM_MEMBERSHIP }, + { "pair/meta/neg/temp/orient/membership", SCgConsts::SC_PAIR_META_NEG_TEMP_MEMBERSHIP }, + { "pair/meta/fuz/perm/orient/membership", SCgConsts::SC_PAIR_META_FUZ_PERM_MEMBERSHIP }, + { "pair/meta/fuz/temp/orient/membership", SCgConsts::SC_PAIR_META_FUZ_TEMP_MEMBERSHIP }, + }; + + return types[type]; +} + +SCgStreamWriter::StreamWriter::StreamWriter() +{ +} + +SCgStreamWriter::StreamWriter::StreamWriter(QIODevice *device) : stream(device) +{ +} + +void SCgStreamWriter::StreamWriter::write(QString s) +{ + QTextStream temp(&s); + while (!temp.atEnd()) + stream << indent << temp.readLine() << END_LINE; +} + +void SCgStreamWriter::StreamWriter::setDevice(QIODevice *device) +{ + stream.setDevice(device); +} + +QString SCgStreamWriter::getIdtf(QString const & base) +{ + return base + QString::number(count[base]++); +} + +QString SCgStreamWriter::makeAlias(QString const & base) +{ + return "@" + base; +} + +QString SCgStreamWriter::makeTemp(QString const & base) +{ + return ".." + base; +} + +QString SCgStreamWriter::getIdtf(SCgObject *obj) +{ + //! Check if idtf is already defined. + uint64_t id = obj->id(); + if (names.find(id) != names.end()) return names[id]; + + //! Define idtf when it is not defined + QString name; + if (obj->type() == SCgNode::Type) + { + SCgNode *node = static_cast(obj); + if (node->contentType() != 0) + { + name = getAlias("link"); + names[id] = name; + } + else { + SCgAlphabet &alphabet = SCgAlphabet::getInstance(); + QStringList splittedAlias = obj->typeAlias().split("/"); + bool isVar = splittedAlias.at(1) == alphabet.aliasFromConstCode(SCgAlphabet::Var); + if (isVar) + names[id] = getTemp("_node"); + else + names[id] = getTemp("node"); + } + } + else if (obj->type() == SCgPair::Type) + names[id] = getAlias("pair"); + else if (obj->type() == SCgBus::Type) + names[id] = getTemp("bus"); + else if (obj->type() == SCgContour::Type) + names[id] = getAlias("contour"); + return names[id]; +} + +QString SCgStreamWriter::getSCgIdtf(SCgObject *obj) +{ + if (obj->type() != SCgNode::Type && obj->type() != SCgPair::Type) + return getIdtf(obj); + + uint64_t id = obj->id(); + if (scgNames.find(id) == scgNames.end()) + { + if (obj->type() == SCgNode::Type) scgNames[id] = getTemp("scgNode"); + if (obj->type() == SCgPair::Type) scgNames[id] = getAlias("scgPair"); + } + + return scgNames[id]; +} + +QString SCgStreamWriter::getAlias(QString const & base) +{ + return makeAlias(getIdtf(base)); +} + +QString SCgStreamWriter::getTemp(QString const & base) +{ + return makeTemp(getIdtf(base)); +} diff --git a/sources/plugins/scg/scs/scgstreamwriter.h b/sources/plugins/scg/scs/scgstreamwriter.h new file mode 100644 index 0000000..7edcfcf --- /dev/null +++ b/sources/plugins/scg/scs/scgstreamwriter.h @@ -0,0 +1,78 @@ +#pragma once + +#include +#include +#include +#include + +class SCgObject; +class SCgContour; +class SCgNode; + +class StreamWriter; +class QTextStream; + +class SCgStreamWriter +{ +public: + typedef QVector> RelationValueVector; + + SCgStreamWriter(); + + void setOutputFiles(QIODevice *device, QIODevice *layoutDevice); + + void preprocess(QVector const & vec); + void writeOrdered(QVector const & vec); + +private: + class StreamWriter + { + public: + QString indent; + StreamWriter(); + StreamWriter(QIODevice *device); + void write(QString s); + void setDevice(QIODevice *device); + ~StreamWriter(){} + private: + QTextStream stream; + }; + + static const QString END_LINE; + static const QString END_PART_SENT; + static const QString END_SENT; + static const QString TAB; + + void writeObject(SCgObject *object); + void writeObjectWithDeps(SCgObject *obj); + void writeNode(SCgObject *obj); + void writePair(SCgObject *obj); + void writeBus(SCgObject *obj); + void writeContour(SCgObject *obj); + void writeSCgProperties(QString const & idtf, RelationValueVector const & properties); + void writePoints(QString const & idtf, QVector const & points, bool cyclic); + + QString linkWrap(QString const & idtf); + QString linkWrap(int number); + QString linkWrap(double number); + QString getIdtf(QString const & prefix); + QString getIdtf(SCgObject *obj); + QString getSCgIdtf(SCgObject *obj); + QString getAlias(QString const & base); + QString getTemp(QString const & base); + QString makeAlias(QString const & base); + QString makeTemp(QString const & base); + QString convertType(QString const & type); + QString convertExtendedType(QString const & type); + + StreamWriter scg; + StreamWriter scs; + + QHash > children; + QHash> deps; + QHash dfsStatus; + + QHash count; + QHash names; + QHash scgNames; +};