-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch origin/java-support into master
- Loading branch information
Showing
4 changed files
with
136 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "FileType_Java.h" | ||
#include "CstyleCommentsFilter.h" | ||
#include "CstyleUtils.h" | ||
#include "SourceLine.h" | ||
|
||
#include <cstring> | ||
|
||
FileType_Java::FileType_Java(bool ignorePrepStuff, unsigned minChars) | ||
: FileTypeBase(ignorePrepStuff, minChars) { | ||
} | ||
|
||
ILineFilterPtr FileType_Java::CreateLineFilter() const { | ||
return std::make_shared<CstyleCommentsLineFilter>(); | ||
} | ||
|
||
std::string FileType_Java::GetCleanLine(const std::string& line) const { | ||
return CstyleUtils::RemoveSingleLineComments(line); | ||
} | ||
|
||
bool FileType_Java::IsPreprocessorDirective(const std::string& line) const { | ||
// look for other markers to avoid | ||
const char* markers[] = { "package", "import", "private", "protected", "public" }; | ||
|
||
for (auto v : markers) { | ||
if (line.find(v, 0, std::strlen(v)) != std::string::npos) | ||
return true; | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef _FILETYPE_JAVA_H_ | ||
#define _FILETYPE_JAVA_H_ | ||
|
||
#include "FileTypeBase.h" | ||
|
||
struct FileType_Java : public FileTypeBase { | ||
FileType_Java(bool ignorePrepStuff, unsigned minChars); | ||
|
||
ILineFilterPtr CreateLineFilter() const override; | ||
|
||
std::string GetCleanLine(const std::string& line) const override; | ||
|
||
bool IsPreprocessorDirective(const std::string& line) const override; | ||
}; | ||
|
||
#endif |