| 798 | } |
| 799 | |
| 800 | static void writeMarkup(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::Markup &mup) |
| 801 | { |
| 802 | xmlWriter.writeStartElement("markup"); |
| 803 | xmlWriter.writeAttribute("ext", mup.ext); |
| 804 | xmlWriter.writeAttribute("aftercode", QVariant(mup.afterCode).toString()); |
| 805 | xmlWriter.writeAttribute("reporterrors", QVariant(mup.reportErrors).toString()); |
| 806 | if (!mup.keywords.isEmpty()) { |
| 807 | xmlWriter.writeStartElement("keywords"); |
| 808 | for (const QString &keyword : mup.keywords) { |
| 809 | xmlWriter.writeStartElement("keyword"); |
| 810 | xmlWriter.writeAttribute("name", keyword); |
| 811 | xmlWriter.writeEndElement(); |
| 812 | } |
| 813 | xmlWriter.writeEndElement(); |
| 814 | } |
| 815 | if (!mup.importer.isEmpty()) { |
| 816 | xmlWriter.writeStartElement("imported"); |
| 817 | for (const QString &import : mup.importer) { |
| 818 | xmlWriter.writeStartElement("importer"); |
| 819 | xmlWriter.writeCharacters(import); |
| 820 | xmlWriter.writeEndElement(); |
| 821 | } |
| 822 | xmlWriter.writeEndElement(); |
| 823 | } |
| 824 | if (!mup.exporter.isEmpty()) { |
| 825 | xmlWriter.writeStartElement("exported"); |
| 826 | for (const CppcheckLibraryData::Markup::Exporter &exporter : mup.exporter) { |
| 827 | xmlWriter.writeStartElement("exporter"); |
| 828 | xmlWriter.writeAttribute("prefix", exporter.prefix); |
| 829 | for (const QString &prefix : exporter.prefixList) { |
| 830 | xmlWriter.writeStartElement("prefix"); |
| 831 | xmlWriter.writeCharacters(prefix); |
| 832 | xmlWriter.writeEndElement(); |
| 833 | } |
| 834 | for (const QString &suffix : exporter.suffixList) { |
| 835 | xmlWriter.writeStartElement("suffix"); |
| 836 | xmlWriter.writeCharacters(suffix); |
| 837 | xmlWriter.writeEndElement(); |
| 838 | } |
| 839 | xmlWriter.writeEndElement(); |
| 840 | } |
| 841 | xmlWriter.writeEndElement(); |
| 842 | } |
| 843 | if (!mup.codeBlocks.isEmpty()) { |
| 844 | for (const CppcheckLibraryData::Markup::CodeBlocks &codeblock : mup.codeBlocks) { |
| 845 | xmlWriter.writeStartElement("codeblocks"); |
| 846 | for (const QString &block : codeblock.blocks) { |
| 847 | xmlWriter.writeStartElement("block"); |
| 848 | xmlWriter.writeAttribute("name", block); |
| 849 | xmlWriter.writeEndElement(); |
| 850 | } |
| 851 | xmlWriter.writeStartElement("structure"); |
| 852 | xmlWriter.writeAttribute("offset", QString("%1").arg(codeblock.offset)); |
| 853 | xmlWriter.writeAttribute("start", codeblock.start); |
| 854 | xmlWriter.writeAttribute("end", codeblock.end); |
| 855 | xmlWriter.writeEndElement(); |
| 856 | xmlWriter.writeEndElement(); |
| 857 | } |