Makes operator to use string_view

This commit is contained in:
Felipe Zimmerle
2019-03-05 12:26:44 -03:00
parent f5cdf03de1
commit af23c720ae
85 changed files with 1954 additions and 298 deletions

View File

@@ -110,8 +110,10 @@ bool VerifyCPF::verify(const char *cpfnumber, int len) {
}
bool VerifyCPF::evaluate(Transaction *t, RuleWithActions *rule,
const std::string& input, RuleMessage *ruleMessage) {
bool VerifyCPF::evaluate(Transaction *transaction,
RuleWithActions *rule,
const bpstd::string_view &input,
RuleMessage *ruleMessage) {
std::list<SMatch> matches;
bool is_cpf = false;
int i;
@@ -121,15 +123,15 @@ bool VerifyCPF::evaluate(Transaction *t, RuleWithActions *rule,
}
for (i = 0; i < input.size() - 1 && is_cpf == false; i++) {
matches = m_re->searchAll(input.substr(i, input.size()));
matches = m_re->searchAll(input.substr(i, input.size()).to_string());
for (const auto & m : matches) {
is_cpf = verify(m.str().c_str(), m.str().size());
if (is_cpf) {
logOffset(ruleMessage, m.offset(), m.str().size());
if (rule && t && rule->hasCaptureAction()) {
t->m_collections.m_tx_collection->storeOrUpdateFirst(
if (rule && transaction && rule->hasCaptureAction()) {
transaction->m_collections.m_tx_collection->storeOrUpdateFirst(
"0", m.str());
ms_dbg_a(t, 7, "Added VerifyCPF match TX.0: " + \
ms_dbg_a(transaction, 7, "Added VerifyCPF match TX.0: " + \
m.str());
}