feat: get host, and update url

This commit is contained in:
Richard Ramos 2020-09-30 11:14:13 -04:00 committed by Michał
parent 956f51d38a
commit c6081720e7
2 changed files with 18 additions and 0 deletions

View File

@ -113,6 +113,10 @@ DOS_API char * DOS_CALL dos_image_resizer(char* imagePath, int maxSize, char* tm
DOS_API char * DOS_CALL dos_qurl_fromUserInput(char* input);
DOS_API char * DOS_CALL dos_qurl_host(char* host);
DOS_API char * DOS_CALL dos_qurl_replaceHostAndAddPath(char* url, char* newScheme, char* newHost, char* pathPrefix);
/// \brief Sets the application icon
DOS_API void DOS_CALL dos_qapplication_icon(const char *filename);

View File

@ -1153,3 +1153,17 @@ char *dos_qurl_fromUserInput(char* input)
{
return convert_to_cstring(QUrl::fromUserInput(QString(input)).toString());
}
char *dos_qurl_host(char* url)
{
return convert_to_cstring(QUrl(QString(url)).host());
}
char *dos_qurl_replaceHostAndAddPath(char* url, char* newScheme, char* newHost, char* pathPrefix)
{
auto newQurl = QUrl(QString(url));
newQurl.setScheme(newScheme);
newQurl.setHost(newHost);
newQurl.setPath(QString(pathPrefix) + newQurl.path());
return convert_to_cstring(newQurl.toString());
}