std::string getFileExtension(const std::string &path) { const std::string str = extractBaseName(path); const size_t p = findLastDot(str); if (p == std::string::npos) return std::string(); return str.substr(p + 1); }
bool CompilerOutputter::processLocationFormatCommand( char command, const SourceLine &sourceLine ) { switch ( command ) { case 'p': m_stream << sourceLine.fileName(); return true; case 'l': m_stream << sourceLine.lineNumber(); return true; case 'f': m_stream << extractBaseName( sourceLine.fileName() ); return true; } return false; }
std::string extractBaseNameWithoutExtension(std::string const& pathname) { std::string basename = extractBaseName(pathname); return dropFileExtension(basename); }