Loading...
Searching...
No Matches
url.hpp
Go to the documentation of this file.
#ifndef PROTON_URL_HPP
#define PROTON_URL_HPP
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#include "./error.hpp"
#include <proton/type_compat.h>
#include <iosfwd>
#include <memory>
#include <string>
namespace proton {
struct
PN_CPP_DEPRECATED("Use a third-party URL library")
PN_CPP_CLASS_EXTERN url_error : public error {
PN_CPP_EXTERN explicit url_error(const std::string&);
PN_CPP_EXTERN ~url_error() throw();
};
class PN_CPP_DEPRECATED("Use a third-party URL library") url {
public:
static const std::string AMQP;
static const std::string AMQPS;
// XXX No constructor for an empty URL?
// XXX What is the default 'defaults' behavior?
PN_CPP_EXTERN url(const std::string& url_str);
PN_CPP_EXTERN url(const std::string& url_str, bool defaults);
PN_CPP_EXTERN url(const url&);
PN_CPP_EXTERN ~url();
PN_CPP_EXTERN url& operator=(const url&);
PN_CPP_EXTERN bool empty() const;
PN_CPP_EXTERN operator std::string() const;
PN_CPP_EXTERN std::string scheme() const;
PN_CPP_EXTERN std::string user() const;
// XXX Passwords in URLs are dumb.
PN_CPP_EXTERN std::string password() const;
PN_CPP_EXTERN std::string host() const;
PN_CPP_EXTERN std::string port() const;
PN_CPP_EXTERN uint16_t port_int() const;
PN_CPP_EXTERN std::string host_port() const;
// XXX is this not confusing (or incorrect)? The path starts with
// the first / after //.
PN_CPP_EXTERN std::string path() const;
friend PN_CPP_EXTERN std::string to_string(const url&);
private:
struct impl;
std::unique_ptr<impl> impl_;
friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const url&);
// XXX Why is it important to have this?
friend PN_CPP_EXTERN std::istream& operator>>(std::istream&, url&);
};
} // proton
#endif // PROTON_URL_HPP
proton::map
A collection of key-value pairs.
Definition map.hpp:69
proton::url
Deprecated - Use a third-party URL library.
Definition url.hpp:66
proton::url::url
url(const url &)
Copy a URL.
proton::url::host_port
std::string host_port() const
host_port returns just the host:port part of the URL
proton::url::AMQPS
static const std::string AMQPS
"amqps" prefix
Definition url.hpp:69
proton::url::url
url(const std::string &url_str)
Parse url_str as an AMQP URL.
proton::url::to_string
friend std::string to_string(const url &)
Return URL as a string.
proton::url::host
std::string host() const
The host name or IP address.
proton::url::empty
bool empty() const
True if the URL is empty.
proton::url::port
std::string port() const
port can be a number or a symbolic name such as "amqp".
proton::url::password
std::string password() const
The password.
proton::url::scheme
std::string scheme() const
amqp or amqps.
proton::url::user
std::string user() const
The user name for authentication.
proton::url::port_int
uint16_t port_int() const
port_int is the numeric value of the port.
proton::url::operator=
url & operator=(const url &)
Copy a URL.
proton::url::path
std::string path() const
path is everything after the final "/".
proton::url::AMQP
static const std::string AMQP
"amqp" prefix
Definition url.hpp:68
error.hpp
The base Proton error.
proton
The main Proton namespace.
Definition annotation_key.hpp:33
proton::operator>>
proton::codec::decoder & operator>>(proton::codec::decoder &d, map< K, T > &m)
Decode from a proton::map.
proton::operator<<
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
proton::error
The base Proton error.
Definition error.hpp:40
proton::url_error
Deprecated - Use a third-party URL library.
Definition url.hpp:44