Added HTTP::URL::getExt function
This commit is contained in:
parent
d7c021106f
commit
61d116e2f3
2 changed files with 9 additions and 0 deletions
|
@ -158,6 +158,14 @@ uint32_t HTTP::URL::getDefaultPort() const{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the file extension of the URL, or an empty string if none.
|
||||||
|
std::string HTTP::URL::getExt() const{
|
||||||
|
if (path.rfind('.') == std::string::npos){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return path.substr(path.rfind('.')+1);
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the full URL in string format
|
/// Returns the full URL in string format
|
||||||
std::string HTTP::URL::getUrl() const{
|
std::string HTTP::URL::getUrl() const{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace HTTP{
|
||||||
URL(const std::string &url = "");
|
URL(const std::string &url = "");
|
||||||
uint32_t getPort() const;
|
uint32_t getPort() const;
|
||||||
uint32_t getDefaultPort() const;
|
uint32_t getDefaultPort() const;
|
||||||
|
std::string getExt() const;
|
||||||
std::string getUrl() const;
|
std::string getUrl() const;
|
||||||
std::string getFilePath() const;
|
std::string getFilePath() const;
|
||||||
std::string getBareUrl() const;
|
std::string getBareUrl() const;
|
||||||
|
|
Loading…
Add table
Reference in a new issue