Mercurial > projects > qtd
diff generator/typesystem.cpp @ 42:eb3b5bbffc8f
CMake: generator is not running multiple times.
generator: packages can have dependencies now (but this do not used in real code yet).
author | SokoL_SD |
---|---|
date | Sun, 17 May 2009 15:53:27 +0000 |
parents | a9626891eca6 |
children | 3cb15c92ac28 |
line wrap: on
line diff
--- a/generator/typesystem.cpp Sun May 17 12:41:14 2009 +0000 +++ b/generator/typesystem.cpp Sun May 17 15:53:27 2009 +0000 @@ -95,6 +95,7 @@ SimpleMask = 0xf00, // qtd stuff AddClass = 0x1100, + PackageDepend = 0x1200, // Code snip tags (0x1000, 0x2000, ... , 0xf000) InjectCode = 0x1000, @@ -181,6 +182,8 @@ // qtd tagNames["add-class"] = StackElement::AddClass; tagNames["store-result"] = StackElement::StoreResult; + + tagNames["package-depend"] = StackElement::PackageDepend; } bool startElement(const QString &namespaceURI, const QString &localName, @@ -217,6 +220,7 @@ QHash<QString, StackElement::ElementType> tagNames; QString m_source_dir; + QStringList m_defaultDepends; }; bool Handler::error(const QXmlParseException &e) @@ -565,6 +569,7 @@ element->entry = m_current_enum; m_current_enum->setCodeGeneration(m_generate); m_current_enum->setTargetLangPackage(m_defaultPackage); + //m_current_enum->setDepends(m_defaultDepends); // For enums its not needed? m_current_enum->setUpperBound(attributes["upper-bound"]); m_current_enum->setLowerBound(attributes["lower-bound"]); m_current_enum->setForceInteger(convertBoolean(attributes["force-integer"], "force-integer", false)); @@ -633,6 +638,7 @@ ComplexTypeEntry *ctype = static_cast<ComplexTypeEntry *>(element->entry); ctype->setTargetLangPackage(attributes["package"]); + //ctype->setDepends(m_defaultDepends); ctype->setDefaultSuperclass(attributes["default-superclass"]); ctype->setGenericClass(convertBoolean(attributes["generic-class"], "generic-class", false)); @@ -683,7 +689,10 @@ // ctype->setInclude(Include(Include::IncludePath, ctype->name())); ctype = ctype->designatedInterface(); if (ctype != 0) + { ctype->setTargetLangPackage(attributes["package"]); + ctype->setDepends(m_defaultDepends); + } } break; default: @@ -701,7 +710,8 @@ || element->type == StackElement::Rejection || element->type == StackElement::LoadTypesystem || element->type == StackElement::InjectCode - || element->type == StackElement::Template; + || element->type == StackElement::Template + || element->type == StackElement::PackageDepend; if (!topLevel && current->type == StackElement::Root) { m_error = QString("Tag requires parent: '%1'").arg(tagName); @@ -819,6 +829,9 @@ case StackElement::AddClass: attributes["name"] = QString(); break; + case StackElement::PackageDepend: + attributes["package"] = QString(); + break; default: ; // nada }; @@ -1444,6 +1457,16 @@ } element->parent->value.templateInstance->addReplaceRule(attributes["from"],attributes["to"]); break; + case StackElement::PackageDepend: + { + QString package = attributes["package"]; + if (package.isEmpty()) { + m_error = "bad package depend entry"; + return false; + } + m_defaultDepends << package; + } + break; default: break; // nada };