Mercurial > projects > dbus-d
view dbus-d-javatests/dsrc/GenIntf.d @ 0:a5576806d36d
recreate repository without any libs for lightweight repository
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 20 Oct 2007 18:07:18 +0200 |
parents | |
children |
line wrap: on
line source
/** * Generated with TioLink * TioLink was written by Frank Benoit <benoit@tionex.de> * http://www.dsource.org/projects/tiolink * * File type: D programming language source code */ module GenIntf; public import org.freedesktop.dbus.Struct; public import org.freedesktop.dbus.Variant; import org.freedesktop.dbus.DBus; import org.freedesktop.dbus.c.Connection : DBusConnection; import org.freedesktop.dbus.c.Message : DBusMessage; import org.freedesktop.dbus.c.Shared : DBusHandlerResult; // DBus interfaces public interface DBusInterface { // org public interface org { // org.freedesktop public interface freedesktop { // org.freedesktop.DBus public interface DBus { // org.freedesktop.DBus.Peer public interface Peer { public void Ping(); public char[] GetMachineId(); } // org.freedesktop.DBus.Introspectable public interface Introspectable { public char[] Introspect(); } // org.freedesktop.DBus.Properties public interface Properties { public DBusVariant Get(in char[] intf_name,in char[] prop_name ); public void Set(in char[] intf_name,in char[] prop_name,in DBusVariant prop ); public DBusVariant[ char[] ] GetAll(in char[] intf_name ); } } // org.freedesktop.SampleInterface public interface SampleInterface { public void Frobate(in int foo,out char[] bar,out char[][ uint ] baz ); public DBusVariant Bazify(in Struct!( int, int, uint ) bar ); public void Mogrify(in Struct!( int, int, DBusVariant[] ) bar ); } } } // filetree public interface filetree { // filetree.DataFileSystem public interface DataFileSystem { public DBusObject[] getRoots(); } // filetree.DataItem public interface DataItem { public DBusObject[] getChilds(); public bool isFolder(); public bool isDrive(); public char[] getName(); } } } // DBusObject public class DBusObject : DBusObjectImpl, DBusInterface.org.freedesktop.DBus.Introspectable { this(){ super(); } public char[] Introspect(){ return super.Introspect(); } } private void init_introspectionData(){ registerIntrospectionData( DBusInterface.org.freedesktop.DBus.Peer.classinfo, `<interface name="org.freedesktop.DBus.Peer">\n` ` <method name="Ping">\n` ` </method>\n` ` <method name="GetMachineId">\n` ` <annotation name="org.dsource.tiolink.Returns" value="machine_uuid" />\n` ` <arg name="machine_uuid" type="s" direction="out" />\n` ` </method>\n` `</interface>\n`); registerIntrospectionData( DBusInterface.org.freedesktop.DBus.Introspectable.classinfo, `<interface name="org.freedesktop.DBus.Introspectable">\n` ` <method name="Introspect">\n` ` <annotation name="org.dsource.tiolink.Returns" value="xml_data" />\n` ` <arg name="xml_data" type="s" direction="out" />\n` ` </method>\n` `</interface>\n`); registerIntrospectionData( DBusInterface.org.freedesktop.DBus.Properties.classinfo, `<interface name="org.freedesktop.DBus.Properties">\n` ` <method name="Get">\n` ` <annotation name="org.dsource.tiolink.Returns" value="prop" />\n` ` <arg name="intf_name" type="s" direction="in" />\n` ` <arg name="prop_name" type="s" direction="in" />\n` ` <arg name="prop" type="v" direction="out" />\n` ` </method>\n` ` <method name="Set">\n` ` <arg name="intf_name" type="s" direction="in" />\n` ` <arg name="prop_name" type="s" direction="in" />\n` ` <arg name="prop" type="v" direction="in" />\n` ` </method>\n` ` <method name="GetAll">\n` ` <annotation name="org.dsource.tiolink.Returns" value="allprops" />\n` ` <arg name="intf_name" type="s" direction="in" />\n` ` <arg name="allprops" type="a{sv}" direction="out" />\n` ` </method>\n` `</interface>\n`); registerIntrospectionData( DBusInterface.org.freedesktop.SampleInterface.classinfo, `<interface name="org.freedesktop.SampleInterface">\n` ` <method name="Frobate">\n` ` <annotation name="org.freedesktop.DBus.Deprecated" value="true" />\n` ` <arg name="foo" type="i" direction="in" />\n` ` <arg name="bar" type="s" direction="out" />\n` ` <arg name="baz" type="a{us}" direction="out" />\n` ` </method>\n` ` <method name="Bazify">\n` ` <annotation name="org.dsource.tiolink.Returns" value="bar" />\n` ` <arg name="bar" type="(iiu)" direction="in" />\n` ` <arg name="bar" type="v" direction="out" />\n` ` </method>\n` ` <method name="Mogrify">\n` ` <arg name="bar" type="(iiav)" direction="in" />\n` ` </method>\n` `</interface>\n`); registerIntrospectionData( DBusInterface.filetree.DataFileSystem.classinfo, `<interface name="filetree.DataFileSystem">\n` ` <method name="getRoots">\n` ` <annotation name="org.dsource.tiolink.Returns" value="roots" />\n` ` <arg name="roots" type="ao" direction="out" />\n` ` </method>\n` `</interface>\n`); registerIntrospectionData( DBusInterface.filetree.DataItem.classinfo, `<interface name="filetree.DataItem">\n` ` <method name="getChilds">\n` ` <annotation name="org.dsource.tiolink.Returns" value="childs" />\n` ` <arg name="childs" type="ao" direction="out" />\n` ` </method>\n` ` <method name="isFolder">\n` ` <annotation name="org.dsource.tiolink.Returns" value="res" />\n` ` <arg name="res" type="b" direction="out" />\n` ` </method>\n` ` <method name="isDrive">\n` ` <annotation name="org.dsource.tiolink.Returns" value="res" />\n` ` <arg name="res" type="b" direction="out" />\n` ` </method>\n` ` <method name="getName">\n` ` <annotation name="org.dsource.tiolink.Returns" value="res" />\n` ` <arg name="res" type="s" direction="out" />\n` ` </method>\n` `</interface>\n`); } private DBusHandlerResult intfHandler__org_freedesktop_DBus_Peer( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.org.freedesktop.DBus.Peer o = cast(DBusInterface.org.freedesktop.DBus.Peer)cast(Object)user_data; if( o is null || !checkIntf( "org.freedesktop.DBus.Peer", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "Ping|": { o.Ping(); sendReply( conn, message ); } break; case "GetMachineId|": { Struct!( char[] ) po; po.t[0] = o.GetMachineId(); sendReplyData!( char[] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__org_freedesktop_DBus_Introspectable( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.org.freedesktop.DBus.Introspectable o = cast(DBusInterface.org.freedesktop.DBus.Introspectable)cast(Object)user_data; if( o is null || !checkIntf( "org.freedesktop.DBus.Introspectable", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "Introspect|": { Struct!( char[] ) po; po.t[0] = o.Introspect(); sendReplyData!( char[] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__org_freedesktop_DBus_Properties( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.org.freedesktop.DBus.Properties o = cast(DBusInterface.org.freedesktop.DBus.Properties)cast(Object)user_data; if( o is null || !checkIntf( "org.freedesktop.DBus.Properties", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "Get|ss": { Struct!( char[], char[] ) pi = getCallValues!( char[], char[] )( message ); Struct!( DBusVariant ) po; po.t[0] = o.Get( pi.t[0], pi.t[1] ); sendReplyData!( DBusVariant )( conn, message, po ); } break; case "Set|ssv": { Struct!( char[], char[], DBusVariant ) pi = getCallValues!( char[], char[], DBusVariant )( message ); o.Set( pi.t[0], pi.t[1], pi.t[2] ); sendReply( conn, message ); } break; case "GetAll|s": { Struct!( char[] ) pi = getCallValues!( char[] )( message ); Struct!( DBusVariant[ char[] ] ) po; po.t[0] = o.GetAll( pi.t[0] ); sendReplyData!( DBusVariant[ char[] ] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__org_freedesktop_SampleInterface( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.org.freedesktop.SampleInterface o = cast(DBusInterface.org.freedesktop.SampleInterface)cast(Object)user_data; if( o is null || !checkIntf( "org.freedesktop.SampleInterface", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "Frobate|i": { Struct!( int ) pi = getCallValues!( int )( message ); Struct!( char[], char[][ uint ] ) po; o.Frobate( pi.t[0], po.t[0], po.t[1] ); sendReplyData!( char[], char[][ uint ] )( conn, message, po ); } break; case "Bazify|(iiu)": { Struct!( Struct!( int, int, uint ) ) pi = getCallValues!( Struct!( int, int, uint ) )( message ); Struct!( DBusVariant ) po; po.t[0] = o.Bazify( pi.t[0] ); sendReplyData!( DBusVariant )( conn, message, po ); } break; case "Mogrify|(iiav)": { Struct!( Struct!( int, int, DBusVariant[] ) ) pi = getCallValues!( Struct!( int, int, DBusVariant[] ) )( message ); o.Mogrify( pi.t[0] ); sendReply( conn, message ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__filetree_DataFileSystem( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.filetree.DataFileSystem o = cast(DBusInterface.filetree.DataFileSystem)cast(Object)user_data; if( o is null || !checkIntf( "filetree.DataFileSystem", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "getRoots|": { Struct!( DBusObject[] ) po; po.t[0] = o.getRoots(); sendReplyData!( DBusObject[] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__filetree_DataItem( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.filetree.DataItem o = cast(DBusInterface.filetree.DataItem)cast(Object)user_data; if( o is null || !checkIntf( "filetree.DataItem", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "getChilds|": { Struct!( DBusObject[] ) po; po.t[0] = o.getChilds(); sendReplyData!( DBusObject[] )( conn, message, po ); } break; case "isFolder|": { Struct!( bool ) po; po.t[0] = o.isFolder(); sendReplyData!( bool )( conn, message, po ); } break; case "isDrive|": { Struct!( bool ) po; po.t[0] = o.isDrive(); sendReplyData!( bool )( conn, message, po ); } break; case "getName|": { Struct!( char[] ) po; po.t[0] = o.getName(); sendReplyData!( char[] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private void init_handlers(){ registerHandler( DBusInterface.org.freedesktop.DBus.Peer.classinfo, & intfHandler__org_freedesktop_DBus_Peer ); registerHandler( DBusInterface.org.freedesktop.DBus.Introspectable.classinfo, & intfHandler__org_freedesktop_DBus_Introspectable ); registerHandler( DBusInterface.org.freedesktop.DBus.Properties.classinfo, & intfHandler__org_freedesktop_DBus_Properties ); registerHandler( DBusInterface.org.freedesktop.SampleInterface.classinfo, & intfHandler__org_freedesktop_SampleInterface ); registerHandler( DBusInterface.filetree.DataFileSystem.classinfo, & intfHandler__filetree_DataFileSystem ); registerHandler( DBusInterface.filetree.DataItem.classinfo, & intfHandler__filetree_DataItem ); } static this(){ init_introspectionData(); init_handlers(); }