[Kde-bindings] playground/bindings/phpqt/php_qt
Thomas Moenicke
tm at php-qt.org
Fri Aug 31 11:27:19 UTC 2007
SVN commit 706827 by moenicke:
* improved QString::fromUtf8() method
CCMAIL: kde-bindings at kde.org
M +36 -20 qstring.cpp
--- trunk/playground/bindings/phpqt/php_qt/qstring.cpp #706826:706827
@@ -1964,31 +1964,47 @@
}
}
-/*********************************
- * class QString */
-/*
+/*!
+ * class QString
+ *
* function fromUtf8
* flags: s
*/
-ZEND_METHOD(QString, fromUtf8){
-
- if (ZEND_NUM_ARGS() == 2){
- zval *z_0; // define ZVAL
- zval *z_1; // define ZVAL
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"zz", &z_0, &z_1) == SUCCESS) {
- if(Z_TYPE_P(z_0) == IS_STRING && Z_TYPE_P(z_1) == IS_LONG){
- if(getThis() == NULL){
- QString obj = (QString) QString::fromUtf8( (const char*) Z_STRVAL_P(z_0) ,(int) Z_LVAL_P(z_1));
- QString *s1 = new QString(obj);
-
- createObject(return_value, (void*) s1, qstring_ce, QSTRING_CLASSID);
- return;
-
- }
- }
-
+ZEND_METHOD(QString, fromUtf8)
+{
+ if (ZEND_NUM_ARGS() == 2)
+ {
+ zval *z_0; // define ZVAL
+ zval *z_1; // define ZVAL
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"zz", &z_0, &z_1) == SUCCESS)
+ {
+ if(Z_TYPE_P(z_0) == IS_STRING && Z_TYPE_P(z_1) == IS_LONG)
+ {
+ if(getThis() == NULL)
+ {
+ QString *s1 = new QString( QString::fromUtf8( Z_STRVAL_P(z_0) , static_cast<int>(Z_LVAL_P(z_1)) ) );
+ createObject(return_value, (void*) s1, qstring_ce, QSTRING_CLASSID);
+ return;
}
+ }
}
+ }
+ if (ZEND_NUM_ARGS() == 1)
+ {
+ zval *z_0; // define ZVAL
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"z", &z_0) == SUCCESS)
+ {
+ if(Z_TYPE_P(z_0) == IS_STRING)
+ {
+ if(getThis() == NULL)
+ {
+ QString *s1 = new QString( QString::fromUtf8( Z_STRVAL_P(z_0) ) );
+ createObject(return_value, reinterpret_cast<void*>(s1), qstring_ce, QSTRING_CLASSID);
+ return;
+ }
+ }
+ }
+ }
}
/*********************************
More information about the Kde-bindings
mailing list