uri_reference_rule.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_REFERENCE_RULE_HPP
  10. #define BOOST_URL_RFC_URI_REFERENCE_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-reference
  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( "ws://echo.example.com/?name=boost#demo", uri_reference_rule );
  25. @endcode
  26. @par BNF
  27. @code
  28. URI-reference = URI / relative-ref
  29. URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
  30. relative-ref = relative-part [ "?" query ] [ "#" fragment ]
  31. @endcode
  32. @par Specification
  33. @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
  34. >3. Syntax Components (rfc3986)</a>
  35. @see
  36. @ref grammar::parse,
  37. @ref parse_uri_reference,
  38. @ref url_view.
  39. */
  40. #ifdef BOOST_URL_DOCS
  41. constexpr __implementation_defined__ uri_reference_rule{};
  42. #else
  43. struct uri_reference_rule_t
  44. {
  45. using value_type = url_view;
  46. BOOST_URL_DECL
  47. auto
  48. parse(
  49. char const*& it,
  50. char const* end
  51. ) const noexcept ->
  52. system::result<value_type>;
  53. };
  54. constexpr uri_reference_rule_t uri_reference_rule{};
  55. #endif
  56. } // urls
  57. } // boost
  58. #endif