-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter.H
40 lines (30 loc) · 860 Bytes
/
filter.H
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
#ifndef FILTER_H
#define FILTER_H
#include <string>
#include <list>
#include "regex.H"
class Args;
class Filter
{
public:
explicit Filter(Args const & args);
~Filter();
inline Args const & args() const
{
return m_args;
}
bool matchDir(std::string const & name) const;
bool excludeDir(std::string const & name) const;
bool matchFile(std::string const & name) const;
bool hasContentFilters() const;
bool hasExcludeContentFilters() const;
bool printContent() const;
bool matchContent(std::string const & line, Match * pmatch = nullptr) const;
bool excludeContent(std::string const & line) const;
private:
Args const & m_args;
Regex::PtrList m_inContent;
Regex::PtrList m_exContent;
static bool fnmatch(std::string const& pattern, std::string const& string, bool icase);
};
#endif