MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / rewriteCppAccessMacros

Function rewriteCppAccessMacros

src/extraction/languages/c-cpp.ts:1769–1777  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

1767 */
1768const ACCESS_MACRO_LINE = /^([ \t]*)([A-Z][A-Z0-9]*_[A-Z0-9_]*)([ \t]*):(?!:)(?=[ \t]*(?:\/\/[^\n]*)?\r?$)/gm;
1769export function rewriteCppAccessMacros(source: string): string {
1770 if (!/_[A-Z0-9_]*[ \t]*:(?!:)/.test(source)) return source;
1771 return source.replace(ACCESS_MACRO_LINE, (m, indent: string, name: string, gap: string) => {
1772 const keyword = /PRIVATE/.test(name) ? 'private' : /PROTECTED/.test(name) ? 'protected'
1773 : /PUBLIC|^Q_SIGNALS$|^Q_SLOTS$/.test(name) ? 'public' : null;
1774 if (!keyword || keyword.length > name.length + gap.length) return m;
1775 return `${indent}${keyword}${' '.repeat(name.length + gap.length - keyword.length)}:`;
1776 });
1777}
1778
1779/**
1780 * A preprocessor conditional in the middle of a declaration or expression —

Callers 1

preParseCppSourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected