File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,28 @@ void IpAddresses::add(const IpAddress &ip)
2828 m_ips.insert (ip);
2929}
3030
31+ bool IpAddresses::contains (const std::string &ipStr)
32+ {
33+ IpAddress ip (ipStr);
34+ return m_ips.find (ip) != m_ips.end ();
35+ }
36+
37+ bool IpAddresses::contains (const IpAddress &ip)
38+ {
39+ return m_ips.find (ip) != m_ips.end ();
40+ }
41+
42+ void IpAddresses::remove (const string &ipStr)
43+ {
44+ IpAddress ip (ipStr);
45+ m_ips.erase (ip);
46+ }
47+
48+ void IpAddresses::remove (const IpAddress &ip)
49+ {
50+ m_ips.erase (ip);
51+ }
52+
3153const string IpAddresses::to_string () const
3254{
3355 string ips_str;
Original file line number Diff line number Diff line change @@ -44,6 +44,14 @@ class IpAddresses
4444
4545 void add (const IpAddress &ip);
4646
47+ bool contains (const std::string &ip);
48+
49+ bool contains (const IpAddress &ip);
50+
51+ void remove (const std::string &ip);
52+
53+ void remove (const IpAddress &ip);
54+
4755 const std::string to_string () const ;
4856
4957
You can’t perform that action at this time.
0 commit comments