-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRuleAll.cpp
More file actions
47 lines (38 loc) · 979 Bytes
/
RuleAll.cpp
File metadata and controls
47 lines (38 loc) · 979 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
44
45
46
//
// Created by male on 17/04/17.
//
#include "RuleAll.h"
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <fstream>
using std::for_each;
using std::string;
using std::endl;
using std::ios;
using std::ifstream;
using std::cout;
using std::vector;
using std::for_each;
RuleAll::RuleAll(const string &src, const string &dst, size_t threshold,
const vector<string> &words, size_t id) :
Rule(src, dst, threshold,words,id){}
void RuleAll::checkData(string data) {
// this->curr_data = data;
vector<bool> matches;
for (size_t i = 0; i < words.size(); ++i) {
matches.push_back(data.find(words[i]) != std::string::npos);
}
bool is_match = matches[0];
for (size_t i = 0; i < matches.size(); ++i) {
is_match = is_match && matches[i];
}
// is_match = matches[0];
if (is_match){
++occurrences;
triggered = true;
}
}