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

Function strip_cpp_template_args

codegraph-kernel/src/ccpp/mod.rs:196–212  ·  view source on GitHub ↗

stripCppTemplateArgs (languages/c-cpp.ts): depth-counted removal of every balanced `<…>` group; `<` and `>` never reach the output.

(name: &str)

Source from the content-addressed store, hash-verified

194/// stripCppTemplateArgs (languages/c-cpp.ts): depth-counted removal of every
195/// balanced `<…>` group; `<` and `>` never reach the output.
196fn strip_cpp_template_args(name: &str) -> String {
197 if !name.contains('<') {
198 return name.to_string();
199 }
200 let mut out = String::with_capacity(name.len());
201 let mut depth = 0u32;
202 for ch in name.chars() {
203 if ch == '<' {
204 depth += 1;
205 } else if ch == '>' {
206 depth = depth.saturating_sub(1);
207 } else if depth == 0 {
208 out.push(ch);
209 }
210 }
211 out.trim().to_string()
212}
213
214/// recoverMangledCppName (languages/c-cpp.ts) — universal post-hoc salvage for
215/// a name still mangled by an unblanked macro ("Ret name""name").

Callers 4

receiver_type_ofMethod · 0.85
extract_callMethod · 0.85
extract_inheritanceMethod · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected