From: Konrad Rosenbaum Date: Wed, 27 Nov 2013 17:30:37 +0000 (+0100) Subject: add more convenient deserializers for Qt based classes X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=e06319c7261d4189e8bcef16ed50b9739e6e13a5;p=web%2Fkonrad%2Fpack.git add more convenient deserializers for Qt based classes --- diff --git a/woc/qt/qtclass.cpp b/woc/qt/qtclass.cpp index 26ae801..d22c98b 100644 --- a/woc/qt/qtclass.cpp +++ b/woc/qt/qtclass.cpp @@ -348,6 +348,14 @@ void WocQtClass::classDeserializer(const WocClass&cls,MFile&hdr,MFile&src,QStrin } } scd+="}\n"; + hcd+="\t///create "+cn+" from XML (inverse of toXml)\n"; + hcd+="\tstatic "+cn+" fromXml(const QDomElement&);\n"; + scd+=cn+" "+cn+"::fromXml(const QDomElement&root){return "+cn+"(root);}\n"; + hcd+="\t///create "+cn+" from XML formatted string (inverse of toString)\n"; + hcd+="\tstatic "+cn+" fromString(const QString&);\n"; + scd+=cn+" "+cn+"::fromString(const QString&txt)\n{\n\tQDomDocument doc;\n"; + scd+="\tif(!doc.setContent(txt))return "+cn+"();\n"; + scd+="\telse return "+cn+"(doc.documentElement());\n}\n"; hcd+="\t/// destructor: deletes this copy of the object\n"; hcd+="\tvirtual ~"+cn+"(){}\n";