all_chars.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // Copyright (c) 2021 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/url
  8. //
  9. #ifndef BOOST_URL_GRAMMAR_ALL_CHARS_HPP
  10. #define BOOST_URL_GRAMMAR_ALL_CHARS_HPP
  11. #include <boost/url/detail/config.hpp>
  12. #include <boost/url/grammar/detail/charset.hpp>
  13. namespace boost {
  14. namespace urls {
  15. namespace grammar {
  16. namespace implementation_defined
  17. {
  18. struct all_chars_t
  19. {
  20. constexpr
  21. all_chars_t() noexcept = default;
  22. constexpr
  23. bool
  24. operator()(char) const noexcept
  25. {
  26. return true;
  27. }
  28. #ifdef BOOST_URL_USE_SSE2
  29. char const*
  30. find_if(
  31. char const* first,
  32. char const* last) const noexcept
  33. {
  34. return detail::find_if_pred(
  35. *this, first, last);
  36. }
  37. char const*
  38. find_if_not(
  39. char const* first,
  40. char const* last) const noexcept
  41. {
  42. return detail::find_if_not_pred(
  43. *this, first, last);
  44. }
  45. #endif
  46. };
  47. } // implementation_defined
  48. /** The set of all characters
  49. @par Example
  50. Character sets are used with rules and the
  51. functions @ref find_if and @ref find_if_not.
  52. @code
  53. system::result< core::string_view > rv = parse( "JohnDoe", token_rule( all_chars ) );
  54. @endcode
  55. @par BNF
  56. @code
  57. ALL = %x00-FF
  58. @endcode
  59. @see
  60. @ref find_if,
  61. @ref find_if_not,
  62. @ref parse,
  63. @ref token_rule.
  64. */
  65. BOOST_INLINE_VARIABLE constexpr implementation_defined::all_chars_t all_chars{};
  66. } // grammar
  67. } // urls
  68. } // boost
  69. #endif