string format for url

This commit is contained in:
2018-10-11 01:05:25 +07:00
parent ac675a8336
commit 5c6b7406db

View File

@@ -8,6 +8,7 @@
#include "_utils.hpp"
#include "url.hpp"
#include "color.hpp"
#include "color32.hpp"
#include "strings.hpp"
@@ -334,6 +335,26 @@ namespace e2d { namespace strings
}
};
//
// url
//
template <>
class format_arg<url> {
url value_;
public:
template < typename U >
explicit format_arg(U&& value)
noexcept(noexcept(std::is_nothrow_constructible<url, U>::value))
: value_(std::forward<U>(value)) {}
std::ptrdiff_t write(char* dst, size_t size) const {
return math::numeric_cast<std::ptrdiff_t>(
format(dst, size, "%0://%1",
value_.scheme(), value_.path()));
}
};
//
// str
//