Qpid Proton C++ API 0.39.0
 
Loading...
Searching...
No Matches
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 "./error.hpp"
26
27#include <proton/type_compat.h>
28
29#include <iosfwd>
30#include <memory>
31#include <string>
32
35
36namespace proton {
37
41
42struct
43PN_CPP_DEPRECATED("Use a third-party URL library")
44PN_CPP_CLASS_EXTERN url_error : public error {
47 PN_CPP_EXTERN explicit url_error(const std::string&);
48 PN_CPP_EXTERN ~url_error() throw();
50};
51
66class PN_CPP_DEPRECATED("Use a third-party URL library") url {
67 public:
68 static const std::string AMQP;
69 static const std::string AMQPS;
70
71 // XXX No constructor for an empty URL?
72 // XXX What is the default 'defaults' behavior?
73
78 PN_CPP_EXTERN url(const std::string& url_str);
79
89 PN_CPP_EXTERN url(const std::string& url_str, bool defaults);
91
93 PN_CPP_EXTERN url(const url&);
94
95 PN_CPP_EXTERN ~url();
96
98 PN_CPP_EXTERN url& operator=(const url&);
99
101 PN_CPP_EXTERN bool empty() const;
102
104 PN_CPP_EXTERN operator std::string() const;
105
109
111 PN_CPP_EXTERN std::string scheme() const;
113 PN_CPP_EXTERN std::string user() const;
114 // XXX Passwords in URLs are dumb.
116 PN_CPP_EXTERN std::string password() const;
118 PN_CPP_EXTERN std::string host() const;
120 PN_CPP_EXTERN std::string port() const;
122 PN_CPP_EXTERN uint16_t port_int() const;
124 PN_CPP_EXTERN std::string host_port() const;
125
126 // XXX is this not confusing (or incorrect)? The path starts with
127 // the first / after //.
129 PN_CPP_EXTERN std::string path() const;
130
132
134 friend PN_CPP_EXTERN std::string to_string(const url&);
135
136 private:
137 struct impl;
138 std::unique_ptr<impl> impl_;
139
141
142 friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const url&);
143
144 // XXX Why is it important to have this?
150 friend PN_CPP_EXTERN std::istream& operator>>(std::istream&, url&);
151
153};
154
155} // proton
156
157#endif // PROTON_URL_HPP
Deprecated - Use a third-party URL library.
Definition: url.hpp:66
url(const url &)
Copy a URL.
std::string host_port() const
host_port returns just the host:port part of the URL
static const std::string AMQPS
"amqps" prefix
Definition: url.hpp:69
url(const std::string &url_str)
Parse url_str as an AMQP URL.
friend std::string to_string(const url &)
Return URL as a string.
std::string host() const
The host name or IP address.
bool empty() const
True if the URL is empty.
std::string port() const
port can be a number or a symbolic name such as "amqp".
std::string password() const
The password.
std::string scheme() const
amqp or amqps.
std::string user() const
The user name for authentication.
uint16_t port_int() const
port_int is the numeric value of the port.
url & operator=(const url &)
Copy a URL.
std::string path() const
path is everything after the final "/".
static const std::string AMQP
"amqp" prefix
Definition: url.hpp:68
The base Proton error.
The main Proton namespace.
Definition: annotation_key.hpp:33
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
The base Proton error.
Definition: error.hpp:40
Deprecated - Use a third-party URL library.
Definition: url.hpp:44