XFA: parsing pages (first part)

This commit is contained in:
Jakub Melka
2021-11-07 16:00:29 +01:00
parent 2b459c2abb
commit 9a464da5bf
3 changed files with 1579 additions and 689 deletions

View File

@ -1620,6 +1620,19 @@ QString XFACodeGenerator::generateSource() const
stream << Qt::endl; stream << Qt::endl;
stream << "class XFA_AbstractVisitor" << Qt::endl;
stream << "{" << Qt::endl;
stream << "public:" << Qt::endl;
stream << " XFA_AbstractVisitor() = default;" << Qt::endl;
stream << " virtual ~XFA_AbstractVisitor() = default;" << Qt::endl << Qt::endl;
for (const Class& myClass : m_classes)
{
stream << QString(" virtual void visit(const XFA_%1* node) { Q_UNUSED(node); }").arg(myClass.className) << Qt::endl;
}
stream << "};" << Qt::endl;
stream << Qt::endl;
stream << "class XFA_BaseNode : public XFA_AbstractNode" << Qt::endl; stream << "class XFA_BaseNode : public XFA_AbstractNode" << Qt::endl;
stream << "{" << Qt::endl; stream << "{" << Qt::endl;
stream << "public:" << Qt::endl; stream << "public:" << Qt::endl;
@ -1684,7 +1697,7 @@ QString XFACodeGenerator::generateSource() const
QString attributeGetterName = attribute.attributeName; QString attributeGetterName = attribute.attributeName;
attributeGetterName[0] = attributeGetterName.front().toUpper(); attributeGetterName[0] = attributeGetterName.front().toUpper();
QString attributeDeclaration = QString(" XFA_Attribute<%1> %2;").arg(attribute.type->typeName, attributeFieldName); QString attributeDeclaration = QString(" XFA_Attribute<%1> %2;").arg(attribute.type->typeName, attributeFieldName);
QString attributeGetter = QString(" const %1* get%2() const { return %3.getValue(); }").arg(attribute.type->typeName, attributeGetterName, attributeFieldName); QString attributeGetter = QString(" %1 get%2() const { return %3.getValueOrDefault(); }").arg(attribute.type->typeName, attributeGetterName, attributeFieldName);
attributeDeclarations << attributeDeclaration; attributeDeclarations << attributeDeclaration;
attributeGetters << attributeGetter; attributeGetters << attributeGetter;
} }
@ -1738,6 +1751,8 @@ QString XFACodeGenerator::generateSource() const
stream << QString(" const %1* getNodeValue() const { return m_nodeValue.getValue(); }").arg(myClass.valueType->typeName) << Qt::endl << Qt::endl; stream << QString(" const %1* getNodeValue() const { return m_nodeValue.getValue(); }").arg(myClass.valueType->typeName) << Qt::endl << Qt::endl;
} }
stream << QString(" virtual void accept(XFA_AbstractVisitor* visitor) const override { visitor->visit(this); }") << Qt::endl << Qt::endl;
stream << QString(" static std::optional<XFA_%1> parse(const QDomElement& element);").arg(myClass.className) << Qt::endl; stream << QString(" static std::optional<XFA_%1> parse(const QDomElement& element);").arg(myClass.className) << Qt::endl;
stream << Qt::endl; stream << Qt::endl;
@ -1801,6 +1816,7 @@ QString XFACodeGenerator::generateSource() const
stream << QString(" parseValue(element, myClass.m_nodeValue);") << Qt::endl << Qt::endl; stream << QString(" parseValue(element, myClass.m_nodeValue);") << Qt::endl << Qt::endl;
} }
stream << " myClass.setOrderFromElement(element);" << Qt::endl;
stream << " return myClass;" << Qt::endl; stream << " return myClass;" << Qt::endl;
stream << "}" << Qt::endl; stream << "}" << Qt::endl;

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,7 @@
CURRENT:
- DocDiff application (compare similar PDF documents)
- Linux support
V: 1.0.0 Beta, 19.9.2021 V: 1.0.0 Beta, 19.9.2021
- initial beta release for non-production testing - initial beta release for non-production testing