DBusIntrospectArgument.fromXml constructor
DBusIntrospectArgument.fromXml(
- XmlNode node,
- DBusArgumentDirection defaultDirection
Implementation
factory DBusIntrospectArgument.fromXml(
XmlNode node, DBusArgumentDirection defaultDirection) {
var name = node.getAttribute('name');
var typeString = node.getAttribute('type');
if (typeString == null) {
throw FormatException('D-Bus Introspection XML missing argument type');
}
var type = DBusSignature(typeString);
var directionText = node.getAttribute('direction');
var direction = {
null: defaultDirection,
'in': DBusArgumentDirection.in_,
'out': DBusArgumentDirection.out
}[directionText];
if (direction == null) {
throw FormatException("Unknown argument direction '$directionText'");
}
var annotations = node
.findElements('annotation')
.map((n) => DBusIntrospectAnnotation.fromXml(n))
.toList();
return DBusIntrospectArgument(type, direction,
name: name, annotations: annotations);
}