Mantid
Loading...
Searching...
No Matches
ProxyInfo.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8#include <stdexcept>
9
10namespace Mantid::Kernel {
11
12//----------------------------------------------------------------------------------------------
15ProxyInfo::ProxyInfo() : m_host(""), m_port(0), m_isHttpProxy(false), m_isEmptyProxy(true) {}
16
23ProxyInfo::ProxyInfo(const std::string &host, const int port, const bool isHttpProxy)
24 : m_host(host), m_port(port), m_isHttpProxy(isHttpProxy), m_isEmptyProxy(false) {
25 if (host.empty() || port == 0) {
26 m_isEmptyProxy = true;
27 }
28}
29
34std::string ProxyInfo::host() const {
35 if (m_isEmptyProxy) {
36 throw std::logic_error("Calling host on an undefined proxy");
37 }
38 return m_host;
39}
40
45int ProxyInfo::port() const {
46 if (m_isEmptyProxy) {
47 throw std::logic_error("Calling port on an undefined proxy");
48 }
49 return m_port;
50}
51
56bool ProxyInfo::isHttpProxy() const { return m_isHttpProxy; }
57
62bool ProxyInfo::emptyProxy() const { return m_isEmptyProxy; }
63
64} // namespace Mantid::Kernel
ProxyInfo()
Constructor.
Definition: ProxyInfo.cpp:15
int port() const
Port Number.
Definition: ProxyInfo.cpp:45
std::string host() const
Host url.
Definition: ProxyInfo.cpp:34
bool isHttpProxy() const
Is this a http proxy.
Definition: ProxyInfo.cpp:56