summaryrefslogtreecommitdiff
path: root/src/strings/rstring.py
blob: 8021ec262705b20a7c77606858f205ee4ad41c3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class RString(object):
    ''' print a RString
    '''
    __slots__ = ('_value')
    name = 'tmwa::strings::RString'
    enabled = True

    def __init__(self, value):
        self._value = value

    def children(self):
        yield 'count', self._value['owned'].dereference()['count']

    def to_string(self):
        r = self._value['owned'].dereference()
        b = r['body']
        b = b.cast(b.type.target().pointer())
        d = r['size']
        return b.lazy_string(length=d)