1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-27 02:20:05 +00:00

Added method URL::withNewDomainAndPath()

This commit is contained in:
jules 2016-07-07 15:53:01 +01:00
parent c6249d2214
commit 0df194d33e
2 changed files with 17 additions and 1 deletions

View file

@ -222,6 +222,13 @@ int URL::getPort() const
return colonPos > 0 ? url.substring (colonPos + 1).getIntValue() : 0;
}
URL URL::withNewDomainAndPath (const String& newURL) const
{
URL u (*this);
u.url = newURL;
return u;
}
URL URL::withNewSubPath (const String& newPath) const
{
const int startOfPath = URLHelpers::findStartOfPath (url);

View file

@ -106,10 +106,19 @@ public:
*/
int getPort() const;
/** Returns a new version of this URL that uses a different sub-path.
/** Returns a new version of this URL with a different domain and path.
E.g. if the URL is "http://www.xyz.com/foo?x=1" and you call this with
"abc.com/zzz", it'll return "http://abc.com/zzz?x=1".
@see withNewSubPath
*/
URL withNewDomainAndPath (const String& newFullPath) const;
/** Returns a new version of this URL with a different sub-path.
E.g. if the URL is "http://www.xyz.com/foo?x=1" and you call this with
"bar", it'll return "http://www.xyz.com/bar?x=1".
@see withNewDomainAndPath
*/
URL withNewSubPath (const String& newPath) const;