- if(portId.compare("in", CaseInsensitive) == 0) {\r
- QDomElement input = doc.createElement("input");\r
- input.setAttribute("name",portName);\r
- input.setAttribute("width", width);\r
- inputs.appendChild(input);\r
- }\r
- else if(portId.compare("out", CaseInsensitive) == 0) {\r
- QDomElement output = doc.createElement("output");\r
- output.setAttribute("name",portName);\r
- output.setAttribute("width", width);\r
- outputs.appendChild(output);\r
- }\r
- else if(portId.compare("inout", CaseInsensitive) == 0) {\r
- QDomElement bidir = doc.createElement("bidir");\r
- bidir.setAttribute("name",portName);\r
- bidir.setAttribute("width", width);\r
- bidirs.appendChild(bidir);\r
- }\r
+ QRegularExpression rxPack("^([^.]+)[.](.+)$",QRegularExpression::CaseInsensitiveOption);\r
+\r
+ QDomElement eBlock = doc.createElement("block_impl");\r
+ eBlock.setAttribute("ref_name", entityName+".xml");\r
+ eBlock.setAttribute("ref_md5", "");\r
+ doc.appendChild(eBlock);\r
+\r
+ // creating infos\r
+ QDomElement comments = doc.createElement("comments");\r
+ eBlock.appendChild(comments);\r
+\r
+ QDomElement author = doc.createElement("author");\r
+ author.setAttribute("firstname","");\r
+ author.setAttribute("lastname","");\r
+ author.setAttribute("mail","");\r
+ comments.appendChild(author);\r
+\r
+ QDomElement date = doc.createElement("date");\r
+ date.setAttribute("creation","");\r
+ comments.appendChild(date);\r
+\r
+ QString brief = teBrief->toPlainText();\r
+ QString detailed = teDesc->toPlainText();\r
+ QDomElement eDesc = doc.createElement("description");\r
+ if(!brief.isEmpty()) {\r
+ QDomText txtBrief = doc.createTextNode(brief);\r
+ eDesc.appendChild(txtBrief);\r
+ comments.appendChild(eDesc);\r
+ }\r
+ QDomElement eNotes = doc.createElement("notes");\r
+ if(!detailed.isEmpty()) {\r
+ QDomText txtDetailed = doc.createTextNode(detailed);\r
+ eNotes.appendChild(txtDetailed);\r
+ comments.appendChild(eNotes);\r
+ }\r
+\r
+ QDomElement libs = doc.createElement("libraries");\r
+ eBlock.appendChild(libs);\r
+\r
+ QHashIterator<QString,QList<QString>* > it(packages);\r
+\r
+ while (it.hasNext()) {\r
+ it.next();\r
+ QString libName = it.key();\r
+ cout << qPrintable(libName) << endl;\r
+ QList<QString>* packList = it.value();\r
+ QDomElement lib = doc.createElement("library");\r
+ lib.setAttribute("name", libName);\r
+ libs.appendChild(lib);\r
+\r
+ foreach(QString packName, *packList) {\r
+ QDomElement pack = doc.createElement("package");\r
+ lib.appendChild(pack);\r
+ QRegularExpressionMatch matchPack = rxPack.match(packName);\r
+ if (matchPack.hasMatch()) {\r
+ QString name = matchPack.captured(1);\r
+ QString subName = matchPack.captured(2);\r
+ name = name.toLower();\r
+ subName = subName.toLower();\r
+ pack.setAttribute("name",name);\r
+ pack.setAttribute("use",subName);\r
+ }\r
+ }\r
+ }\r
+\r
+ QDomElement archi = doc.createElement("architecture");\r
+ eBlock.appendChild(archi);\r
+ QDomText tName = doc.createTextNode("");\r
+ foreach(QString line, archLines) {\r
+ tName.appendData(line+"\n");\r
+ }\r
+ archi.appendChild(tName);\r
+\r
+ QDomElement patterns = doc.createElement("patterns");\r
+ eBlock.appendChild(patterns);\r
+ QDomElement delta = doc.createElement("delta");\r
+ delta.setAttribute("value","to_define");\r
+ patterns.appendChild(delta);\r
+ QDomElement cons = doc.createElement("consumption");\r
+ foreach(AbstractInterface* iface, lstIface) {\r
+ if ((iface->getDirection() == AbstractInterface::Input) && (iface->getPurpose() == AbstractInterface::Control)) {\r
+ QDomElement input = doc.createElement("input");\r
+ input.setAttribute("name",iface->getName());\r
+ input.setAttribute("pattern","to_define");\r
+ cons.appendChild(input);\r