[Kde-bindings] playground/bindings/kimono

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sat Jan 13 23:53:47 UTC 2007


SVN commit 623083 by rdale:

* Added a generically typed QVariant.Value() method
* QDBusReply uses QVariant.Value()
* Added a couple of methods using QDBusReply to QDBusConnectionInterface

CCMAIL: kde-bindings at kde.org



 M  +6 -0      ChangeLog  
 M  +51 -0     core/QVariant.cs  
 M  +9 -10     qdbus/QDBusConnectionInterface.cs  
 M  +15 -2     qdbus/QDBusReply.cs  


--- trunk/playground/bindings/kimono/ChangeLog #623082:623083
@@ -1,3 +1,9 @@
+2007-13-01  Richard Dale  <rdale at foton.es>
+
+	* Added a generically typed QVariant.Value() method
+	* QDBusReply uses QVariant.Value()
+	* Added a couple of methods using QDBusReply to QDBusConnectionInterface
+
 2007-12-01  Richard Dale  <rdale at foton.es>
 
 	* Change the cmake build to use gmcs rather than mcs
--- trunk/playground/bindings/kimono/core/QVariant.cs #623082:623083
@@ -3,6 +3,7 @@
 
 	using System;
 	using System.Collections;
+	using System.Collections.Generic; 
 	using System.Text;
 
 	[SmokeClass("QVariant")]
@@ -512,5 +513,55 @@
 		private void DisposeQVariant() {
 			ProxyQVariant().DisposeQVariant();
 		}
+
+		public T Value<T>() {
+			if (typeof(T) == typeof(bool)) {
+				return (T) (object) ToBool();
+			} else if (typeof(T) == typeof(double)) {
+				return (T) (object) ToDouble();
+			} else if (typeof(T) == typeof(QByteArray)) {
+				return (T) (object) ToByteArray();
+			} else if (typeof(T) == typeof(char)) {
+				return (T) (object) ToChar();
+			} else if (typeof(T) == typeof(QDate)) {
+				return (T) (object) ToDate();
+			} else if (typeof(T) == typeof(QDateTime)) {
+				return (T) (object) ToDateTime();
+			} else if (typeof(T) == typeof(int)) {
+				return (T) (object) ToInt();
+			} else if (typeof(T) == typeof(QLine)) {
+				return (T) (object) ToLine();
+			} else if (typeof(T) == typeof(QLineF)) {
+				return (T) (object) ToLineF();
+			} else if (typeof(T) == typeof(QLocale)) {
+				return (T) (object) ToLocale();
+			} else if (typeof(T) == typeof(QPoint)) {
+				return (T) (object) ToPoint();
+			} else if (typeof(T) == typeof(QPointF)) {
+				return (T) (object) ToPointF();
+			} else if (typeof(T) == typeof(QRect)) {
+				return (T) (object) ToRect();
+			} else if (typeof(T) == typeof(QRectF)) {
+				return (T) (object) ToRectF();
+			} else if (typeof(T) == typeof(QRegExp)) {
+				return (T) (object) ToRegExp();
+			} else if (typeof(T) == typeof(QSize)) {
+				return (T) (object) ToSize();
+			} else if (typeof(T) == typeof(QSizeF)) {
+				return (T) (object) ToSizeF();
+			} else if (typeof(T) == typeof(string)) {
+				return (T) (object) ToString();
+			} else if (typeof(T) == typeof(List<string>)) {
+				return (T) (object) ToStringList();
+			} else if (typeof(T) == typeof(QTime)) {
+				return (T) (object) ToTime();
+			} else if (typeof(T) == typeof(uint)) {
+				return (T) (object) ToUInt();
+			} else if (typeof(T) == typeof(QUrl)) {
+				return (T) (object) ToUrl();
+			} else {
+				return (T) (object) default(T);
+			}
+		}
 	}
 }
--- trunk/playground/bindings/kimono/qdbus/QDBusConnectionInterface.cs #623082:623083
@@ -3,6 +3,7 @@
 
 	using System;
 	using System.Collections;
+	using System.Collections.Generic; 
 	using System.Text;
 
 	[SmokeClass("QDBusConnectionInterface")]
@@ -44,22 +45,20 @@
 			ServiceQueued = 2,
 		}
 		// int qt_metacall(QMetaObject::Call arg1,int arg2,void** arg3); >>>> NOT CONVERTED
-		[SmokeMethod("registeredServiceNames() const")]
-		public ArrayList RegisteredServiceNames() {
-			return ProxyQDBusConnectionInterface().RegisteredServiceNames();
+
+		public QDBusReply<List<string>> RegisteredServiceNames() {
+			return new QDBusReply<List<string>>(InternalConstCall(QDBus.CallMode.AutoDetect,"ListNames"));
 		}
-		// QDBusReply<bool> isServiceRegistered(const QString& arg1); >>>> NOT CONVERTED
-		[SmokeMethod("serviceOwner(const QString&) const")]
-		public string ServiceOwner(string name) {
-			return ProxyQDBusConnectionInterface().ServiceOwner(name);
+
+		public QDBusReply<string> ServiceOwner(string name) {
+			ArrayList nameArg = new ArrayList();
+			nameArg.Add(new QVariant(name));
+			return new QDBusReply<string>(InternalConstCall(QDBus.CallMode.AutoDetect,"GetNameOwner", nameArg));
 		}
 		// QDBusReply<bool> unregisterService(const QString& arg1); >>>> NOT CONVERTED
 		// QDBusReply<QDBusConnectionInterface::RegisterServiceReply> registerService(const QString& arg1,QDBusConnectionInterface::ServiceQueueOptions arg2,QDBusConnectionInterface::ServiceReplacementOptions arg3); >>>> NOT CONVERTED
 		// QDBusReply<QDBusConnectionInterface::RegisterServiceReply> registerService(const QString& arg1,QDBusConnectionInterface::ServiceQueueOptions arg2); >>>> NOT CONVERTED
 		// QDBusReply<QDBusConnectionInterface::RegisterServiceReply> registerService(const QString& arg1); >>>> NOT CONVERTED
-		// QDBusReply<uint> servicePid(const QString& arg1); >>>> NOT CONVERTED
-		// QDBusReply<uint> serviceUid(const QString& arg1); >>>> NOT CONVERTED
-		// QDBusReply<void> startService(const QString& arg1); >>>> NOT CONVERTED
 
 		public QDBusReply<bool> IsServiceRegistered(string serviceName) {
 			ArrayList serviceArg = new ArrayList();
--- trunk/playground/bindings/kimono/qdbus/QDBusReply.cs #623082:623083
@@ -1,13 +1,26 @@
 namespace Qyoto {
 
 	using System;
+	using System.Collections.Generic; 
 
 	public class QDBusReply<T> {
 		public QDBusReply(QDBusMessage reply) {
+			m_error = new QDBusError(reply);
+			if (m_error.IsValid()) {
+				return;
+			}
+
+			if (reply.Arguments().Count >= 1) {
+				m_data = ((QVariant) reply.Arguments()[0]).Value<T>();
+				return;
+			}
+
+			m_error = new QDBusError(	QDBusError.ErrorType.InvalidSignature, 
+										"Unexpected reply signature" );
 		}
 	
-		public QDBusReply(QDBusError dbusError)
-		{
+		public QDBusReply(QDBusError dbusError) {
+			m_error = dbusError;
 		}
 	
 		public bool IsValid() { return !m_error.IsValid(); }



More information about the Kde-bindings mailing list