Browse Source

implement Url::to_string

CPP-GTK4
yggverse 5 months ago
parent
commit
d6be03febf
  1. 13
      src/lib/url.cpp
  2. 2
      src/lib/url.hpp

13
src/lib/url.cpp

@ -25,4 +25,17 @@ Url::Url( @@ -25,4 +25,17 @@ Url::Url(
query = results[5];
}
string Url::to_string()
{
string result;
if (!scheme.empty()) result += scheme + "://";
if (!host.empty()) result += host;
if (!port.empty()) result += ":" + port;
if (!path.empty()) result += "/" + path;
if (!query.empty()) result += "?" + query;
return result;
}
Url::~Url() = default;

2
src/lib/url.hpp

@ -20,6 +20,8 @@ namespace lib @@ -20,6 +20,8 @@ namespace lib
std::string subject
);
std::string to_string();
~Url();
};
}

Loading…
Cancel
Save