-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.cpp
More file actions
37 lines (30 loc) · 807 Bytes
/
filter.cpp
File metadata and controls
37 lines (30 loc) · 807 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
#include "filter.h"
std::vector<std::string> split(const std::string &str, char d)
{
std::vector<std::string> r;
std::string::size_type start = 0;
std::string::size_type stop = str.find_first_of(d);
while (stop != std::string::npos)
{
r.push_back(str.substr(start, stop - start));
start = stop + 1;
stop = str.find_first_of(d, start);
}
r.push_back(str.substr(start));
return r;
}
void printVector(const ip_vec &vec_)
{
for (auto i = vec_.cbegin(); i != vec_.cend(); i++)
{
std::cout << +(*i);
if (i != vec_.cend() - 1)
std::cout << ".";
}
std::cout << std::endl;
}
void printIpPool(const ip_pool_list &list_)
{
for (auto ip = list_.cbegin(); ip != list_.cend(); ip++)
printVector(*ip);
}