Debugger: Move some generic helper function to base dumper

Change-Id: I78dea9af7d397d49ce2b54086d275413f2477626
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hjk
2013-11-01 12:49:14 +01:00
parent f1497bd84d
commit a8dece0b99
3 changed files with 42 additions and 62 deletions
-36
View File
@@ -1009,30 +1009,12 @@ class Dumper(DumperBase):
self.qtVersion = lambda: self.cachedQtVersion
return self.cachedQtVersion
# Convenience function.
def putItemCount(self, count, maximum = 1000000000):
# This needs to override the default value, so don't use 'put' directly.
if count > maximum:
self.putValue('<>%s items>' % maximum)
else:
self.putValue('<%s items>' % count)
def putType(self, type, priority = 0):
# Higher priority values override lower ones.
if priority >= self.currentTypePriority:
self.currentType = str(type)
self.currentTypePriority = priority
def putNoType(self):
# FIXME: replace with something that does not need special handling
# in SubItem.__exit__().
self.putBetterType(" ")
def putInaccessible(self):
#self.putBetterType(" ")
self.putNumChild(0)
self.currentValue = None
def putBetterType(self, type):
self.currentType = str(type)
self.currentTypePriority = self.currentTypePriority + 1
@@ -1116,24 +1098,6 @@ class Dumper(DumperBase):
return True
return self.isKnownMovableType(self.stripNamespaceFromType(str(type)))
def putIntItem(self, name, value):
with SubItem(self, name):
self.putValue(value)
self.putType("int")
self.putNumChild(0)
def putBoolItem(self, name, value):
with SubItem(self, name):
self.putValue(value)
self.putType("bool")
self.putNumChild(0)
def putGenericItem(self, name, type, value, encoding = None):
with SubItem(self, name):
self.putValue(value, encoding)
self.putType(type)
self.putNumChild(0)
def putSubItem(self, component, value, tryDynamic=True):
with SubItem(self, component):
self.putItem(value, tryDynamic)