- fixed Strcut generation in generator tool

- added some test cases
This commit is contained in:
Andreas Volz 2011-02-15 23:58:42 +01:00
parent 466931e527
commit cdedb019b0
12 changed files with 319 additions and 17 deletions

View file

@ -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

View file

@ -0,0 +1,7 @@
#include <dbuscxx_test_generator-client.h>
int main (int argc, char **argv)
{
return 0;
}

View file

@ -0,0 +1,5 @@
#ifndef DBUSCXX_TEST_GENERATOR_CLIENT_H
#include <dbuscxx_test_generator-client-glue.h>
#endif // DBUSCXX_TEST_GENERATOR_CLIENT_H

View file

@ -0,0 +1,8 @@
#include <dbuscxx_test_generator-server.h>
int main (int argc, char **argv)
{
return 0;
}

View file

@ -0,0 +1,6 @@
#ifndef DBUSCXX_TEST_GENERATOR_SERVER_H
#include <dbuscxx_test_generator-server-glue.h>
#endif // DBUSCXX_TEST_GENERATOR_SERVER_H

View file

@ -0,0 +1,232 @@
<?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>
</interface>
</node>