[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] New constructor for DCOPStub
From:       Christian Loose <christian.loose () hamburg ! de>
Date:       2003-01-13 21:47:43
[Download RAW message or body]

Hi!

This attached patch adds a new convenience constructor to DCOPStub (with the 
according changes to dcopidl2cpp) which takes a DCOPRef.

So now you can write:

ClassXY_stub* stub = new ClassXY_stub(ref);

instead of:

ClassXY_stub* stub = new ClassXY_stub(ref.app(), ref.obj());

Okay to commit?

Greetings
Christian
["convert-dcopref-stub.diff" (text/x-diff)]

Index: dcopstub.cpp
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopstub.cpp,v
retrieving revision 1.11
diff -u -r1.11 dcopstub.cpp
--- dcopstub.cpp	11 Sep 2002 14:55:21 -0000	1.11
+++ dcopstub.cpp	13 Jan 2003 21:41:29 -0000
@@ -24,6 +24,7 @@
 
 #include "dcopstub.h"
 #include "dcopclient.h"
+#include "dcopref.h"
 
 class DCOPStubPrivate
 {
@@ -44,6 +45,11 @@
 	d = new DCOPStubPrivate;
 	d->dcopClient = client;
     }
+}
+
+DCOPStub::DCOPStub( const DCOPRef& ref )
+    : m_app( ref.app() ), m_obj( ref.obj() ), m_status( CallSucceeded ),d(0)
+{
 }
 
 DCOPStub::~DCOPStub()
Index: dcopstub.h
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopstub.h,v
retrieving revision 1.17
diff -u -r1.17 dcopstub.h
--- dcopstub.h	29 Sep 2002 13:05:01 -0000	1.17
+++ dcopstub.h	13 Jan 2003 21:41:29 -0000
@@ -24,6 +24,7 @@
 #define _DCOPSTUB_H
 
 class DCOPClient;
+class DCOPRef;
 class DCOPStubPrivate;
 
 #include <stdlib.h>
@@ -54,6 +55,12 @@
        @param obj the object id
      */
     DCOPStub( DCOPClient* client, const QCString& app, const QCString& obj );
+    
+    /**
+       Creates a DCOPStub for application ref.app() and object ref.obj()
+       @param ref the DCOP reference
+     */
+    explicit DCOPStub( const DCOPRef& ref );
     virtual ~DCOPStub();
 
     /**
Index: dcopidl2cpp/stub.cpp
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopidl2cpp/stub.cpp,v
retrieving revision 1.11
diff -u -r1.11 stub.cpp
--- dcopidl2cpp/stub.cpp	27 Jul 2002 19:11:12 -0000	1.11
+++ dcopidl2cpp/stub.cpp	13 Jan 2003 21:41:30 -0000
@@ -151,6 +151,7 @@
             // Constructors
             str << "    " << className << "( const QCString& app, const QCString& id );" << \
                endl;
             str << "    " << className << "( DCOPClient* client, const QCString& app, const \
QCString& id );" << endl; +            str << "    explicit " << className << "( const DCOPRef& \
ref );" << endl;  
 	    s = e.firstChild().toElement();
 	    for( ; !s.isNull(); s = s.nextSibling().toElement() ) {
Index: dcopidl2cpp/stubimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopidl2cpp/stubimpl.cpp,v
retrieving revision 1.19
diff -u -r1.19 stubimpl.cpp
--- dcopidl2cpp/stubimpl.cpp	27 Jul 2002 12:05:15 -0000	1.19
+++ dcopidl2cpp/stubimpl.cpp	13 Jan 2003 21:41:30 -0000
@@ -130,6 +130,14 @@
             str << "{" << endl;
             str << "}" << endl << endl;
 
+            str << className_stub << "::" << className_stub << "( const DCOPRef& ref )" << \
endl; +            str << "  : ";
+        
+            str << "DCOPStub( ref )" << endl;
+
+            str << "{" << endl;
+            str << "}" << endl << endl;
+
 	    // Write marshalling code
 	    QDomElement s = e.firstChild().toElement();
 	    for( ; !s.isNull(); s = s.nextSibling().toElement() ) {



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic