view dbus-d-javatests/jsrc/filetree/DataFileSystem.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
 *
 * User specific code can be place after the generated comment line containing:
 * "USER CONTENT STARTS HERE".
 * Everything before that line will be programmatically overwritten.
 *
 * File type: D programming language source code
 */
module filetree.DataFileSystem;

import org.freedesktop.dbus.DBus;
import org.freedesktop.dbus.Introspectable;

// Interface for DataFileSystem

interface DataFileSystem : org.freedesktop.dbus.DBusInterface.DBusInterface {
    public filetree.DataItem.DataItem[] getRoots();
    const static char[] introspectionXml = 
        `<interface name="filetree.DataFileSystem"/>`\n
        `  <method name="getRoots">`\n
        `    <arg name="p0" type="ao" direction="out"/>`\n
        `  </method>`\n
        `</interface>`\n
        ;
}

CConnection.DBusHandlerResult intfHandler__filetree_DataFileSystem_DataFileSystem( CConnection.DBusConnection* conn, CConnection.DBusMessage* message, void* user_data ){
    DataFileSystem o = cast(DataFileSystem)cast(Object)user_data;
    if( o is null || !checkIntf( "filetree.DataFileSystem", message) )
        return CConnection.DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
    
    try{
        char[METHOD_SIG_MAXLENGTH] buf;
        switch( methodSignature( message, buf ) ){
        case "getRoots|":
            {
                filetree.DataItem.DataItem[] callResult = o.getRoots();
                sendReply( conn, message, callResult );
            }
            break;
        default:
            return CConnection.DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
        }
    }
    catch( Exception e ){
        sendException( conn, message, e );
    }
    return CConnection.DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED;
}
void intfFree__filetree_DataFileSystem_DataFileSystem( CConnection.DBusConnection *connection, void *user_data ){
}


// Dimpl for MyDataFileSystem

extern(C) CConnection.DBusHandlerResult dimplHandler__filetree_DataFileSystem_MyDataFileSystem( CConnection.DBusConnection* conn, CConnection.DBusMessage* message, void* user_data ){
    CConnection.DBusHandlerResult res = CConnection.DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
    if( res == CConnection.DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED ){
        res = intfHandler__filetree_DataFileSystem_DataFileSystem( conn, message, user_data );
    }
    if( res == CConnection.DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED ){
        res = intfHandler__org_freedesktop_dbus_Introspectable_Introspectable( conn, message, user_data );
    }
    return res;
}

extern(C) void dimplFree__filetree_DataFileSystem_MyDataFileSystem( CConnection.DBusConnection *connection, void *user_data ){
}

CConnection.DBusObjectPathVTable vtable__filetree_DataFileSystem_MyDataFileSystem = {
    unregister_function : & dimplFree__filetree_DataFileSystem_MyDataFileSystem,
    message_function    : & dimplHandler__filetree_DataFileSystem_MyDataFileSystem
};


static assert( is( MyDataFileSystem : filetree.DataFileSystem.DataFileSystem ));
static assert( is( MyDataFileSystem : org.freedesktop.dbus.Introspectable.Introspectable ));

// --- USER CONTENT STARTS HERE (do not change this marker line) ---
import tango.io.Stdout;
import tango.io.FileRoots;
import tango.io.FilePath;
import filetree.DataItem;

class MyDataFileSystem : DBusObject, DataFileSystem, Introspectable {
	
	public this(){
		super( this.classinfo );
	}
	
	public DBusObjectPathVTable* getDBusVTable(){
		return &vtable__filetree_DataFileSystem_MyDataFileSystem;
	}
	
	public DataItem[] getRoots(){
		auto roots = FileRoots.list();
		DataItem[] res = new DataItem[ roots.length ];
		for( int i = 0; i < roots.length; i++ ){
			res[i] = new MyDataItem( new FilePath(roots[i]) );
		}
		return res;
	}
	public char[] Introspect(){
		Stdout.formatln( "FileSys inspect" );
		return buildIntrospect( [DataFileSystem.introspectionXml, Introspectable.introspectionXml ], null );
	}
/+
	public this( char[] path ){
		super( new FilePath( path ));
	}

	public String getName(){
		char[] name = file.toUtf8();
		Stdout.formatln( "{} {} {}", __LINE__, __FILE__, name );
		auto res =  toJavaString( name );
		Stdout.formatln( "{} {} ", __LINE__, __FILE__ );
		return res;
//		return toJavaString( file.name() );
	}

	public override bool isFolder(){
		return true;
	}
	public override bool isDrive(){
		return true;
	}
+/
}