123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- #ifndef BOOST_URL_GRAMMAR_HEXDIG_CHARS_HPP
- #define BOOST_URL_GRAMMAR_HEXDIG_CHARS_HPP
- #include <boost/url/detail/config.hpp>
- #include <boost/url/grammar/detail/charset.hpp>
- namespace boost {
- namespace urls {
- namespace grammar {
- #ifdef BOOST_URL_DOCS
- constexpr __implementation_defined__ hexdig_chars;
- #else
- struct hexdig_chars_t
- {
-
- constexpr
- bool
- operator()(char c) const noexcept
- {
- return
- (c >= '0' && c <= '9') ||
- (c >= 'A' && c <= 'F') ||
- (c >= 'a' && c <= 'f');
- }
- #ifdef BOOST_URL_USE_SSE2
- char const*
- find_if(
- char const* first,
- char const* last) const noexcept
- {
- return detail::find_if_pred(
- *this, first, last);
- }
- char const*
- find_if_not(
- char const* first,
- char const* last) const noexcept
- {
- return detail::find_if_not_pred(
- *this, first, last);
- }
- #endif
- };
- constexpr hexdig_chars_t hexdig_chars{};
- #endif
- inline
- signed char
- hexdig_value(char ch) noexcept
- {
-
-
-
- signed char res;
- switch(ch)
- {
- default: res = -1; break;
- case '0': res = 0; break;
- case '1': res = 1; break;
- case '2': res = 2; break;
- case '3': res = 3; break;
- case '4': res = 4; break;
- case '5': res = 5; break;
- case '6': res = 6; break;
- case '7': res = 7; break;
- case '8': res = 8; break;
- case '9': res = 9; break;
- case 'a': case 'A': res = 10; break;
- case 'b': case 'B': res = 11; break;
- case 'c': case 'C': res = 12; break;
- case 'd': case 'D': res = 13; break;
- case 'e': case 'E': res = 14; break;
- case 'f': case 'F': res = 15; break;
- }
- return res;
- }
- }
- }
- }
- #endif
|