parent
ae1fa08188
commit
5b0dcfec83
@ -14,6 +14,20 @@
|
|||||||
# in wxLookupFunction at the bottom of this file.
|
# in wxLookupFunction at the bottom of this file.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import gdb
|
||||||
|
import itertools
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.version_info[0] > 2:
|
||||||
|
# Python 3
|
||||||
|
Iterator = object
|
||||||
|
|
||||||
|
long = int
|
||||||
|
else:
|
||||||
|
# Python 2, we need to make an adaptor, so we can use Python 3 iterator implementations.
|
||||||
|
class Iterator:
|
||||||
|
def next(self):
|
||||||
|
return self.__next__()
|
||||||
|
|
||||||
# shamelessly stolen from std::string example
|
# shamelessly stolen from std::string example
|
||||||
class wxStringPrinter:
|
class wxStringPrinter:
|
||||||
@ -26,6 +40,41 @@ class wxStringPrinter:
|
|||||||
def display_hint(self):
|
def display_hint(self):
|
||||||
return 'string'
|
return 'string'
|
||||||
|
|
||||||
|
class wxArrayStringPrinter:
|
||||||
|
|
||||||
|
class _iterator(Iterator):
|
||||||
|
def __init__ (self, firstItem, count):
|
||||||
|
self.item = firstItem
|
||||||
|
self.count = count
|
||||||
|
self.current = 0
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __next__(self):
|
||||||
|
current = self.current
|
||||||
|
self.current = self.current + 1
|
||||||
|
|
||||||
|
if current == self.count:
|
||||||
|
raise StopIteration
|
||||||
|
elt = self.item.dereference()
|
||||||
|
self.item = self.item + 1
|
||||||
|
return ('[%d]' % current, elt)
|
||||||
|
|
||||||
|
def __init__(self, val):
|
||||||
|
self.val = val
|
||||||
|
|
||||||
|
def children(self):
|
||||||
|
return self._iterator(self.val['m_pItems'], self.val['m_nCount'])
|
||||||
|
|
||||||
|
def to_string(self):
|
||||||
|
count = self.val['m_nCount']
|
||||||
|
capacity = self.val['m_nSize']
|
||||||
|
return ('length %d, capacity %d' % (int (count), int (capacity)))
|
||||||
|
|
||||||
|
def display_hint(self):
|
||||||
|
return 'array'
|
||||||
|
|
||||||
class wxDateTimePrinter:
|
class wxDateTimePrinter:
|
||||||
def __init__(self, val):
|
def __init__(self, val):
|
||||||
self.val = val
|
self.val = val
|
||||||
@ -81,6 +130,7 @@ def wxLookupFunction(val):
|
|||||||
# Using a list is probably ok for so few items but consider switching to a
|
# Using a list is probably ok for so few items but consider switching to a
|
||||||
# set (or a dict and cache class types as the keys in it?) if needed later.
|
# set (or a dict and cache class types as the keys in it?) if needed later.
|
||||||
types = ['wxString',
|
types = ['wxString',
|
||||||
|
'wxArrayString',
|
||||||
'wxDateTime',
|
'wxDateTime',
|
||||||
'wxFileName',
|
'wxFileName',
|
||||||
'wxPoint',
|
'wxPoint',
|
||||||
|
Loading…
Reference in New Issue
Block a user