authority_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_AUTHORITY_RULE_HPP
  10. #define BOOST_URL_RFC_AUTHORITY_RULE_HPP
  11. #include <boost/url/detail/config.hpp>
  12. #include <boost/url/authority_view.hpp>
  13. #include <boost/url/error_types.hpp>
  14. namespace boost {
  15. namespace urls {
  16. /** Rule for authority
  17. @par Value Type
  18. @code
  19. using value_type = authority_view;
  20. @endcode
  21. @par Example
  22. Rules are used with the function @ref grammar::parse.
  23. @code
  24. system::result< authority_view > rv = grammar::parse( "user:pass@example.com:8080", authority_rule );
  25. @endcode
  26. @par BNF
  27. @code
  28. authority = [ userinfo "@" ] host [ ":" port ]
  29. @endcode
  30. @par Specification
  31. @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
  32. >3.2. Authority (rfc3986)</a>
  33. @see
  34. @ref authority_view,
  35. @ref grammar::parse,
  36. @ref parse_authority.
  37. */
  38. #ifdef BOOST_URL_DOCS
  39. constexpr __implementation_defined__ authority_rule;
  40. #else
  41. struct authority_rule_t
  42. {
  43. using value_type = authority_view;
  44. BOOST_URL_DECL
  45. auto
  46. parse(
  47. char const*& it,
  48. char const* end
  49. ) const noexcept ->
  50. system::result<value_type>;
  51. };
  52. constexpr authority_rule_t authority_rule{};
  53. #endif
  54. } // urls
  55. } // boost
  56. #endif