[Kde-bindings] playground/bindings/phpqt/src
Thomas Moenicke
tm at php-qt.org
Sat Apr 5 11:34:20 UTC 2008
SVN commit 793826 by moenicke:
* added "IS_NULL" to prepareMethodName() in case a default value is set to NULL (e.g. QWidget $parent = NULL)
CCMAIL: kde-bindings at kde.org
M +74 -71 smokephp.cpp
--- trunk/playground/bindings/phpqt/src/smokephp.cpp #793825:793826
@@ -148,83 +148,84 @@
Smoke::Index
smokephp_getMethod(const char* c, const char* m, const int argc, zval*** args)
{
- Smoke::Index method = PQ::smoke()->findMethod(c, m); // qt_Smoke->methods
- Smoke::Index i = PQ::smoke()->methodMaps[method].method;
+ Smoke::Index method = PQ::smoke()->findMethod(c, m); // qt_Smoke->methods
+ Smoke::Index i = PQ::smoke()->methodMaps[method].method;
- if(i <= 0)
- {
- i = -i; // turn into ambiguousMethodList index
- while(PQ::smoke()->ambiguousMethodList[i]) {
+ if(i <= 0)
+ {
+ i = -i; // turn into ambiguousMethodList index
+ while(PQ::smoke()->ambiguousMethodList[i]) {
- Smoke::Method &methodRef = PQ::smoke()->methods[PQ::smoke()->ambiguousMethodList[i]];
-
- if ((methodRef.flags & Smoke::mf_internal) == 0) {
- // try to compare smoke types with the php ones
- bool right = false;
- for(int k=0;k < argc;k++){
- uint type = static_cast<uint>( (**args[k]).type );
- switch((PQ::smoke()->types[PQ::smoke()->argumentList[PQ::smoke()->methods[PQ::smoke()->ambiguousMethodList[i]].args+k]].flags & Smoke::tf_elem)){
- case Smoke::t_voidp:
- if(type == IS_ARRAY)
- right = true;
- if(type == IS_STRING)
- right = true;
- break;
- case Smoke::t_bool:
- if(type == IS_BOOL)
- right = true;
- break;
- case Smoke::t_char:
- case Smoke::t_uchar:
- case Smoke::t_short:
- case Smoke::t_ushort:
- case Smoke::t_int:
- case Smoke::t_uint:
- case Smoke::t_long:
- case Smoke::t_ulong:
- if(type == IS_LONG)
- right = true;
- break;
- case Smoke::t_float:
- case Smoke::t_double:
- if(type == IS_DOUBLE)
- right = true;
- break;
- case Smoke::t_enum:
- php_error(E_WARNING,"type enum not yet implemented\n");
- break;
- case Smoke::t_class:
- if(type == IS_OBJECT){
- QByteArray* name =
- new QByteArray(
- PQ::smoke()->types[
- PQ::smoke()->argumentList[
- PQ::smoke()->methods[
- PQ::smoke()->ambiguousMethodList[i]].args+k]].name);
- name->replace("const ","");
- name->replace("*","");
- name->replace("&","");
+ Smoke::Method &methodRef = PQ::smoke()->methods[PQ::smoke()->ambiguousMethodList[i]];
- if( *name == QByteArray(Z_OBJCE_P( static_cast<zval*> (*args[k]))->name ))
- right = true;
- }
- break;
- default:
- php_error(E_ERROR, "unknown argument type");
- break;
- }
- }
- if(right){
+ if ((methodRef.flags & Smoke::mf_internal) == 0) {
+ // try to compare smoke types with the php ones
+ bool right = false;
+ for( int k = 0; k < argc; k++ ) {
+ uint type = static_cast<uint>( (**args[k]).type );
+ switch( (PQ::smoke()->types[PQ::smoke()->argumentList[PQ::smoke()->methods[PQ::smoke()->ambiguousMethodList[i]].args+k]].flags & Smoke::tf_elem) )
+ {
+ case Smoke::t_voidp:
+ if(type == IS_ARRAY)
+ right = true;
+ if(type == IS_STRING)
+ right = true;
+ break;
+ case Smoke::t_bool:
+ if(type == IS_BOOL)
+ right = true;
+ break;
+ case Smoke::t_char:
+ case Smoke::t_uchar:
+ case Smoke::t_short:
+ case Smoke::t_ushort:
+ case Smoke::t_int:
+ case Smoke::t_uint:
+ case Smoke::t_long:
+ case Smoke::t_ulong:
+ if(type == IS_LONG)
+ right = true;
+ break;
+ case Smoke::t_float:
+ case Smoke::t_double:
+ if(type == IS_DOUBLE)
+ right = true;
+ break;
+ case Smoke::t_enum:
+ php_error(E_WARNING,"type enum not yet implemented\n");
+ break;
+ case Smoke::t_class:
+ if(type == IS_OBJECT){
+ QByteArray* name =
+ new QByteArray(
+ PQ::smoke()->types[
+ PQ::smoke()->argumentList[
+ PQ::smoke()->methods[
+ PQ::smoke()->ambiguousMethodList[i]].args+k]].name);
+ name->replace("const ","");
+ name->replace("*","");
+ name->replace("&","");
+
+ if( *name == QByteArray(Z_OBJCE_P( static_cast<zval*> (*args[k]))->name ))
+ right = true;
+ }
+ break;
+ default:
+ php_error(E_ERROR, "unknown argument type");
+ break;
+ }
+ }
+ if(right){
#ifdef DEBUG
- php_error(E_NOTICE, "Ambiguous Method %s::%s => %d, %d", c, m, PQ::smoke()->ambiguousMethodList[i], i);
+ php_error(E_NOTICE, "Ambiguous Method %s::%s => %d, %d", c, m, PQ::smoke()->ambiguousMethodList[i], i);
#endif
- return PQ::smoke()->ambiguousMethodList[i];
+ return PQ::smoke()->ambiguousMethodList[i];
+ }
+ }
+ i++;
}
- }
- i++;
- }
- }
- return i;
+ }
+ return i;
}
/*!
@@ -361,6 +362,8 @@
Context::methodName()->append("$");
} else if (type == IS_STRING){
Context::methodName()->append("$");
+ } else if (type == IS_NULL){
+ // nothing to do
} else if (type == IS_OBJECT){
// as default QString is not supported in Smoke
if(!strcmp( Z_OBJCE_P(*args[i])->name, "QString" )){
More information about the Kde-bindings
mailing list