Add DBArray support to generate script
MODIFY
generator/generate.py
generator/generate.py
@@ -71,6 +71,9 @@ def cpp_type(ty, prefix=True):
m = re.match(r'(Vector|Array)<(.*)>', ty)
if m:
return 'std::vector<%s>' % cpp_type(m.group(2), prefix)
+ m = re.match(r'DBArray<(.*)>', ty)
+ if m:
+ return 'DBArray<%s>' % cpp_type(m.group(1), prefix)
m = re.match(r'Ref<(.*):(.*)>', ty)
if m:
@@ -101,7 +104,7 @@ def pod_default(field):
ftype = field.type
# Not a POD, no default
- if dfl == '' or dfl == '\'\'' or ftype.startswith('Vector') or ftype.startswith('Array'):
+ if dfl == '' or dfl == '\'\'' or ftype.startswith('Vector') or ftype.startswith('Array') or ftype.startswith('DBArray'):
return ""
if ftype == 'Boolean':
@@ -195,6 +198,10 @@ def struct_headers(ty, header_map):
if m:
return ['<vector>'] + struct_headers(m.group(2), header_map)
+ m = re.match(r'DBArray<(.*)>', ty)
+ if m:
+ return ['<lcf/dbarray.h>'] + struct_headers(m.group(1), header_map)
+
header = header_map.get(ty)
if header is not None:
return ['"lcf/rpg/%s.h"' % header]
@@ -340,7 +347,7 @@ def needs_ctor(struct_name):
for method, hdrs in setup[struct_name])
def type_is_array(ty):
- return re.match(r'(Vector|Array)<(.*)>', ty)
+ return re.match(r'(Vector|Array|DBArray)<(.*)>', ty)
def is_monotonic_from_0(enum):
expected = 0

Add DBArray support to generate script