forked from tat/mimetic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathengine.h
55 lines (48 loc) · 1.78 KB
/
engine.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _MM_ENGINE_H_
#define _MM_ENGINE_H_
#include <mimetic/mimetic.h>
#include <stack>
#include "mm.h"
#include "cmdline.h"
struct engine
{
typedef mimetic::MimeEntity MimeEntity;
typedef std::string string;
typedef std::list<MimeEntity*> parts_hierarchy;
engine(const command_line&);
MimeEntity* match(MimeEntity&, int level = 0, parts_hierarchy* ph = 0);
private:
enum {
match_type_none,
match_type_exact,
match_type_regex,
match_type_shell,
// flags
match_flag_case_insensitive = 1 << 4,
match_flag_perl_mode = 1 << 5,
// masks
match_type_mask = 0x0F,
match_flag_mask = 0xF0
};
void action_attach(MimeEntity&, parts_hierarchy*, const string& fqn);
void action(MimeEntity&, parts_hierarchy*);
int perl_regex_match(const string&, const string&, int);
int match_filename(const string&, const string&);
int posix_regex_match(const string&, const string&, int);
int regex_match(const string&, const string&, int);
int exact_match(const string&, const string&, int);
int shell_match(const string&, const string&, int);
int pattern_match(const string&, const string&, int);
int pattern_field_match(const MimeEntity& me, const string&, int);
int fixed_field_match(const MimeEntity&, const string&, const string&, int);
int has_binary_attach(const MimeEntity&, const command_line_switch&);
int has_field(const MimeEntity&, const command_line_switch&);
int attach_filename(const MimeEntity&, const command_line_switch&);
int field_match(const MimeEntity&, const command_line_switch&);
string remove_external_blanks(const string&) const;
private:
command_line m_cl;
bool m_ignore_childs, m_pcre;
int m_match_mode;
};
#endif