Qpid Proton C++ API  0.18.1
url.hpp
Go to the documentation of this file.
1 #ifndef PROTON_URL_HPP
2 #define PROTON_URL_HPP
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
25 #include "./internal/pn_unique_ptr.hpp"
26 #include "./error.hpp"
27 
28 #include <proton/type_compat.h>
29 
30 #include <iosfwd>
31 #include <string>
32 
35 
36 namespace proton {
37 
41 
42 struct
43 PN_CPP_DEPRECATED("Use a third-party URL library")
44 PN_CPP_CLASS_EXTERN url_error : public error {
47  PN_CPP_EXTERN explicit url_error(const std::string&);
49 };
50 
65 class PN_CPP_DEPRECATED("Use a third-party URL library") url {
66  public:
67  static const std::string AMQP;
68  static const std::string AMQPS;
69 
70  // XXX No constructor for an empty URL?
71  // XXX What is the default 'defaults' behavior?
72 
77  PN_CPP_EXTERN url(const std::string& url_str);
78 
88  PN_CPP_EXTERN url(const std::string& url_str, bool defaults);
90 
92  PN_CPP_EXTERN url(const url&);
93 
94  PN_CPP_EXTERN ~url();
95 
97  PN_CPP_EXTERN url& operator=(const url&);
98 
100  PN_CPP_EXTERN bool empty() const;
101 
103  PN_CPP_EXTERN operator std::string() const;
104 
108 
110  PN_CPP_EXTERN std::string scheme() const;
112  PN_CPP_EXTERN std::string user() const;
113  // XXX Passwords in URLs are dumb.
115  PN_CPP_EXTERN std::string password() const;
117  PN_CPP_EXTERN std::string host() const;
119  PN_CPP_EXTERN std::string port() const;
121  PN_CPP_EXTERN uint16_t port_int() const;
123  PN_CPP_EXTERN std::string host_port() const;
124 
125  // XXX is this not confusing (or incorrect)? The path starts with
126  // the first / after //.
128  PN_CPP_EXTERN std::string path() const;
129 
131 
133  friend PN_CPP_EXTERN std::string to_string(const url&);
134 
135  private:
136  struct impl;
137  internal::pn_unique_ptr<impl> impl_;
138 
140 
141  friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const url&);
142 
143  // XXX Why is it important to have this?
149  friend PN_CPP_EXTERN std::istream& operator>>(std::istream&, url&);
150 
152 };
153 
154 } // proton
155 
156 #endif // PROTON_URL_HPP
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
static const std::string AMQP
"amqp" prefix
Definition: url.hpp:67
proton::codec::decoder & operator>>(proton::codec::decoder &d, map< K, T > &m)
Decode from a proton::map.
Deprecated - Use a third-party URL library.
Definition: url.hpp:42
std::string to_string(const scalar_base &x)
Return a readable string representation of x for display purposes.
Deprecated - Use a third-party URL library.
Definition: url.hpp:65
The base Proton error.
The base Proton error.
Definition: error.hpp:40
The main Proton namespace.
Definition: annotation_key.hpp:33
static const std::string AMQPS
"amqps" prefix
Definition: url.hpp:68