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

Function strip_cpp_template_args

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

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