<commit_before>/**
 * -- Mickey's DBus Utility V2 --
 *
 * Copyright (C) 2009-2010 Michael 'Mickey' Lauer <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 **/

//=========================================================================//
using GLib;

//=========================================================================//
const string DBUS_BUS_NAME  = "org.freedesktop.DBus";
const string DBUS_OBJ_PATH  = "/";
const string DBUS_INTERFACE = "org.freedesktop.DBus";
const string DBUS_INTERFACE_INTROSPECTABLE = "org.freedesktop.DBus.Introspectable";

//=========================================================================//
MainLoop mainloop;

public string formatResult( DBus.RawMessageIter iter, int depth = 0 )
{
    var signature = iter.get_signature();
    debug( @"signature for this iter = $signature" );

    switch ( signature )
    {
        case "b":
            bool b = false;
            iter.get_basic( &b );
            return b.to_string();
        case "s":
            unowned string s = null;
            iter.get_basic( &s );
            return @"\"$s\"";
        case "i":
            int i = 0;
            iter.get_basic( &i );
            return i.to_string();
        default:
            return "unknown";
    }
    return "unknown";
}

//===========================================================================
public class Argument : Object<commit_msg>mdbus2: array of strings as result now works<commit_after>/**
 * -- Mickey's DBus Utility V2 --
 *
 * Copyright (C) 2009-2010 Michael 'Mickey' Lauer <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 **/

//=========================================================================//
using GLib;

//=========================================================================//
const string DBUS_BUS_NAME  = "org.freedesktop.DBus";
const string DBUS_OBJ_PATH  = "/";
const string DBUS_INTERFACE = "org.freedesktop.DBus";
const string DBUS_INTERFACE_INTROSPECTABLE = "org.freedesktop.DBus.Introspectable";

//=========================================================================//
MainLoop mainloop;

public string formatResult( DBus.RawMessageIter iter, int depth = 0 )
{
    var signature = iter.get_signature();
    debug( @"signature for this iter = $signature" );

    /*
     * Array
     */
    if ( signature[0] == 'a' )
    {
        DBus.RawMessageIter subiter = DBus.RawMessageIter();
        iter.recurse( subiter );
        var result = "[ ";
        while ( subiter.has_next() )
        {
            result += formatResult( subiter, 1 );
            result += ", ";
            subiter.next();
        }
        result += "]";
        return result;
    }

    switch ( signature )
    {
        /*
         * Simple Types
         */
        case "b":
            bool b = false;
            iter.get_basic( &b );
            return b.to_string();
        case "s":
            unowned string s = null;
            iter.get_basic( &s );
            return @"\"$s\"";
        case "i":
            int i = 0;
            iter.get_basic( &i );
            return i.to_string();
        default:
            return @"($signature ???)";
    }
    return "unknown";
}

//===========================================================================
public class Argument : Object
{'fraction_non_alphanumeric': 0.21980155306298532, 'fraction_numerical': 0.01186367558239862, 'mean_word_length': 2.825907590759076, 'pattern_counts': {'":': 6, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6857473', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1170, 'n_words': 430}