Improve output of UnoAnyPrinter

Change-Id: I1461264fe7f951c9ecec777c6217d0acfb7e4254
This commit is contained in:
Stephan Bergmann
2016-06-16 14:53:06 +02:00
parent e74d125954
commit 8132c691de

View File

@@ -20,22 +20,16 @@ class UnoAnyPrinter(object):
self.typename = typename.replace('com::sun::star::', '') self.typename = typename.replace('com::sun::star::', '')
def to_string(self): def to_string(self):
if self._is_set():
return ('%s %s' % (self.typename, self._make_string()))
else:
return "empty %s" % self.typename
def _is_set(self):
return self.value['pType'].dereference()['eTypeClass'] != TypeClass.VOID
def _make_string(self):
ptr = self.value['pData']
assert ptr
type_desc = self.value['pType'] type_desc = self.value['pType']
assert type_desc assert type_desc
type = make_uno_type(type_desc.dereference()) type = make_uno_type(type_desc.dereference())
assert type assert type
return str(uno_cast(type, ptr).dereference()) if type_desc.dereference()['eTypeClass'] == TypeClass.VOID:
return ('%s(%s)' % (self.typename, type.tag))
else:
ptr = self.value['pData']
assert ptr
return ('%s(%s: %s)' % (self.typename, type.tag, str(uno_cast(type, ptr).dereference())))
class UnoReferencePrinter(object): class UnoReferencePrinter(object):
'''Prints reference to a UNO interface''' '''Prints reference to a UNO interface'''