| 330 | } |
| 331 | |
| 332 | Standards::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 | |
| 370 | bool Path::isHeader(const std::string &path) |
| 371 | { |
nothing calls this directly
no test coverage detected