MCPcopy Create free account
hub / github.com/GRAnimated/MinecraftLCE / find_cpp_classes

Function find_cpp_classes

tools/lint.py:348–361  ·  view source on GitHub ↗
(src_dir)

Source from the content-addressed store, hash-verified

346CLASS_PATTERN = re.compile(r'^\s*(class|struct|enum)\s+(\w+) \{', re.MULTILINE)
347
348def 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
363def flatten_nested_map(nested_map, prefix=""):
364 flattened = []

Callers 1

mainFunction · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected