mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-18 14:22:34 -06:00
42 lines
No EOL
943 B
C++
42 lines
No EOL
943 B
C++
#include "clang.h"
|
|
|
|
bool IsSourceFile(const String& path)
|
|
{
|
|
String ext = ToLower(GetFileExt(path));
|
|
return findarg(ext, ".cpp", ".cc", ".cxx", ".icpp", ".c") >= 0;
|
|
}
|
|
|
|
bool IsStruct(int kind)
|
|
{
|
|
return findarg(kind, CXCursor_StructDecl, CXCursor_UnionDecl, CXCursor_ClassDecl,
|
|
CXCursor_ClassTemplate) >= 0;
|
|
}
|
|
|
|
bool IsTemplate(int kind)
|
|
{
|
|
return findarg(kind, CXCursor_FunctionTemplate, CXCursor_ClassTemplate) >= 0;
|
|
}
|
|
|
|
bool IsFunction(int kind)
|
|
{
|
|
return findarg(kind, CXCursor_FunctionTemplate, CXCursor_FunctionDecl, CXCursor_Constructor,
|
|
CXCursor_Destructor, CXCursor_ConversionFunction, CXCursor_CXXMethod) >= 0;
|
|
}
|
|
|
|
bool IsVariable(int kind)
|
|
{
|
|
return findarg(kind, CXCursor_VarDecl, CXCursor_FieldDecl) >= 0;
|
|
}
|
|
|
|
int FindId(const char *s, const String& id)
|
|
{
|
|
CParser p(s);
|
|
while(!p.IsEof()) {
|
|
const char *q = p.GetPtr();
|
|
if(p.Id(id))
|
|
return q - s;
|
|
else
|
|
p.Skip();
|
|
}
|
|
return -1;
|
|
} |