本文整理汇总了C++中Url::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Url::empty方法的具体用法?C++ Url::empty怎么用?C++ Url::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
void Connection::open(const Url& url, const ConnectionSettings& settings) {
if (url.empty())
throw Exception(QPID_MSG("Attempt to open URL with no addresses."));
Url::const_iterator i = url.begin();
do {
const Address& addr = *i;
i++;
try {
ConnectionSettings cs(settings);
if (addr.protocol.size()) cs.protocol = addr.protocol;
cs.host = addr.host;
cs.port = addr.port;
open(cs);
break;
}
catch (const Exception& /*e*/) {
if (i == url.end()) throw;
}
} while (i != url.end());
}
示例2: setBrokerUrl
void Backup::setBrokerUrl(const Url& brokers) {
if (brokers.empty()) return;
Mutex::ScopedLock l(lock);
if (stopped) return;
if (haBroker.getStatus() == JOINING) statusCheck->setUrl(brokers);
if (!link) { // Not yet initialized
QPID_LOG(info, logPrefix << "Connecting to cluster, broker URL: " << brokers);
string protocol = brokers[0].protocol.empty() ? "tcp" : brokers[0].protocol;
types::Uuid uuid(true);
link = broker.getLinks().declare(
broker::QPID_NAME_PREFIX + string("ha.link.") + uuid.str(),
brokers[0].host, brokers[0].port, protocol,
false, // durable
settings.mechanism, settings.username, settings.password,
false).first; // no amq.failover - don't want to use client URL.
replicator = BrokerReplicator::create(haBroker, link);
broker.getExchanges().registerExchange(replicator);
}
link->setUrl(brokers);
}