summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--README3
-rw-r--r--configure.ac13
-rw-r--r--examples/echo/echo-introspect.xml1
-rw-r--r--include/dbus-c++/ecore-integration.h20
-rw-r--r--src/debug.cpp4
-rw-r--r--src/ecore-integration.cpp124
-rw-r--r--src/glib-integration.cpp4
-rw-r--r--test/Makefile.am6
-rw-r--r--test/generator/Makefile.am40
-rw-r--r--test/generator/dbuscxx_test_generator-client.cpp7
-rw-r--r--test/generator/dbuscxx_test_generator-client.h5
-rw-r--r--test/generator/dbuscxx_test_generator-server.cpp8
-rw-r--r--test/generator/dbuscxx_test_generator-server.h6
-rw-r--r--test/generator/dbuscxx_test_generator.xml244
-rw-r--r--tools/generator_utils.cpp79
-rw-r--r--tools/generator_utils.h1
17 files changed, 437 insertions, 130 deletions
diff --git a/Makefile.am b/Makefile.am
index 912f64b..6bfa677 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = src tools data doc examples
+SUBDIRS = src tools data doc examples test
EXTRA_DIST = autogen.sh bootstrap libdbus-c++.spec libdbus-c++.spec.in
diff --git a/README b/README
index 54a041d..950e618 100644
--- a/README
+++ b/README
@@ -1,6 +1,7 @@
Debugging
---------
-To compile debugging code configure the project with the --enable-debug option. Then at runtime you may set the environment variable "DBUSXX_VERBOSE=1" to activate debugging and to '0' to deactivate debugging.
+To compile debugging code configure the project with the --enable-debug option.
+Then at runtime you may export the environment variable "DBUSXX_VERBOSE" to any value.
BUGS:
diff --git a/configure.ac b/configure.ac
index 1cdbb6f..64923a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,13 +14,6 @@ AC_SUBST(PACKAGE_VERSION)
# Set configuration options
-AC_ARG_ENABLE(debug,
- AS_HELP_STRING([--enable-debug],
- [enable debugging support]),
- [enable_debug=$enableval],
- [enable_debug=no]
-)
-
AC_ARG_ENABLE(ecore,
AS_HELP_STRING([--enable-ecore],
[enable ecore integration]),
@@ -65,7 +58,7 @@ if test -n "$vtest"; then
AC_MSG_RESULT(yes)
AC_DEFINE(GCC_HASCLASSVISIBILITY, 1, [to enable hidden symbols])
- CXXFLAGS="-fvisibility=hidden"
+ CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
else
AC_MSG_RESULT(no)
fi
@@ -189,7 +182,9 @@ AC_OUTPUT(
Makefile
src/Makefile
tools/Makefile
- data/Makefile
+ test/Makefile
+ test/generator/Makefile
+ data/Makefile
doc/Makefile
doc/Doxyfile
examples/Makefile
diff --git a/examples/echo/echo-introspect.xml b/examples/echo/echo-introspect.xml
index 7d415ab..899612a 100644
--- a/examples/echo/echo-introspect.xml
+++ b/examples/echo/echo-introspect.xml
@@ -26,5 +26,6 @@
<method name="Info">
<arg type="a{ss}" name="info" direction="out"/>
</method>
+
</interface>
</node>
diff --git a/include/dbus-c++/ecore-integration.h b/include/dbus-c++/ecore-integration.h
index 2b14b27..b198b9d 100644
--- a/include/dbus-c++/ecore-integration.h
+++ b/include/dbus-c++/ecore-integration.h
@@ -69,17 +69,19 @@ private:
void toggle();
- static Eina_Bool watch_handler_read ( void*, Ecore_Fd_Handler *fdh);
-
- static Eina_Bool watch_handler_error ( void*, Ecore_Fd_Handler *fdh);
+ static Eina_Bool watch_check ( void *data, Ecore_Fd_Handler *fdh);
+ static Eina_Bool watch_prepare ( void *data, Ecore_Fd_Handler *fdh);
+ static Eina_Bool watch_dispatch ( void *data, Ecore_Fd_Handler *fdh);
void _enable();
void _disable();
+ void data (Ecore::BusDispatcher *bd);
+
private:
- Ecore_Fd_Handler *fd_handler_read;
- Ecore_Fd_Handler *fd_handler_error;
+ Ecore_Fd_Handler *fd_handler;
+ Ecore::BusDispatcher *_bd;
friend class BusDispatcher;
};
@@ -87,9 +89,7 @@ friend class BusDispatcher;
class DXXAPI BusDispatcher : public Dispatcher
{
public:
- BusDispatcher() {}
-
- void attach();
+ BusDispatcher();
void enter() {}
@@ -103,8 +103,10 @@ public:
void rem_watch( Watch* );
-private:
+ static Eina_Bool dispatch ( void *data, Ecore_Fd_Handler *fdh);
+ static Eina_Bool check ( void *data, Ecore_Fd_Handler *fdh);
+private:
};
} /* namespace Ecore */
diff --git a/src/debug.cpp b/src/debug.cpp
index 4f97dae..29e3667 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -33,7 +33,7 @@
static void _debug_log_default(const char *format, ...)
{
-#ifdef DEBUG
+//#ifdef DEBUG
static int debug_env = getenv("DBUSXX_VERBOSE") ? 1 : 0;
@@ -49,7 +49,7 @@ static void _debug_log_default(const char *format, ...)
va_end(args);
}
-#endif//DEBUG
+//#endif//DEBUG
}
DBus::LogFunction DBus::debug_log = _debug_log_default;
diff --git a/src/ecore-integration.cpp b/src/ecore-integration.cpp
index f1e24e7..0aea0eb 100644
--- a/src/ecore-integration.cpp
+++ b/src/ecore-integration.cpp
@@ -31,10 +31,15 @@
using namespace DBus;
+Dispatcher *gdispatcher = NULL;
+
Ecore::BusTimeout::BusTimeout( Timeout::Internal* ti)
: Timeout(ti)
{
- _enable();
+ if (Timeout::enabled())
+ {
+ _enable();
+ }
}
Ecore::BusTimeout::~BusTimeout()
@@ -46,8 +51,14 @@ void Ecore::BusTimeout::toggle()
{
debug_log("ecore: timeout %p toggled (%s)", this, Timeout::enabled() ? "on":"off");
- if(Timeout::enabled()) _enable();
- else _disable();
+ if(Timeout::enabled())
+ {
+ _enable();
+ }
+ else
+ {
+ _disable();
+ }
}
Eina_Bool Ecore::BusTimeout::timeout_handler( void *data )
@@ -58,7 +69,7 @@ Eina_Bool Ecore::BusTimeout::timeout_handler( void *data )
t->handle();
- return 1; // 1 -> reshedule in ecore for next timer interval
+ return ECORE_CALLBACK_RENEW;
}
void Ecore::BusTimeout::_enable()
@@ -75,34 +86,13 @@ void Ecore::BusTimeout::_disable()
ecore_timer_del (_etimer);
}
-/*static bool watch_prepare( int *timeout )
-{
- debug_log("ecore: watch_prepare");
-
- *timeout = -1;
- return false;
-}*/
-
-/*static bool watch_check( )
-{
- debug_log("ecore: watch_check");
-
- return true;
-}*/
-
-static bool watch_dispatch( void *data )
-{
- debug_log("ecore: watch_dispatch");
-
- bool cb = true;
- DBus::default_dispatcher->dispatch_pending(); //TODO: won't work in case of multiple dispatchers
- return cb;
-}
-
Ecore::BusWatch::BusWatch( Watch::Internal* wi)
-: Watch(wi)
-{
- _enable();
+: Watch(wi), fd_handler (NULL), _bd (NULL)
+{
+ if (Watch::enabled())
+ {
+ _enable();
+ }
}
Ecore::BusWatch::~BusWatch()
@@ -118,30 +108,21 @@ void Ecore::BusWatch::toggle()
else _disable();
}
-Eina_Bool Ecore::BusWatch::watch_handler_read( void *data, Ecore_Fd_Handler *fdh )
+Eina_Bool Ecore::BusWatch::watch_dispatch( void *data, Ecore_Fd_Handler *fdh )
{
Ecore::BusWatch* w = reinterpret_cast<Ecore::BusWatch*>(data);
- debug_log("ecore: watch_handler_read");
-
- int flags = DBUS_WATCH_READABLE;
-
- watch_dispatch(NULL);
+ debug_log("Ecore::BusWatch watch_handler_read");
- w->handle(flags);
+ int flags = flags;
- return 1;
-}
+ if (w->flags() & DBUS_WATCH_READABLE)
+ ecore_main_fd_handler_active_set(w->fd_handler, ECORE_FD_READ);
+ if (w->flags() & DBUS_WATCH_WRITABLE)
+ ecore_main_fd_handler_active_set(w->fd_handler, ECORE_FD_WRITE);
-Eina_Bool Ecore::BusWatch::watch_handler_error( void *data, Ecore_Fd_Handler *fdh )
-{
- //Ecore::BusWatch* w = reinterpret_cast<Ecore::BusWatch*>(data);
-
- debug_log("ecore: watch_handler_error");
-
- //int flags = DBUS_WATCH_ERROR;
-
- watch_dispatch(NULL);
+ w->handle(flags);
+ w->_bd->dispatch_pending();
return 1;
}
@@ -149,34 +130,34 @@ Eina_Bool Ecore::BusWatch::watch_handler_error( void *data, Ecore_Fd_Handler *fd
void Ecore::BusWatch::_enable()
{
debug_log("Ecore::BusWatch::_enable()");
-
- //int flags = Watch::flags();
-
- fd_handler_read = ecore_main_fd_handler_add (Watch::descriptor(),
- ECORE_FD_READ,
- watch_handler_read,
- this,
- NULL, NULL);
-
- ecore_main_fd_handler_active_set(fd_handler_read, ECORE_FD_READ);
-
- fd_handler_error = ecore_main_fd_handler_add (Watch::descriptor(),
- ECORE_FD_ERROR,
- watch_handler_error,
- this,
- NULL, NULL);
-
- ecore_main_fd_handler_active_set(fd_handler_error, ECORE_FD_ERROR);
+
+ fd_handler = ecore_main_fd_handler_add (descriptor(),
+ (Ecore_Fd_Handler_Flags) (ECORE_FD_READ | ECORE_FD_WRITE),
+ watch_dispatch, this,
+ NULL, NULL);
}
void Ecore::BusWatch::_disable()
{
- ecore_main_fd_handler_del (fd_handler_read);
- ecore_main_fd_handler_del (fd_handler_error);
+ if (fd_handler)
+ {
+ ecore_main_fd_handler_del (fd_handler);
+ fd_handler = NULL;
+ }
+}
+
+void Ecore::BusWatch::data (Ecore::BusDispatcher *bd)
+{
+ _bd = bd;
+}
+
+Ecore::BusDispatcher::BusDispatcher()
+{
}
-void Ecore::BusDispatcher::attach( )
+Eina_Bool Ecore::BusDispatcher::check ( void *data, Ecore_Fd_Handler *fdh)
{
+ return 0;
}
Timeout* Ecore::BusDispatcher::add_timeout( Timeout::Internal* wi )
@@ -197,7 +178,8 @@ void Ecore::BusDispatcher::rem_timeout( Timeout* t )
Watch* Ecore::BusDispatcher::add_watch( Watch::Internal* wi )
{
- Watch* w = new Ecore::BusWatch(wi);
+ Ecore::BusWatch* w = new Ecore::BusWatch(wi);
+ w->data (this);
debug_log("ecore: added watch %p (%s) fd=%d flags=%d",
w, w->enabled() ? "on":"off", w->descriptor(), w->flags()
diff --git a/src/glib-integration.cpp b/src/glib-integration.cpp
index 491c950..ac2bb27 100644
--- a/src/glib-integration.cpp
+++ b/src/glib-integration.cpp
@@ -87,7 +87,7 @@ struct BusSource
static gboolean watch_prepare(GSource *source, gint *timeout)
{
- //debug_log("glib: watch_prepare");
+ debug_log("glib: watch_prepare");
*timeout = -1;
return FALSE;
@@ -95,7 +95,7 @@ static gboolean watch_prepare(GSource *source, gint *timeout)
static gboolean watch_check(GSource *source)
{
- //debug_log("glib: watch_check");
+ debug_log("glib: watch_check");
BusSource *io = (BusSource *)source;
return io->poll.revents ? TRUE : FALSE;
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..536fbaf
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,6 @@
+
+SUBDIRS = \
+ generator
+
+## File created by the gnome-build tools
+
diff --git a/test/generator/Makefile.am b/test/generator/Makefile.am
new file mode 100644
index 0000000..1a29204
--- /dev/null
+++ b/test/generator/Makefile.am
@@ -0,0 +1,40 @@
+EXTRA_DIST = dbuscxx_test_generator.xml
+
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+
+noinst_PROGRAMS = dbuscxx_test_generator_server
+
+dbuscxx_test_generator_server_SOURCES = dbuscxx_test_generator-server-glue.h \
+ dbuscxx_test_generator-server.h \
+ dbuscxx_test_generator-server.cpp
+
+dbuscxx_test_generator_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la @PTHREAD_LIBS@
+dbuscxx_test_generator_server_CXXFLAGS = @PTHREAD_CFLAGS@
+
+dbuscxx_test_generator-server-glue.h: dbuscxx_test_generator.xml
+ $(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@
+
+######
+
+noinst_PROGRAMS += dbuscxx_test_generator_client
+
+dbuscxx_test_generator_client_SOURCES = dbuscxx_test_generator-client-glue.h \
+ dbuscxx_test_generator-client.h \
+ dbuscxx_test_generator-client.cpp
+
+dbuscxx_test_generator_client_LDADD = $(top_builddir)/src/libdbus-c++-1.la @PTHREAD_LIBS@
+dbuscxx_test_generator_client_CXXFLAGS = @PTHREAD_CFLAGS@
+
+dbuscxx_test_generator-client-glue.h: dbuscxx_test_generator.xml
+ $(top_builddir)/tools/dbusxx-xml2cpp $^ --proxy=$@
+
+BUILT_SOURCES = dbuscxx_test_generator-server-glue.h \
+ dbuscxx_test_generator-client-glue.h
+
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+ cd $(distdir); rm -f $(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/test/generator/dbuscxx_test_generator-client.cpp b/test/generator/dbuscxx_test_generator-client.cpp
new file mode 100644
index 0000000..2135986
--- /dev/null
+++ b/test/generator/dbuscxx_test_generator-client.cpp
@@ -0,0 +1,7 @@
+#include <dbuscxx_test_generator-client.h>
+
+int main (int argc, char **argv)
+{
+
+ return 0;
+}
diff --git a/test/generator/dbuscxx_test_generator-client.h b/test/generator/dbuscxx_test_generator-client.h
new file mode 100644
index 0000000..1d93f9e
--- /dev/null
+++ b/test/generator/dbuscxx_test_generator-client.h
@@ -0,0 +1,5 @@
+#ifndef DBUSCXX_TEST_GENERATOR_CLIENT_H
+
+#include <dbuscxx_test_generator-client-glue.h>
+
+#endif // DBUSCXX_TEST_GENERATOR_CLIENT_H
diff --git a/test/generator/dbuscxx_test_generator-server.cpp b/test/generator/dbuscxx_test_generator-server.cpp
new file mode 100644
index 0000000..9ac6913
--- /dev/null
+++ b/test/generator/dbuscxx_test_generator-server.cpp
@@ -0,0 +1,8 @@
+#include <dbuscxx_test_generator-server.h>
+
+int main (int argc, char **argv)
+{
+
+ return 0;
+}
+
diff --git a/test/generator/dbuscxx_test_generator-server.h b/test/generator/dbuscxx_test_generator-server.h
new file mode 100644
index 0000000..f736ddf
--- /dev/null
+++ b/test/generator/dbuscxx_test_generator-server.h
@@ -0,0 +1,6 @@
+#ifndef DBUSCXX_TEST_GENERATOR_SERVER_H
+
+#include <dbuscxx_test_generator-server-glue.h>
+
+#endif // DBUSCXX_TEST_GENERATOR_SERVER_H
+
diff --git a/test/generator/dbuscxx_test_generator.xml b/test/generator/dbuscxx_test_generator.xml
new file mode 100644
index 0000000..d4e3079
--- /dev/null
+++ b/test/generator/dbuscxx_test_generator.xml
@@ -0,0 +1,244 @@
+<?xml version="1.0" ?>
+<node name="/org/freedesktop/DBus/test/generator">
+ <interface name="org.freedesktop.DBus.test.generator">
+
+ <!-- method calls with a single parameter (in) -->
+ <method name="testByteIn">
+ <arg type="y" name="Byte" direction="in"/>
+ </method>
+
+ <method name="testBoolIn">
+ <arg type="b" name="Bool" direction="in"/>
+ </method>
+
+ <method name="testUInt16In">
+ <arg type="q" name="UInt16" direction="in"/>
+ </method>
+
+ <method name="testInt32In">
+ <arg type="i" name="Int32" direction="in"/>
+ </method>
+
+ <method name="testUInt32In">
+ <arg type="u" name="UInt32" direction="in"/>
+ </method>
+
+ <method name="testInt64In">
+ <arg type="x" name="Int64" direction="in"/>
+ </method>
+
+ <method name="testUInt64In">
+ <arg type="t" name="UInt64" direction="in"/>
+ </method>
+
+ <method name="testDoubleIn">
+ <arg type="d" name="Double" direction="in"/>
+ </method>
+
+ <method name="testStringIn">
+ <arg type="s" name="String" direction="in"/>
+ </method>
+
+ <method name="testPathIn">
+ <arg type="o" name="Path" direction="in"/>
+ </method>
+
+ <method name="testSignatureIn">
+ <arg type="g" name="Signature" direction="in"/>
+ </method>
+
+ <method name="testVariantIn">
+ <arg type="v" name="Variant" direction="in"/>
+ </method>
+
+ <!-- method calls with a single parameter (out) -->
+ <method name="testByteOut">
+ <arg type="y" name="Byte" direction="out"/>
+ </method>
+
+ <method name="testBoolOut">
+ <arg type="b" name="Bool" direction="out"/>
+ </method>
+
+ <method name="testUInt16Out">
+ <arg type="q" name="UInt16" direction="out"/>
+ </method>
+
+ <method name="testInt32Out">
+ <arg type="i" name="Int32" direction="out"/>
+ </method>
+
+ <method name="testUInt32Out">
+ <arg type="u" name="UInt32" direction="out"/>
+ </method>
+
+ <method name="testInt64Out">
+ <arg type="x" name="Int64" direction="out"/>
+ </method>
+
+ <method name="testUInt64Out">
+ <arg type="t" name="UInt64" direction="out"/>
+ </method>
+
+ <method name="testDoubleOut">
+ <arg type="d" name="Double" direction="out"/>
+ </method>
+
+ <method name="testStringOut">
+ <arg type="s" name="String" direction="out"/>
+ </method>
+
+ <method name="testPathOut">
+ <arg type="o" name="Path" direction="out"/>
+ </method>
+
+ <method name="testSignatureOut">
+ <arg type="g" name="Signature" direction="out"/>
+ </method>
+
+ <method name="testVariantOut">
+ <arg type="v" name="Variant" direction="out"/>
+ </method>
+
+ <!-- updates with a single parameter -->
+ <signal name="updateTestByte">
+ <arg type="y" name="Byte"/>
+ </signal>
+
+ <signal name="updateTestBool">
+ <arg type="b" name="Bool"/>
+ </signal>
+
+ <signal name="updateTestUInt16">
+ <arg type="q" name="UInt16"/>
+ </signal>
+
+ <signal name="updateTestInt32">
+ <arg type="i" name="Int32"/>
+ </signal>
+
+ <signal name="updateTestUInt32">
+ <arg type="u" name="UInt32"/>
+ </signal>
+
+ <signal name="updateTestInt64">
+ <arg type="x" name="Int64"/>
+ </signal>
+
+ <signal name="updateTestUInt64">
+ <arg type="t" name="UInt64"/>
+ </signal>
+
+ <signal name="updateTestDouble">
+ <arg type="d" name="Double"/>
+ </signal>
+
+ <signal name="updateTestString">
+ <arg type="s" name="String"/>
+ </signal>
+
+ <signal name="updateTestPath">
+ <arg type="o" name="Path"/>
+ </signal>
+
+ <signal name="updateTestSignature">
+ <arg type="g" name="Signature"/>
+ </signal>
+
+ <signal name="updateTestVariant">
+ <arg type="v" name="Variant"/>
+ </signal>
+
+ <!-- method calls with multible parameters (out) -->
+ <method name="testMultibleOut">
+ <arg type="y" name="Byte" direction="out"/>
+ <arg type="b" name="Bool" direction="out"/>
+ <arg type="q" name="UInt16" direction="out"/>
+ <arg type="i" name="Int32" direction="out"/>
+ <arg type="u" name="UInt32" direction="out"/>
+ <arg type="x" name="Int64" direction="out"/>
+ <arg type="t" name="UInt64" direction="out"/>
+ <arg type="d" name="Double" direction="out"/>
+ <arg type="s" name="String" direction="out"/>
+ <arg type="o" name="Path" direction="out"/>
+ <arg type="g" name="Signature" direction="out"/>
+ <arg type="v" name="Variant" direction="out"/>
+ </method>
+
+ <!-- method with all types combined (in) -->
+ <method name="testAllSimpleTypes">
+ <arg type="y" name="Byte" direction="in"/>
+ <arg type="b" name="Bool" direction="in"/>
+ <arg type="q" name="UInt16" direction="in"/>
+ <arg type="i" name="Int32" direction="in"/>
+ <arg type="u" name="UInt32" direction="in"/>
+ <arg type="x" name="Int64" direction="in"/>
+ <arg type="t" name="UInt64" direction="in"/>
+ <arg type="d" name="Double" direction="in"/>
+ <arg type="s" name="String" direction="in"/>
+ <arg type="o" name="Path" direction="in"/>
+ <arg type="g" name="Signature" direction="in"/>
+ <arg type="v" name="Variant" direction="in"/>
+ </method>
+
+ <!-- signal with all types combined -->
+ <signal name="updateTestAllSimpleTypes">
+ <arg type="y" name="Byte"/>
+ <arg type="b" name="Bool"/>
+ <arg type="q" name="UInt16"/>
+ <arg type="i" name="Int32"/>
+ <arg type="u" name="UInt32"/>
+ <arg type="x" name="Int64"/>
+ <arg type="t" name="UInt64"/>
+ <arg type="d" name="Double"/>
+ <arg type="s" name="String"/>
+ <arg type="o" name="Path"/>
+ <arg type="g" name="Signature"/>
+ <arg type="v" name="Variant"/>
+ </signal>
+
+ <!-- test std::map (in) -->
+ <method name="testMap">
+ <arg type="a{si}" name="MapStringInt32" direction="in"/>
+ </method>
+
+ <!-- test std::vector (in) -->
+ <method name="testVector">
+ <arg type="as" name="VectorString" direction="in"/>
+ </method>
+
+ <!-- test Struct (in) -->
+ <method name="testStruct">
+ <arg type="(isb)" name="Struct" direction="in"/>
+ </method>
+
+ <!-- test Vector of Struct (in) -->
+ <method name="testVectorStruct">
+ <arg type="a(isb)" name="VectorString" direction="in"/>
+ </method>
+
+ <!-- test various unsorted combinations -->
+ <method name="Unsorted1">
+ <arg type="a(a(uu)s)" name="array" direction="out" />
+ </method>
+
+ <method name="Unsorted2">
+ <arg type="i" name="result" direction="out" />
+ <arg type="i" name="direction" direction="in" />
+ <arg type="a(a(uu)s)" name="array" direction="out" />
+ </method>
+
+ <method name="Unsorted3">
+ <arg type="a(uq(udu))" name="array" direction="out" />
+ </method>
+
+ <method name="Unsorted4">
+ <arg type="a(uqa(udyu))" name="array" direction="out" />
+ </method>
+
+ <method name="Unsorted5">
+ <arg type="a(a(yq)u)" name="array" direction="out" />
+ </method>
+
+ </interface>
+</node>
diff --git a/tools/generator_utils.cpp b/tools/generator_utils.cpp
index e08ad27..828cf12 100644
--- a/tools/generator_utils.cpp
+++ b/tools/generator_utils.cpp
@@ -85,10 +85,14 @@ const char *atomic_type_to_string(char t)
return atos[i].name;
}
-void _parse_signature(const string &signature, string &type, unsigned int &i)
+static void _parse_signature(const string &signature, string &type, unsigned int &i, bool only_once = false)
{
+ cout << "signature: " << signature << endl;
+ cout << "type: " << type << endl;
+ cout << "i: " << i << ", signature[i]: " << signature[i] << endl;
+
for (; i < signature.length(); ++i)
- {
+ {
switch (signature[i])
{
case 'a':
@@ -98,44 +102,47 @@ void _parse_signature(const string &signature, string &type, unsigned int &i)
case '{':
{
type += "std::map< ";
-
- const char *atom = atomic_type_to_string(signature[++i]);
- if (!atom)
- {
- cerr << "invalid signature" << endl;
- exit(-1);
- }
- type += atom;
- type += ", ";
- ++i;
+ ++i;
+ _parse_signature(signature, type, i);
+ type += " >";
+
break;
}
+ case '(':
+ {
+ type += "std::vector< ::DBus::Struct< ";
+ ++i;
+ _parse_signature(signature, type, i);
+ type += " > >";
+
+ break;
+ }
default:
{
type += "std::vector< ";
+ _parse_signature(signature, type, i, true);
+
+ type += " >";
+
break;
}
- }
- _parse_signature(signature, type, i);
- type += " >";
- continue;
- }
- case '(':
- {
- type += "::DBus::Struct< ";
- ++i;
- _parse_signature(signature, type, i);
- type += " >";
- if (signature[i+1])
- {
- type += ", ";
- }
- continue;
+ }
+ break;
}
+ case '(':
+ {
+ type += "::DBus::Struct< ";
+ ++i;
+
+ _parse_signature(signature, type, i);
+
+ type += " >";
+ break;
+ }
case ')':
case '}':
- {
- return;
+ {
+ return;
}
default:
{
@@ -147,13 +154,17 @@ void _parse_signature(const string &signature, string &type, unsigned int &i)
}
type += atom;
- if (signature[i+1] != ')' && signature[i+1] != '}' && i+1 < signature.length())
- {
- type += ", ";
- }
break;
}
}
+
+ if (only_once)
+ return;
+
+ if (i+1 < signature.length() && signature[i+1] != ')' && signature[i+1] != '}')
+ {
+ type += ", ";
+ }
}
}
diff --git a/tools/generator_utils.h b/tools/generator_utils.h
index b232b56..ea754df 100644
--- a/tools/generator_utils.h
+++ b/tools/generator_utils.h
@@ -31,7 +31,6 @@
const char *atomic_type_to_string(char t);
std::string stub_name(std::string name);
std::string signature_to_type(const std::string &signature);
-void _parse_signature(const std::string &signature, std::string &type, unsigned int &i);
void underscorize(std::string &str);
/// create std::string from any number