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

Function isAbsolutePath

externals/simplecpp/simplecpp.cpp:2505–2522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2503#endif
2504
2505 bool isAbsolutePath(const std::string &path)
2506 {
2507#ifdef SIMPLECPP_WINDOWS
2508 // C:\\path\\file
2509 // C:/path/file
2510 if (path.length() >= 3 && std::isalpha(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/'))
2511 return true;
2512
2513 // \\host\path\file
2514 // //host/path/file
2515 if (path.length() >= 2 && (path[0] == '\\' || path[0] == '/') && (path[1] == '\\' || path[1] == '/'))
2516 return true;
2517
2518 return false;
2519#else
2520 return !path.empty() && path[0] == '/';
2521#endif
2522 }
2523}
2524
2525namespace simplecpp {

Callers 4

addIncludeDirsMethod · 0.85
analyzeProjectMethod · 0.85
openHeaderFunction · 0.85
getMethod · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected