Few fixes in RsUrl

This commit is contained in:
Gioacchino Mazzurco 2018-03-02 20:08:50 +01:00
parent 518df99243
commit 8542abd4f0
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
2 changed files with 8 additions and 2 deletions

View File

@ -154,16 +154,21 @@ RsUrl& RsUrl::setHost(const std::string& host)
}
bool RsUrl::hasPort() const { return mHasPort; }
uint16_t RsUrl::port(uint16_t def) const
{
if(mHasPort) return mPort;
return def;
}
RsUrl& RsUrl::setPort(uint16_t port)
{
mPort = port;
mHasPort = true;
return *this;
}
RsUrl& RsUrl::unsetPort()
{
mPort = 0;
mHasPort = false;
return *this;
}

View File

@ -48,6 +48,7 @@ struct RsUrl
bool hasPort() const;
uint16_t port(uint16_t def = 0) const;
RsUrl& setPort(uint16_t port);
RsUrl& unsetPort();
const std::string& path() const;
RsUrl& setPath(const std::string& path);