MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / identify

Method identify

lib/path.cpp:332–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332Standards::Language Path::identify(const std::string &path, bool cppHeaderProbe, bool *header)
333{
334 if (header)
335 *header = false;
336
337 std::string ext = getFilenameExtension(path);
338 // standard library headers have no extension
339 if (cppHeaderProbe && ext.empty()) {
340 if (hasEmacsCppMarker(path.c_str())) {
341 if (header)
342 *header = true;
343 return Standards::Language::CPP;
344 }
345 return Standards::Language::None;
346 }
347 if (ext == ".C")
348 return Standards::Language::CPP;
349 if (c_src_exts.find(ext) != c_src_exts.end())
350 return Standards::Language::C;
351 if (!caseInsensitiveFilesystem())
352 strTolower(ext);
353 if (ext == ".h") {
354 if (header)
355 *header = true;
356 if (cppHeaderProbe && hasEmacsCppMarker(path.c_str()))
357 return Standards::Language::CPP;
358 return Standards::Language::C;
359 }
360 if (cpp_src_exts.find(ext) != cpp_src_exts.end())
361 return Standards::Language::CPP;
362 if (header_exts.find(ext) != header_exts.end()) {
363 if (header)
364 *header = true;
365 return Standards::Language::CPP;
366 }
367 return Standards::Language::None;
368}
369
370bool Path::isHeader(const std::string &path)
371{

Callers

nothing calls this directly

Calls 6

hasEmacsCppMarkerFunction · 0.85
strTolowerFunction · 0.85
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected