summaryrefslogtreecommitdiff
path: root/src/mongo/util/net/hostandport.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/util/net/hostandport.h')
-rw-r--r--src/mongo/util/net/hostandport.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mongo/util/net/hostandport.h b/src/mongo/util/net/hostandport.h
index 96c926e8e47..3cc139a9476 100644
--- a/src/mongo/util/net/hostandport.h
+++ b/src/mongo/util/net/hostandport.h
@@ -43,8 +43,8 @@ namespace mongo {
struct HostAndPort {
HostAndPort() : _port(-1) { }
- /** From a string hostname[:portnumber]
- Throws user assertion if bad config string or bad port #.
+ /** From a std::string hostname[:portnumber]
+ Throws user assertion if bad config std::string or bad port #.
*/
HostAndPort(const std::string& s);
@@ -78,16 +78,16 @@ namespace mongo {
/**
* @param includePort host:port if true, host otherwise
*/
- string toString( bool includePort=true ) const;
+ std::string toString( bool includePort=true ) const;
- operator string() const { return toString(); }
+ operator std::string() const { return toString(); }
void append( StringBuilder& ss ) const;
bool empty() const {
return _host.empty() && _port < 0;
}
- const string& host() const {
+ const std::string& host() const {
return _host;
}
int port() const {
@@ -104,21 +104,21 @@ namespace mongo {
private:
void init(const char *);
- string _host;
+ std::string _host;
int _port; // -1 indicates unspecified
};
inline HostAndPort HostAndPort::me() {
const char* ips = serverGlobalParams.bind_ip.c_str();
while(*ips) {
- string ip;
+ std::string ip;
const char * comma = strchr(ips, ',');
if (comma) {
- ip = string(ips, comma - ips);
+ ip = std::string(ips, comma - ips);
ips = comma + 1;
}
else {
- ip = string(ips);
+ ip = std::string(ips);
ips = "";
}
HostAndPort h = HostAndPort(ip, serverGlobalParams.port);
@@ -127,13 +127,13 @@ namespace mongo {
}
}
- string h = getHostName();
+ std::string h = getHostName();
verify( !h.empty() );
verify( h != "localhost" );
return HostAndPort(h, serverGlobalParams.port);
}
- inline string HostAndPort::toString( bool includePort ) const {
+ inline std::string HostAndPort::toString( bool includePort ) const {
if ( ! includePort )
return host();
@@ -165,7 +165,7 @@ namespace mongo {
inline bool HostAndPort::isLocalHost() const {
- string _host = host();
+ std::string _host = host();
return ( _host == "localhost"
|| mongoutils::str::startsWith(_host.c_str(), "127.")
|| _host == "::1"
@@ -180,7 +180,7 @@ namespace mongo {
if( colon ) {
int port = atoi(colon+1);
massert(13095, "HostAndPort: bad port #", port > 0);
- _host = string(p,colon-p);
+ _host = std::string(p,colon-p);
_port = port;
}
else {