//implement serializers
k=cls.serializers();
for(int i=0;i<k.size();i++){
+ //toString function (wraps toXml)
code+="\nfunction toString"+k[i]+"(){\n\t$xml=new DomDocument;\n";
code+="\t$xml->appendChild($this->toXml"+k[i]+"($xml));\n\treturn $xml->saveXml();\n}\n";
- code+="function toXml"+k[i]+"($xml){\n\t$root=$xml->createElement(\""+cls.name()+k[i]+"\");\n";
- //TODO: add properties
+ //toXml function:
+ code+="function toXml"+k[i]+"($xml){\n";
+ code+="\t$root=$xml->createElement(\""+cls.name()+k[i]+"\");\n";
+ //add properties
+ QStringList p=cls.serializerProperties(k[i]);
+ for(int j=0;j<p.size();j++)
+ code+=propertyToXml(cls,p[j]);
+ //return result
code+="\treturn $root;\n}\n";
}
tf.close();
}
+QString WocPHPServerOut::propertyToXml(const WocClass&,QString){return "";}
+
void WocPHPServerOut::newTransaction(const WocTransaction&)
{
}
QString m_basedir,m_subdir,m_fileext;
QFile m_loader,m_schema;
- void addLoad(QString,QString);
+ /**helper: adds a loader line for a class to autoload.php*/
+ void addLoad(QString classname,QString filename);
+
+ /**helper: generates PHP code to transform a class property to XML*/
+ QString propertyToXml(const WocClass&,QString);
};
#endif