Improved isJavaOrCSharp, isC and isCPP. Fixed isC for files with includes.

This commit is contained in:
PKEuS 2011-10-27 19:18:54 +02:00 committed by Daniel Marjamäki
parent 22251d50bb
commit 845e5d259a
1 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,7 @@ public:
bool isJavaOrCSharp() const {
if (_files.size() != 1)
return false;
const std::string::size_type pos = _files[0].rfind(".");
const std::string::size_type pos = _files[0].rfind('.');
if (pos != std::string::npos)
return (_files[0].substr(pos) == ".java" ||
_files[0].substr(pos) == ".cs");
@ -61,9 +61,9 @@ public:
/** Is the code C. Used for bailouts */
bool isC() const {
if (_files.size() != 1)
if (_files.empty())
return false;
const std::string::size_type pos = _files[0].rfind(".");
const std::string::size_type pos = _files[0].rfind('.');
if (pos != std::string::npos)
return (_files[0].substr(pos) == ".c") || (_files[0].substr(pos) == ".C");
return false;
@ -71,7 +71,7 @@ public:
/** Is the code CPP. Used for bailouts */
bool isCPP() const {
return !isJavaOrCSharp() && !isC();
return !isC() && !isJavaOrCSharp();
}
/**