proxies.cpp 543 B

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