make generated PHP more consistent
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Fri, 8 Jan 2010 18:09:13 +0000 (18:09 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Fri, 8 Jan 2010 18:09:13 +0000 (18:09 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@408 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

woc/phpout.cpp

index f01b5a9..0a0adb9 100644 (file)
@@ -399,7 +399,7 @@ QString WocPHPServerOut::classProperties(const WocClass&cls)
                //generate validator
                code+=classPropertyValidator(cls,k[i]);
                //generic getter
-               code+="public function get_"+k[i]+"(){return $this->prop_"+k[i]+";}\n";
+               code+="public function get"+k[i]+"(){return $this->prop_"+k[i]+";}\n";
                //is it a list?
                if(cls.propertyIsList(k[i])){
                        //lists...
@@ -495,7 +495,7 @@ QString WocPHPServerOut::classPropertyListSetters(const WocClass&cls,QString pro
        QString code;
        code+="public function clear_"+prop+"(){$this->prop_"+prop+"=array();}\n";
        QString acode;//body of add_ function, see below
-       code+="public function set_"+prop+"(array $values){\n";
+       code+="public function set"+prop+"(array $values){\n";
        if(cls.propertyIsEnum(prop)){
                QList<WocEnum>ev=cls.enumValues(cls.propertyPlainType(prop));
                code+="\t$prop=array();\n";
@@ -598,7 +598,7 @@ QString WocPHPServerOut::classPropertyScalarGetters(const WocClass&cls,QString p
 QString WocPHPServerOut::classPropertyScalarSetters(const WocClass&cls,QString prop)
 {
        QString code;
-       code+="public function set_"+prop+"($value){\n";
+       code+="public function set"+prop+"($value){\n";
        if(cls.propertyIsEnum(prop)){
                QList<WocEnum>ev=cls.enumValues(cls.propertyPlainType(prop));
                code+="\tif(is_numeric($value)){\n\t\t$value=$value+0;\n";
@@ -686,18 +686,18 @@ QString WocPHPServerOut::classDeserializers(const WocClass&cls)
                }else{
                        if(cls.propertyIsObject(k[i])){
                                code+="\tforeach(WObject::elementsByTagName($elem,\""+k[i]+"\") as $el){\n";
-                               code+="\t\t$data->set_"+k[i]+"(WO"+cls.propertyPlainType(k[i])+"::fromXml($xml,$el));\n";
+                               code+="\t\t$data->set"+k[i]+"(WO"+cls.propertyPlainType(k[i])+"::fromXml($xml,$el));\n";
                                code+="\t}\n";
                        }else
                        if(cls.propertyIsAttribute(k[i])){
                                code+="\tif($elem->hasAttribute(\""+k[i]+"\"))\n";
-                               code+="\t\t$data->set_"+k[i]+"($elem->getAttribute(\""+k[i]+"\"));\n";
+                               code+="\t\t$data->set"+k[i]+"($elem->getAttribute(\""+k[i]+"\"));\n";
                        }else{
                                code+="\tforeach(WObject::elementsByTagName($elem,\""+k[i]+"\") as $el){\n";
                                if(cls.propertyIsBlob(k[i]))
-                                       code+="\t\t$data->set_"+k[i]+"(base64_decode($el->textContent));\n";
+                                       code+="\t\t$data->set"+k[i]+"(base64_decode($el->textContent));\n";
                                else
-                                       code+="\t\t$data->set_"+k[i]+"($el->textContent);\n";
+                                       code+="\t\t$data->set"+k[i]+"($el->textContent);\n";
                                code+="\t}\n";
                        }
                }
@@ -753,7 +753,7 @@ QString WocPHPServerOut::propertyToXml(const WocClass&cls,QString sl)
        if(cls.propertyIsList(prop)){
                //is it a class?
                if(cls.propertyIsObject(prop)){
-                       QString code="\tforeach($this->get_"+prop+"() as $o)\n\t\t";
+                       QString code="\tforeach($this->get"+prop+"() as $o)\n\t\t";
                        code+="$root->appendChild($o->toXml($xml,\""+prop+"\"));\n";
                        return code;
                }else{
@@ -764,7 +764,7 @@ QString WocPHPServerOut::propertyToXml(const WocClass&cls,QString sl)
                }
        }
        //non lists:
-       QString code="\t$p=$this->get_"+prop+"();\n\tif($p!==null)";
+       QString code="\t$p=$this->get"+prop+"();\n\tif($p!==null)";
        //is it an attribute?
        if(cls.propertyIsAttribute(prop))
                return code+"\t$root->setAttribute(\""+prop+"\",$this->getstr_"+prop+"());\n";