-
Notifications
You must be signed in to change notification settings - Fork 22
/
FileType_CS.cpp
38 lines (29 loc) · 954 Bytes
/
FileType_CS.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "FileType_CS.h"
#include "CstyleCommentsFilter.h"
#include "CstyleUtils.h"
#include "SourceLine.h"
#include <cstring>
FileType_CS::FileType_CS(bool ignorePrepStuff, unsigned minChars)
: FileTypeBase(ignorePrepStuff, minChars) {
}
ILineFilterPtr FileType_CS::CreateLineFilter() const {
return std::make_shared<CstyleCommentsLineFilter>();
}
std::string FileType_CS::GetCleanLine(const std::string& line) const {
return CstyleUtils::RemoveSingleLineComments(line);
}
bool FileType_CS::IsPreprocessorDirective(const std::string& line) const {
if (line[0] == '#')
return true;
// look for attribute
if (line[0] == '[') {
return true;
}
// look for other markers to avoid
const char* markers[] = { "using", "private", "protected", "public" };
for (auto v : markers) {
if (line.find(v, 0, std::strlen(v)) != std::string::npos)
return true;
}
return false;
}