MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _is_cpp_header

Function _is_cpp_header

graphify/extract.py:16066–16078  ·  view source on GitHub ↗

Whether a `.h` file is C++ rather than plain C (#1547). Mirrors `_is_objc_header`: sniffs for a C++-only token. Used only to reroute a `.h` from extract_c to extract_cpp when no ObjC marker is present (ObjC has priority). Conservative by construction — a plain C header matches nothing

(path: Path)

Source from the content-addressed store, hash-verified

16064
16065
16066def _is_cpp_header(path: Path) -> bool:
16067 """Whether a `.h` file is C++ rather than plain C (#1547).
16068
16069 Mirrors `_is_objc_header`: sniffs for a C++-only token. Used only to reroute
16070 a `.h` from extract_c to extract_cpp when no ObjC marker is present (ObjC has
16071 priority). Conservative by construction — a plain C header matches nothing
16072 here and keeps its existing extract_c routing.
16073 """
16074 try:
16075 head = path.read_bytes()[:256 * 1024]
16076 except OSError:
16077 return False
16078 return any(marker in head for marker in _CPP_HEADER_MARKERS)
16079
16080
16081def _get_extractor(path: Path) -> Any | None:

Calls

no outgoing calls