mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix template-parameter name: Iterator, Range
This commit is contained in:
parent
ddccff51e6
commit
21cefe8a67
62 changed files with 809 additions and 784 deletions
|
@ -21,16 +21,16 @@ namespace sprout {
|
|||
public:
|
||||
typedef sprout::uuids::uuid result_type;
|
||||
private:
|
||||
template<typename Iterator>
|
||||
template<typename ForwardIterator>
|
||||
struct next_char {
|
||||
public:
|
||||
typedef typename std::iterator_traits<Iterator>::value_type char_type;
|
||||
typedef typename std::iterator_traits<ForwardIterator>::value_type char_type;
|
||||
public:
|
||||
char_type c;
|
||||
Iterator first;
|
||||
Iterator last;
|
||||
ForwardIterator first;
|
||||
ForwardIterator last;
|
||||
public:
|
||||
SPROUT_CONSTEXPR next_char(Iterator f, Iterator l)
|
||||
SPROUT_CONSTEXPR next_char(ForwardIterator f, ForwardIterator l)
|
||||
: c(f != l
|
||||
? *f
|
||||
: throw std::runtime_error("string_generator: invalid uuid string (out of range)")
|
||||
|
@ -98,22 +98,22 @@ namespace sprout {
|
|||
static SPROUT_CONSTEXPR bool is_close_brace(char32_t c, char open_brace) {
|
||||
return open_brace == U'{' && c == U'}';
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
template<typename ForwardIterator, typename Char, typename... Args>
|
||||
SPROUT_CONSTEXPR result_type
|
||||
generate_2_3(next_char<Iterator> nc, Char open_brace, bool has_dashes, std::uint8_t byte, Args... args) const {
|
||||
generate_2_3(next_char<ForwardIterator> nc, Char open_brace, bool has_dashes, std::uint8_t byte, Args... args) const {
|
||||
return generate_2(nc, open_brace, has_dashes, args..., static_cast<std::uint8_t>((byte << 4) | get_value(nc.c)));
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
template<typename ForwardIterator, typename Char, typename... Args>
|
||||
SPROUT_CONSTEXPR result_type
|
||||
generate_2_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
generate_2_2(next_char<ForwardIterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
return generate_2_3(nc.next(), open_brace, has_dashes, get_value(nc.c), args...);
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
template<typename ForwardIterator, typename Char, typename... Args>
|
||||
SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Args) == 6 || sizeof...(Args) == 8 || sizeof...(Args) == 10,
|
||||
result_type
|
||||
>::type
|
||||
generate_2_1(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
generate_2_1(next_char<ForwardIterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
return has_dashes
|
||||
? is_dash(nc.c)
|
||||
? generate_2_2(nc.next(), open_brace, has_dashes, args...)
|
||||
|
@ -121,64 +121,64 @@ namespace sprout {
|
|||
: generate_2_2(nc, open_brace, has_dashes, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
template<typename ForwardIterator, typename Char, typename... Args>
|
||||
SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Args) == 4,
|
||||
result_type
|
||||
>::type
|
||||
generate_2_1(next_char<Iterator> nc, Char open_brace, bool, Args... args) const {
|
||||
generate_2_1(next_char<ForwardIterator> nc, Char open_brace, bool, Args... args) const {
|
||||
return is_dash(nc.c)
|
||||
? generate_2_2(nc.next(), open_brace, true, args...)
|
||||
: generate_2_2(nc, open_brace, false, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
template<typename ForwardIterator, typename Char, typename... Args>
|
||||
SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Args) != 4 && sizeof...(Args) != 6 && sizeof...(Args) != 8 && sizeof...(Args) != 10,
|
||||
result_type
|
||||
>::type
|
||||
generate_2_1(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
generate_2_1(next_char<ForwardIterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
return generate_2_2(nc, open_brace, has_dashes, args...);
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
template<typename ForwardIterator, typename Char, typename... Args>
|
||||
SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Args) == 16,
|
||||
result_type
|
||||
>::type
|
||||
generate_2(next_char<Iterator> nc, Char open_brace, bool, Args... args) const {
|
||||
generate_2(next_char<ForwardIterator> nc, Char open_brace, bool, Args... args) const {
|
||||
return !open_brace || (open_brace && is_close_brace(nc.next().c, open_brace))
|
||||
? result_type{{args...}}
|
||||
: throw std::runtime_error("string_generator: invalid uuid string (brace not closed)")
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
template<typename ForwardIterator, typename Char, typename... Args>
|
||||
SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Args) == 0,
|
||||
result_type
|
||||
>::type
|
||||
generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
generate_2(next_char<ForwardIterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
return generate_2_2(nc, open_brace, has_dashes, args...);
|
||||
}
|
||||
template<typename Iterator, typename Char, typename... Args>
|
||||
template<typename ForwardIterator, typename Char, typename... Args>
|
||||
SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sizeof...(Args) != 0 && sizeof...(Args) != 16,
|
||||
result_type
|
||||
>::type
|
||||
generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
generate_2(next_char<ForwardIterator> nc, Char open_brace, bool has_dashes, Args... args) const {
|
||||
return generate_2_1(nc.next(), open_brace, has_dashes, args...);
|
||||
}
|
||||
template<typename Iterator>
|
||||
template<typename ForwardIterator>
|
||||
SPROUT_CONSTEXPR result_type
|
||||
generate_1(next_char<Iterator> nc) const {
|
||||
generate_1(next_char<ForwardIterator> nc) const {
|
||||
return is_open_brace(nc.c)
|
||||
? generate_2(nc.next(), nc.c, false)
|
||||
: generate_2(nc, typename next_char<Iterator>::char_type(), false)
|
||||
: generate_2(nc, typename next_char<ForwardIterator>::char_type(), false)
|
||||
;
|
||||
}
|
||||
public:
|
||||
template<typename Iterator>
|
||||
SPROUT_CONSTEXPR result_type operator()(Iterator first, Iterator last) const {
|
||||
return generate_1(next_char<Iterator>(first, last));
|
||||
template<typename ForwardIterator>
|
||||
SPROUT_CONSTEXPR result_type operator()(ForwardIterator first, ForwardIterator last) const {
|
||||
return generate_1(next_char<ForwardIterator>(first, last));
|
||||
}
|
||||
template<typename Elem, std::size_t N, typename Traits>
|
||||
SPROUT_CONSTEXPR result_type operator()(sprout::basic_string<Elem, N, Traits> const& s) const {
|
||||
|
@ -201,9 +201,9 @@ namespace sprout {
|
|||
//
|
||||
// make_uuid
|
||||
//
|
||||
template<typename Iterator>
|
||||
template<typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::uuids::uuid
|
||||
make_uuid(Iterator first, Iterator last) {
|
||||
make_uuid(ForwardIterator first, ForwardIterator last) {
|
||||
return sprout::uuids::string_generator()(first, last);
|
||||
}
|
||||
template<typename Elem, std::size_t N, typename Traits>
|
||||
|
|
|
@ -116,10 +116,10 @@ namespace sprout {
|
|||
return sprout::to_string(U"x500");
|
||||
}
|
||||
|
||||
template<typename Range>
|
||||
template<typename InputRange>
|
||||
inline SPROUT_CONSTEXPR sprout::uuids::md5_name_generator
|
||||
uuid3_impl(Range const& rng) {
|
||||
typedef typename std::decay<typename sprout::containers::value_type<Range>::type>::type value_type;
|
||||
uuid3_impl(InputRange const& rng) {
|
||||
typedef typename std::decay<typename sprout::containers::value_type<InputRange>::type>::type value_type;
|
||||
typedef sprout::ctypes::nocase_equal_to<value_type> predicate_type;
|
||||
return sprout::range::equal(rng, sprout::uuids::detail::dns_token<value_type>(), predicate_type()) ? sprout::uuids::make_uuid3_dns()
|
||||
: sprout::range::equal(rng, sprout::uuids::detail::url_token<value_type>(), predicate_type()) ? sprout::uuids::make_uuid3_url()
|
||||
|
@ -129,10 +129,10 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
|
||||
template<typename Range>
|
||||
template<typename InputRange>
|
||||
inline SPROUT_CONSTEXPR sprout::uuids::sha1_name_generator
|
||||
uuid5_impl(Range const& rng) {
|
||||
typedef typename std::decay<typename sprout::containers::value_type<Range>::type>::type value_type;
|
||||
uuid5_impl(InputRange const& rng) {
|
||||
typedef typename std::decay<typename sprout::containers::value_type<InputRange>::type>::type value_type;
|
||||
typedef sprout::ctypes::nocase_equal_to<value_type> predicate_type;
|
||||
return sprout::range::equal(rng, sprout::uuids::detail::dns_token<value_type>(), predicate_type()) ? sprout::uuids::make_uuid5_dns()
|
||||
: sprout::range::equal(rng, sprout::uuids::detail::url_token<value_type>(), predicate_type()) ? sprout::uuids::make_uuid5_url()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue