zeek/src/CCL.cc
Benjamin Bannier f5a76c1aed Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The
one place where we deviate is header include order since Zeek depends on
headers being included in a certain order.
2023-10-30 09:40:55 +01:00

41 lines
775 B
C++

// See the file "COPYING" in the main distribution directory for copyright.
#include "zeek/CCL.h"
#include "zeek/zeek-config.h"
#include <algorithm>
#include "zeek/DFA.h"
#include "zeek/RE.h"
namespace zeek::detail {
CCL::CCL() {
syms = new int_list;
index = -(rem->InsertCCL(this) + 1);
negated = 0;
}
CCL::~CCL() { delete syms; }
void CCL::Negate() {
negated = 1;
Add(SYM_BOL);
Add(SYM_EOL);
}
void CCL::Add(int sym) {
auto sym_p = static_cast<std::intptr_t>(sym);
// Check to see if the character is already in the ccl.
for ( auto sym_entry : *syms )
if ( sym_entry == sym_p )
return;
syms->push_back(sym_p);
}
void CCL::Sort() { std::sort(syms->begin(), syms->end()); }
} // namespace zeek::detail