ultimatepp/uppsrc/ide/Builders/BuilderUtils.cpp
klugier 9189c21dbe .ide GccBuilder now preprocess files required c++11
git-svn-id: svn://ultimatepp.org/upp/trunk@10950 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2017-03-18 19:35:24 +00:00

57 lines
1.1 KiB
C++

#include "BuilderUtils.h"
using namespace Upp;
bool BuilderUtils::IsJavaFile(const String& path)
{
return HasExt(path, { "java" });
}
bool BuilderUtils::IsHeaderFile(const String& path)
{
return HasExt(path, { "i", "h", "hpp", "hxx" });
}
bool BuilderUtils::IsCFile(const String& path)
{
return HasExt(path, { "c" });
}
bool BuilderUtils::IsCppFile(const String& path)
{
return HasExt(path, { "icpp", "cpp", "cc", "cxx" });
}
bool BuilderUtils::IsCppOrCFile(const String& path)
{
return HasExt(path, { "c", "icpp", "cpp", "cc", "cxx" });
}
bool BuilderUtils::IsXmlFile(const String& path)
{
return HasExt(path, { "xml" });
}
bool BuilderUtils::IsObjectFile(const String& path)
{
return HasExt(path, { "o" });
}
bool BuilderUtils::IsTranslationFile(const String& path)
{
return HasExt(path, { "t" });
}
bool BuilderUtils::HasExt(const String& path, const Index<String>& exts)
{
return exts.Find(NormalizeAndGetFileExt(path)) != -1;
}
String BuilderUtils::NormalizeAndGetFileExt(const String& path)
{
String ext = ToLower(GetFileExt(path));
if (ext.StartsWith(".")) {
ext.Remove(0);
}
return ext;
}