added comparison operators to Address and Login classes
This commit is contained in:
parent
6f6c98f453
commit
af6886be92
|
|
@ -186,6 +186,37 @@ public:
|
||||||
// done
|
// done
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparison operator
|
||||||
|
* @param that
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool operator==(const Address &that) const
|
||||||
|
{
|
||||||
|
// logins must match
|
||||||
|
if (_login != that._login) return false;
|
||||||
|
|
||||||
|
// hostname must match, but are nt case sensitive
|
||||||
|
if (strcasecmp(_hostname.data(), that._hostname.data()) != 0) return false;
|
||||||
|
|
||||||
|
// portnumber must match
|
||||||
|
if (_port != that._port) return false;
|
||||||
|
|
||||||
|
// and finally the vhosts, they must match too
|
||||||
|
return _vhost == that._vhost;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparison operator
|
||||||
|
* @param that
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool operator!=(const Address &that) const
|
||||||
|
{
|
||||||
|
// the opposite of operator==
|
||||||
|
return !operator==(that);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,29 @@ public:
|
||||||
// append other elements
|
// append other elements
|
||||||
return result.append(_user).append("\0",1).append(_password);
|
return result.append(_user).append("\0",1).append(_password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparison operator
|
||||||
|
* @param that
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool operator==(const Login &that) const
|
||||||
|
{
|
||||||
|
// username and password must match
|
||||||
|
return _user == that._user && _password == that._password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparison operator
|
||||||
|
* @param that
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool operator!=(const Login &that) const
|
||||||
|
{
|
||||||
|
// the opposite of operator==
|
||||||
|
return !operator==(that);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue