|
MongoDB C++ Driver
legacy-1.1.2
|
Name of a process on the network. More...
#include <hostandport.h>
Public Member Functions | |
| HostAndPort () | |
| Construct an empty/invalid HostAndPort. | |
| HostAndPort (const StringData &text) | |
| Constructs a HostAndPort by parsing "text" of the form hostname[:portnumber] Throws an AssertionException if bad config std::string or bad port #. | |
| HostAndPort (const std::string &h, int p) | |
| Constructs a HostAndPort with the hostname "h" and port "p". More... | |
| Status | initialize (const StringData &s) |
| (Re-)initializes this HostAndPort by parsing "s". More... | |
| bool | isLocalHost () const |
| Returns true if the hostname looks localhost-y. More... | |
| std::string | toString () const |
| Returns a string representation of "host:port". | |
| 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. | |
Static Public Member Functions | |
| static StatusWith< HostAndPort > MONGO_CLIENT_FUNC | parse (const StringData &text) |
| Parses "text" to produce a HostAndPort. More... | |
Name of a process on the network.
Composed of some name component, followed optionally by a colon and a numeric port. The name might be an IPv4 or IPv6 address or a relative or fully qualified host name, or an absolute path to a unix socket.
| mongo::HostAndPort::HostAndPort | ( | const std::string & | h, |
| int | p | ||
| ) |
Constructs a HostAndPort with the hostname "h" and port "p".
If "p" is -1, port() returns ServerGlobalParams::DefaultDBPort.
| Status mongo::HostAndPort::initialize | ( | const StringData & | s | ) |
(Re-)initializes this HostAndPort by parsing "s".
Returns Status::OK on success. The state of this HostAndPort is unspecified after initialize() returns a non-OK status, though it is safe to assign to it or re-initialize it.
| bool mongo::HostAndPort::isLocalHost | ( | ) | const |
Returns true if the hostname looks localhost-y.
TODO: Make a more rigorous implementation, perhaps elsewhere in the networking library.
|
static |
Parses "text" to produce a HostAndPort.
Returns either that or an error status describing the parse failure.
1.8.10