1 | #include "cpr/proxies.h" |
---|---|
2 | |
3 | #include <initializer_list> |
4 | #include <map> |
5 | #include <string> |
6 | #include <utility> |
7 | |
8 | namespace cpr { |
9 | |
10 | Proxies::Proxies(const std::initializer_list<std::pair<const std::string, std::string>>& hosts) : hosts_{hosts} {} |
11 | Proxies::Proxies(const std::map<std::string, std::string>& hosts) : hosts_{hosts} {} |
12 | |
13 | bool Proxies::has(const std::string& protocol) const { |
14 | return hosts_.count(x: protocol) > 0; |
15 | } |
16 | |
17 | const std::string& Proxies::operator[](const std::string& protocol) { |
18 | return hosts_[protocol]; |
19 | } |
20 | |
21 | } // namespace cpr |
22 |