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
35
struct
Invalid
:
public
Exception
{
QPID_COMMON_EXTERN
Invalid
(
const
std::string& s); };
36
38
QPID_COMMON_EXTERN
std::string
str
()
const
;
39
41
Url
() {}
42
44
explicit
Url
(
const
Address
& addr) { push_back(addr); }
45
47
explicit
Url
(
const
std::string& url) {
parse
(url.c_str()); }
49
explicit
Url
(
const
std::string& url,
const
std::string& defaultProtocol) {
parse
(url.c_str(), defaultProtocol); }
50
52
explicit
Url
(
const
char
* url) {
parse
(url); }
53
54
Url
&
operator=
(
const
char
* s) {
parse
(s);
return
*
this
; }
55
Url
&
operator=
(
const
std::string& s) {
parse
(s);
return
*
this
; }
56
58
QPID_COMMON_EXTERN
void
throwIfEmpty
()
const
;
59
63
QPID_COMMON_EXTERN
void
parse
(
const
char
* url);
64
QPID_COMMON_EXTERN
void
parse
(
const
char
* url,
const
std::string& defaultProtocol);
65
QPID_COMMON_INLINE_EXTERN
void
parse
(
const
std::string& url) {
parse
(url.c_str()); }
66
68
QPID_COMMON_EXTERN
void
parseNoThrow
(
const
char
* url);
69
QPID_COMMON_EXTERN
void
parseNoThrow
(
const
char
* url,
const
std::string& defaultProtocol);
70
74
QPID_COMMON_EXTERN
static
void
addProtocol
(
const
std::string& tag);
75
76
QPID_COMMON_EXTERN
void
setUser
(
const
std::string&);
77
QPID_COMMON_EXTERN
void
setPass
(
const
std::string&);
78
QPID_COMMON_EXTERN
std::string
getUser
()
const
;
79
QPID_COMMON_EXTERN
std::string
getPass
()
const
;
80
81
private
:
82
mutable
std::string cache;
// cache string form for efficiency.
83
std::string user, pass;
84
85
friend
class
UrlParser
;
86
};
87
88
inline
bool
operator==
(
const
Url
& a,
const
Url
& b) {
return
a.
str
()==b.
str
(); }
89
inline
bool
operator!=
(
const
Url
& a,
const
Url
& b) {
return
a.
str
()!=b.
str
(); }
90
91
QPID_COMMON_EXTERN
std::ostream&
operator<<
(std::ostream& os,
const
Url& url);
92
QPID_COMMON_EXTERN
std::istream&
operator>>
(std::istream& is, Url& url);
93
94
}
// namespace qpid
95
96
#endif
Qpid C++ API Reference
Generated on Thu Aug 28 2014 for Qpid C++ Client API by
1.8.3.1