forked from Ericsson/CodeCompass
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdummyparser.cpp
More file actions
73 lines (59 loc) · 1.72 KB
/
dummyparser.cpp
File metadata and controls
73 lines (59 loc) · 1.72 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <dummyparser/dummyparser.h>
#include <boost/filesystem.hpp>
#include <util/logutil.h>
#include <memory>
namespace cc
{
namespace parser
{
DummyParser::DummyParser(ParserContext& ctx_): AbstractParser(ctx_)
{
}
bool DummyParser::accept(const std::string& path_)
{
auto ext = boost::filesystem::path(path_).extension().string();
return ext == ".dummy";
}
bool DummyParser::parse()
{
for(std::string path : _ctx.options["input"].as<std::vector<std::string>>())
{
if(accept(path))
{
LOG(info) << "DummyParser parse path: " << path;
}
}
return true;
}
DummyParser::~DummyParser()
{
}
/* These two methods are used by the plugin manager to allow dynamic loading
of CodeCompass Parser plugins. Clang (>= version 6.0) gives a warning that
these C-linkage specified methods return types that are not proper from a
C code.
These codes are NOT to be called from any C code. The C linkage is used to
turn off the name mangling so that the dynamic loader can easily find the
symbol table needed to set the plugin up.
*/
// When writing a plugin, please do NOT copy this notice to your code.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
extern "C"
{
boost::program_options::options_description getOptions()
{
boost::program_options::options_description description("Dummy Plugin");
description.add_options()
("dummy-arg", po::value<std::string>()->default_value("Dummy arg"),
"This argument will be used by the dummy parser.");
return description;
}
std::shared_ptr<DummyParser> make(ParserContext& ctx_)
{
return std::make_shared<DummyParser>(ctx_);
}
}
#pragma clang diagnostic pop
} // parser
} // cc