CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
prefix_filter.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Prefix Filtering
4
5Author: Peter Schrammel
6
7\*******************************************************************/
8
11
12#include "prefix_filter.h"
13
14#include <algorithm>
15
16#include "prefix.h"
17
19 std::vector<std::string> included_prefixes,
20 std::vector<std::string> excluded_prefixes)
21 : included_prefixes(std::move(included_prefixes)),
22 excluded_prefixes(std::move(excluded_prefixes))
23{
24}
25
26bool prefix_filtert::operator()(const std::string &value) const
27{
28 if(!included_prefixes.empty())
29 {
30 // We don't include everything, so let's check whether value is included.
31 const bool matches_included = std::any_of(
32 included_prefixes.begin(),
34 [value](const std::string &prefix) { return has_prefix(value, prefix); });
36 return false;
37 }
38
39 // We know it's included so let's check whether it's excluded.
40 const bool matches_excluded = std::any_of(
41 excluded_prefixes.begin(),
43 [value](const std::string &prefix) { return has_prefix(value, prefix); });
44 return !matches_excluded;
45}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
std::vector< std::string > included_prefixes
prefix_filtert(std::vector< std::string > included_prefixes, std::vector< std::string > excluded_prefixes)
bool operator()(const std::string &value) const
Return true iff value matches a prefix in included_prefixes, but doesn't match a prefix in excluded_p...
std::vector< std::string > excluded_prefixes
STL namespace.
Prefix Filtering.