Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET
Apache Qpid Documentation
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
qpid
Url.h
Go to the documentation of this file.
1
#ifndef QPID_URL_H
2
#define QPID_URL_H
3
4
/*
5
*
6
* Copyright (c) 2006 The Apache Software Foundation
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*
20
*/
21
22
#include "
qpid/Address.h
"
23
#include "
qpid/Exception.h
"
24
#include <string>
25
#include <vector>
26
#include <new>
27
#include <ostream>
28
#include "
qpid/CommonImportExport.h
"
29
30
namespace
qpid {
31
33
struct
Url
:
public
std::vector<Address> {
34
36
QPID_COMMON_EXTERN
static
Url
getHostNameUrl
(
uint16_t
port);
37
40
QPID_COMMON_EXTERN
static
Url
getIpAddressesUrl
(
uint16_t
port);
41
42
struct
Invalid
:
public
Exception
{
QPID_COMMON_EXTERN
Invalid
(
const
std::string& s); };
43
45
QPID_COMMON_EXTERN
std::string
str
()
const
;
46
48
Url
() {}
49
51
explicit
Url
(
const
Address
& addr) { push_back(addr); }
52
54
explicit
Url
(
const
std::string& url) {
parse
(url.c_str()); }
56
explicit
Url
(
const
std::string& url,
const
std::string& defaultProtocol) {
parse
(url.c_str(), defaultProtocol); }
57
59
explicit
Url
(
const
char
* url) {
parse
(url); }
60
61
Url
&
operator=
(
const
char
* s) {
parse
(s);
return
*
this
; }
62
Url
&
operator=
(
const
std::string& s) {
parse
(s);
return
*
this
; }
63
65
QPID_COMMON_EXTERN
void
throwIfEmpty
()
const
;
66
70
QPID_COMMON_EXTERN
void
parse
(
const
char
* url);
71
QPID_COMMON_EXTERN
void
parse
(
const
char
* url,
const
std::string& defaultProtocol);
72
QPID_COMMON_INLINE_EXTERN
void
parse
(
const
std::string& url) {
parse
(url.c_str()); }
73
75
QPID_COMMON_EXTERN
void
parseNoThrow
(
const
char
* url);
76
QPID_COMMON_EXTERN
void
parseNoThrow
(
const
char
* url,
const
std::string& defaultProtocol);
77
81
QPID_COMMON_EXTERN
static
void
addProtocol
(
const
std::string& tag);
82
83
QPID_COMMON_EXTERN
void
setUser
(
const
std::string&);
84
QPID_COMMON_EXTERN
void
setPass
(
const
std::string&);
85
QPID_COMMON_EXTERN
std::string
getUser
()
const
;
86
QPID_COMMON_EXTERN
std::string
getPass
()
const
;
87
88
private
:
89
mutable
std::string cache;
// cache string form for efficiency.
90
std::string user, pass;
91
92
friend
class
UrlParser
;
93
};
94
95
inline
bool
operator==
(
const
Url
& a,
const
Url
& b) {
return
a.
str
()==b.
str
(); }
96
inline
bool
operator!=
(
const
Url
& a,
const
Url
& b) {
return
a.
str
()!=b.
str
(); }
97
98
QPID_COMMON_EXTERN
std::ostream&
operator<<
(std::ostream& os,
const
Url& url);
99
QPID_COMMON_EXTERN
std::istream&
operator>>
(std::istream& is, Url& url);
100
101
}
// namespace qpid
102
103
#endif
Qpid C++ API Reference
Generated on Mon Apr 1 2013 for Qpid C++ Client API by
1.8.3.1