RsUrl add method to test presence and get fields from query

This commit is contained in:
Gioacchino Mazzurco 2019-04-27 23:48:15 +02:00
parent b1aa1fc26f
commit d113f60ca1
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
2 changed files with 9 additions and 0 deletions

View File

@ -201,6 +201,13 @@ RsUrl& RsUrl::delQueryK(const std::string& key)
mQuery.erase(key);
return *this;
}
bool RsUrl::hasQueryK(const std::string& key)
{ return (mQuery.find(key) != mQuery.end()); }
const std::string* RsUrl::getQueryV(const std::string& key)
{
if(hasQueryK(key)) return &(mQuery.find(key)->second);
return nullptr;
}
const std::string& RsUrl::fragment() const { return mFragment; }
RsUrl& RsUrl::setFragment(const std::string& fragment)

View File

@ -59,6 +59,8 @@ struct RsUrl : RsSerializable
RsUrl& setQuery(const std::map<std::string, std::string>& query);
RsUrl& setQueryKV(const std::string& key, const std::string& value);
RsUrl& delQueryK(const std::string& key);
bool hasQueryK(const std::string& key);
const std::string* getQueryV(const std::string& key);
const std::string& fragment() const;
RsUrl& setFragment(const std::string& fragment);