-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.h
More file actions
44 lines (35 loc) · 926 Bytes
/
Copy pathfilter.h
File metadata and controls
44 lines (35 loc) · 926 Bytes
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
#ifndef SIMPLIFY_CORE_H
#define SIMPLIFY_CORE_H
#include "filterOptions.h"
#include <set>
#include <istream>
#include <ostream>
#define DLL_PUBLIC __attribute__ ((visibility ("default")))
namespace Simplify {
class DLL_PUBLIC Filter {
public:
typedef std::filesystem::path Path;
typedef std::set<Path> PathSet;
void initiailize(FilterOptions &);
void filterStream(std::istream & input, std::ostream & output) const;
void find(const Path & root, std::ostream & output) const;
void reset();
protected:
void addMountpoints();
bool accept(const Path & input) const;
bool pathPrefixesExclusion(const Path &) const;
bool pathPrefixesAccepted(const Path &) const;
static auto remove_trailing_separator(const Path & p)
{
if (!p.has_filename()) {
return p.parent_path();
}
else {
return p;
}
}
PathSet exclude;
mutable PathSet accepted;
};
}
#endif