diff options
author | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2015-09-25 16:54:53 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2015-10-06 10:29:18 +0300 |
commit | 3ba4e768e98fae888e51795a2f4ac4913d0a0fc0 (patch) | |
tree | 8abf3eff512df697dc26a32952a826f9313698d3 /tools/qscxmlc/qscxmlc.cpp | |
parent | 378644d9420825993bc8a9ebee93fa713385fc38 (diff) |
Add properties for nested state machines.
Change-Id: I80893af6755ca9b731c0701a38b55b8596f84f94
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'tools/qscxmlc/qscxmlc.cpp')
-rw-r--r-- | tools/qscxmlc/qscxmlc.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/qscxmlc/qscxmlc.cpp b/tools/qscxmlc/qscxmlc.cpp index c0f0d18..b1c073b 100644 --- a/tools/qscxmlc/qscxmlc.cpp +++ b/tools/qscxmlc/qscxmlc.cpp @@ -59,6 +59,15 @@ int write(TranslationUnit *tu) return NoError; } +static void collectAllDocuments(DocumentModel::ScxmlDocument *doc, QMap<DocumentModel::ScxmlDocument *, QString> *docs) +{ + docs->insert(doc, doc->root->name); + foreach (DocumentModel::ScxmlDocument *subDoc, doc->allSubDocuments) { + collectAllDocuments(subDoc, docs); + } +} + + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); @@ -133,17 +142,8 @@ int main(int argc, char *argv[]) return ScxmlVerificationError; } - struct : public DocumentModel::NodeVisitor { - bool visit(DocumentModel::Invoke *invoke) Q_DECL_OVERRIDE { - if (DocumentModel::ScxmlDocument *doc = invoke->content.data()) { - docs.insert(doc, doc->root->name); - } - return true; - } - - QMap<DocumentModel::ScxmlDocument *, QString> docs; - } collector; - mainDoc->root->accept(&collector); + QMap<DocumentModel::ScxmlDocument *, QString> docs; + collectAllDocuments(mainDoc, &docs); if (mainClassname.isEmpty()) mainClassname = mainDoc->root->name; if (mainClassname.isEmpty()) { @@ -152,13 +152,13 @@ int main(int argc, char *argv[]) if (dot != -1) mainClassname = mainClassname.left(dot); } - collector.docs.insert(mainDoc, mainClassname); + docs.insert(mainDoc, mainClassname); TranslationUnit tu = options; tu.mainDocument = mainDoc; tu.outHFileName = outHFileName; tu.outCppFileName = outCppFileName; - for (QMap<DocumentModel::ScxmlDocument *, QString>::const_iterator i = collector.docs.begin(), ei = collector.docs.end(); i != ei; ++i) { + for (QMap<DocumentModel::ScxmlDocument *, QString>::const_iterator i = docs.begin(), ei = docs.end(); i != ei; ++i) { auto name = i.value(); if (name.isEmpty()) { name = QStringLiteral("%1_StateMachine_%2").arg(mainClassname).arg(tu.classnameForDocument.size() + 1); |