uri_reference_rule.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. namespace implementation_defined {
  17. struct uri_reference_rule_t
  18. {
  19. using value_type = url_view;
  20. BOOST_URL_DECL
  21. auto
  22. parse(
  23. char const*& it,
  24. char const* end
  25. ) const noexcept ->
  26. system::result<value_type>;
  27. };
  28. } // implementation_defined
  29. /** Rule for URI-reference
  30. @par Value Type
  31. @code
  32. using value_type = url_view;
  33. @endcode
  34. @par Example
  35. Rules are used with the function @ref grammar::parse.
  36. @code
  37. system::result< url_view > rv = grammar::parse( "ws://echo.example.com/?name=boost#demo", uri_reference_rule );
  38. @endcode
  39. @par BNF
  40. @code
  41. URI-reference = URI / relative-ref
  42. URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
  43. relative-ref = relative-part [ "?" query ] [ "#" fragment ]
  44. @endcode
  45. @par Specification
  46. @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
  47. >3. Syntax Components (rfc3986)</a>
  48. @see
  49. @ref grammar::parse,
  50. @ref parse_uri_reference,
  51. @ref url_view.
  52. */
  53. constexpr implementation_defined::uri_reference_rule_t uri_reference_rule{};
  54. } // urls
  55. } // boost
  56. #endif