uri_rule.hpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // Copyright (c) 2016-2019 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_RFC_URI_RULE_HPP
  10. #define BOOST_URL_RFC_URI_RULE_HPP
  11. #include <boost/url/detail/config.hpp>
  12. #include <boost/url/error_types.hpp>
  13. #include <boost/url/url_view.hpp>
  14. namespace boost {
  15. namespace urls {
  16. /** Rule for URI
  17. @par Value Type
  18. @code
  19. using value_type = url_view;
  20. @endcode
  21. @par Example
  22. Rules are used with the function @ref grammar::parse.
  23. @code
  24. system::result< url_view > rv = grammar::parse( "https://www.example.com/index.htm?id=guest#s1", uri_rule );
  25. @endcode
  26. @par BNF
  27. @code
  28. URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
  29. @endcode
  30. @par Specification
  31. @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
  32. >3. Syntax Components (rfc3986)</a>
  33. @see
  34. @ref grammar::parse,
  35. @ref parse_uri,
  36. @ref url_view.
  37. */
  38. #ifdef BOOST_URL_DOCS
  39. constexpr __implementation_defined__ uri_rule{};
  40. #else
  41. struct uri_rule_t
  42. {
  43. using value_type = url_view;
  44. BOOST_URL_DECL
  45. auto
  46. parse(
  47. char const*& it,
  48. char const* const end
  49. ) const noexcept ->
  50. system::result<value_type>;
  51. };
  52. constexpr uri_rule_t uri_rule{};
  53. #endif
  54. } // urls
  55. } // boost
  56. #endif