21#include "mongo/bson/util/builder.h"
22#include "mongo/platform/hash_namespace.h"
27 template <
typename T>
class StatusWith;
72 bool operator!=(
const HostAndPort& r)
const {
return !(*
this == r); }
97 const std::string& host()
const {
102 bool hasPort()
const {
111 MONGO_CLIENT_API std::ostream& MONGO_CLIENT_FUNC operator<<(std::ostream& os,
const HostAndPort& hp);
115MONGO_HASH_NAMESPACE_START
122MONGO_HASH_NAMESPACE_END
Definition sasl_client_conversation.h:27
std::stringstream deals with locale so this is a lot faster than std::stringstream for UTF8
Definition builder.h:299
the main MongoDB namespace
Definition bulk_operation_builder.h:24
MONGO_CLIENT_API Status(MONGO_CLIENT_FUNC *saslClientAuthenticate)(DBClientWithCommands *client
Attempts to authenticate "client" using the SASL protocol.
Name of a process on the network.
Definition hostandport.h:36
std::string toString() const
Returns a string representation of "host:port".
static StatusWith< HostAndPort > MONGO_CLIENT_FUNC parse(const StringData &text)
Parses "text" to produce a HostAndPort.
bool isLocalHost() const
Returns true if the hostname looks localhost-y.
HostAndPort(const StringData &text)
Constructs a HostAndPort by parsing "text" of the form hostname[:portnumber] Throws an AssertionExcep...
void append(StringBuilder &ss) const
Like toString(), above, but writes to "ss", instead.
bool empty() const
Returns true if this object represents no valid HostAndPort.
HostAndPort(const std::string &h, int p)
Constructs a HostAndPort with the hostname "h" and port "p".
Status initialize(const StringData &s)
(Re-)initializes this HostAndPort by parsing "s".
HostAndPort()
Construct an empty/invalid HostAndPort.