| 346 | CLASS_PATTERN = re.compile(r'^\s*(class|struct|enum)\s+(\w+) \{', re.MULTILINE) |
| 347 | |
| 348 | def find_cpp_classes(src_dir): |
| 349 | class_map = {} |
| 350 | for root, _, files in os.walk(src_dir): |
| 351 | for file in files: |
| 352 | if file.endswith(('.h', '.hpp', '.cpp')): |
| 353 | filepath = os.path.join(root, file) |
| 354 | with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: |
| 355 | content = f.read() |
| 356 | for match in CLASS_PATTERN.finditer(content): |
| 357 | kind, name = match.groups() |
| 358 | rel_path = os.path.relpath(filepath, src_dir).replace("\\", "/") |
| 359 | |
| 360 | class_map[name] = rel_path |
| 361 | return class_map |
| 362 | |
| 363 | def flatten_nested_map(nested_map, prefix=""): |
| 364 | flattened = [] |