Logo Search packages:      
Sourcecode: kdbus version File versions  Download package

DBusMethodArgument::DBusMethodArgument ( QDomElement const &  elem  )  throw ( QDBusXmlError )

Parameters:
elem XML element representing a method or signal argument

Definition at line 42 of file dbusmethodargument.cpp.

References DBusItem::ensureElementHasAttribute(), and DBusItem::ensureElementIsNamed().

 : d( new DBusMethodArgument::Private() )
{
    DBusItem::ensureElementIsNamed( elem, "arg" );
    DBusItem::ensureElementHasAttribute( elem, "type" );

    if ( elem.hasAttribute( "name" ) )
        d->name = elem.attribute( "name" );

    d->type = elem.attribute( "type" );

    /* Direction is a bit complicated.  The spec says,
     * for a method it may be in or out; for a signal, it's
     * always out; and it doesn't have to be specified for
     * either, in which case it defaults to in for a method,
     * out for a signal.
     */
    QDomElement parent = elem.parentNode().toElement();
    if ( parent.isNull() )
        throw std::logic_error( "Argument created without parent" );

    if ( parent.tagName() != "method" && parent.tagName() != "signal" )
        throw std::logic_error(
          "Argument created with parent neither method nor signal"
        );

    if ( parent.tagName() == "signal" )
        d->direction = "out";
    else {
        d->direction = elem.attribute( "direction" );
        if ( !d->direction )
            d->direction = "in";
    }

    d->niceType = DBusUtil::niceType( d->type );
}


Generated by  Doxygen 1.6.0   Back to index