mirror of
https://github.com/enduro2d/enduro2d.git
synced 2026-02-04 23:39:21 +07:00
string format for url
This commit is contained in:
@@ -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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user