libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
url.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2012 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6 
7 #ifndef _QI_MESSAGING_URL_HPP_
8 #define _QI_MESSAGING_URL_HPP_
9 
10 #include <string>
11 #include <vector>
12 
13 #include <qi/api.hpp>
14 
15 namespace qi {
16  class UrlPrivate;
17 
35  class QI_API Url
36  {
37  public:
40  Url();
41 
46  Url(const std::string &url);
47 
54  Url(const std::string &url, unsigned short defaultPort);
55 
62  Url(const std::string &url, const std::string &defaultProtocol);
63 
72  Url(const std::string &url, const std::string &defaultProtocol, unsigned short defaultPort);
73 
77  Url(const char *url);
82  virtual ~Url();
83 
87  Url(const qi::Url& url);
88  Url& operator= (const Url& rhs);
89  bool operator< (const Url& rhs) const;
97  bool isValid() const;
98 
104  const std::string& str() const;
105 
110  const std::string& protocol() const;
111 
113  bool hasProtocol() const;
114 
116  void setProtocol(const std::string& protocol);
117 
122  const std::string& host() const;
123 
125  bool hasHost() const;
126 
128  void setHost(const std::string& host);
129 
133  unsigned short port() const;
134 
136  bool hasPort() const;
137 
139  void setPort(unsigned short port);
140 
141  private:
142  UrlPrivate* _p;
143  };
144 
147  QI_API bool operator==(const Url& lhs, const Url& rhs);
150  QI_API inline bool operator!=(const Url& lhs, const Url& rhs)
151  { return !(lhs == rhs); }
152 
153  QI_API std::ostream& operator<<(std::ostream& out, const Url& url);
154 
155  using UrlVector = std::vector<Url>;
156 
162  QI_API Url specifyUrl(const Url& specification, const Url& baseUrl);
163 } // namespace qi
164 
165 #endif // _QIMESSAGING_URL_HPP_
#define QI_API
Definition: api.hpp:33
std::ostream & operator<<(std::ostream &o, FutureState x)
Definition: future_fwd.hpp:90
dll import/export and compiler message
bool operator==(const Signature &lhs, const Signature &rhs)
std::vector< Url > UrlVector
Definition: url.hpp:155
Definition: url.hpp:35
bool operator<(const AnyReference &a, const AnyReference &b)
bool operator!=(const Signature &lhs, const Signature &rhs)
Definition: signature.hpp:157
Url specifyUrl(const Url &specification, const Url &baseUrl)