MongoDB  2.6.0
Public Member Functions | Static Public Member Functions | List of all members
mongo::HostAndPort Struct Reference

helper for manipulating host:port connection endpoints. More...

#include <hostandport.h>

Public Member Functions

 HostAndPort (const std::string &s)
 From a string hostname[:portnumber] Throws user assertion if bad config string or bad port #.
 
 HostAndPort (const std::string &h, int p)
 
 HostAndPort (const SockAddr &sock)
 
bool operator< (const HostAndPort &r) const
 
bool operator== (const HostAndPort &r) const
 
bool operator!= (const HostAndPort &r) const
 
bool isSelf () const
 
bool isLocalHost () const
 
string toString (bool includePort=true) const
 
 operator string () const
 
void append (StringBuilder &ss) const
 
bool empty () const
 
const string & host () const
 
int port () const
 
bool hasPort () const
 
void setPort (int port)
 

Static Public Member Functions

static HostAndPort me ()
 

Detailed Description

helper for manipulating host:port connection endpoints.

Constructor & Destructor Documentation

mongo::HostAndPort::HostAndPort ( const std::string &  h,
int  p 
)
inline
Parameters
pport number. -1 is ok to use default.

Member Function Documentation

string mongo::HostAndPort::toString ( bool  includePort = true) const
inline
Parameters
includePorthost:port if true, host otherwise

The documentation for this struct was generated from the following file: