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

Function strip_cpp_template_args

codegraph-kernel/src/ccpp/mod.rs:227–243  ·  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

225/// stripCppTemplateArgs (languages/c-cpp.ts): depth-counted removal of every
226/// balanced `<…>` group; `<` and `>` never reach the output.
227fn strip_cpp_template_args(name: &str) -> String {
228 if !name.contains('<') {
229 return name.to_string();
230 }
231 let mut out = String::with_capacity(name.len());
232 let mut depth = 0u32;
233 for ch in name.chars() {
234 if ch == '<' {
235 depth += 1;
236 } else if ch == '>' {
237 depth = depth.saturating_sub(1);
238 } else if depth == 0 {
239 out.push(ch);
240 }
241 }
242 out.trim().to_string()
243}
244
245/// recoverMangledCppName (languages/c-cpp.ts) — universal post-hoc salvage for
246/// a name still mangled by an unblanked macro ("Ret name" → "name").

Callers 8

receiver_type_ofMethod · 0.85
extract_callMethod · 0.85
extract_inheritanceMethod · 0.85
member_type_namesMethod · 0.85
collect_type_namesMethod · 0.85

Calls 2

lenMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected