summaryrefslogtreecommitdiff
path: root/src/mmo/strs.py
blob: 3e39ef40452bf5252a30191f952ba777abf308c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
for s in [
        'AccountName',
        'AccountPass',
        'AccountCrypt',
        'AccountEmail',
        'ServerName',
        'PartyName',
        'VarName',
        'MapName',
        'CharName',
]:
    class OtherString(object):
        __slots__ = ('_value')
        name = 'tmwa::%s' % s
        enabled = True

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

        def to_string(self):
            value = self._value
            fields = value.type.fields()
            field0 = fields[-1]
            return '%s' % value[field0]

        test_extra = '''
        #include "../strings/fwd.hpp"
        using tmwa::operator "" _s;
        '''

        tests = [
                ('tmwa::stringish<tmwa::%s>("Hello"_s)' % s, '"Hello"'),
        ]
    globals()[s] = OtherString
    del OtherString