proton/url.hpp

Go to the documentation of this file.
00001 #ifndef PROTON_URL_HPP
00002 #define PROTON_URL_HPP
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include "./internal/pn_unique_ptr.hpp"
00026 #include "./error.hpp"
00027 
00028 #include <proton/type_compat.h>
00029 
00030 #include <iosfwd>
00031 #include <string>
00032 
00035 
00036 namespace proton {
00037 
00041 
00042 struct
00043 PN_CPP_DEPRECATED("Use a third-party URL library")
00044 PN_CPP_CLASS_EXTERN url_error : public error {
00047     PN_CPP_EXTERN explicit url_error(const std::string&);
00049 };
00050 
00065 class PN_CPP_DEPRECATED("Use a third-party URL library") url {
00066   public:
00067     static const std::string AMQP;     
00068     static const std::string AMQPS;    
00069 
00070     // XXX No constructor for an empty URL?
00071     // XXX What is the default 'defaults' behavior?
00072 
00077     PN_CPP_EXTERN url(const std::string& url_str);
00078 
00088     PN_CPP_EXTERN url(const std::string& url_str, bool defaults);
00090 
00092     PN_CPP_EXTERN url(const url&);
00093 
00094     PN_CPP_EXTERN ~url();
00095 
00097     PN_CPP_EXTERN url& operator=(const url&);
00098 
00100     PN_CPP_EXTERN bool empty() const;
00101 
00103     PN_CPP_EXTERN operator std::string() const;
00104 
00108 
00110     PN_CPP_EXTERN std::string scheme() const;
00112     PN_CPP_EXTERN std::string user() const;
00113     // XXX Passwords in URLs are dumb.
00115     PN_CPP_EXTERN std::string password() const;
00117     PN_CPP_EXTERN std::string host() const;
00119     PN_CPP_EXTERN std::string port() const;
00121     PN_CPP_EXTERN uint16_t port_int() const;
00123     PN_CPP_EXTERN std::string host_port() const;
00124 
00125     // XXX is this not confusing (or incorrect)?  The path starts with
00126     // the first / after //.
00128     PN_CPP_EXTERN std::string path() const;
00129 
00131 
00133     friend PN_CPP_EXTERN std::string to_string(const url&);
00134 
00135   private:
00136     struct impl;
00137     internal::pn_unique_ptr<impl> impl_;
00138 
00140 
00141   friend PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const url&);
00142 
00143     // XXX Why is it important to have this?
00149   friend PN_CPP_EXTERN std::istream& operator>>(std::istream&, url&);
00150 
00152 };
00153 
00154 } // proton
00155 
00156 #endif // PROTON_URL_HPP

Generated on 17 Jan 2019 for Qpid Proton C++ by  doxygen 1.6.1