hier_part_rule.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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_DETAIL_HIER_PART_RULE_HPP
  10. #define BOOST_URL_RFC_DETAIL_HIER_PART_RULE_HPP
  11. #include <boost/url/detail/config.hpp>
  12. #include <boost/url/pct_string_view.hpp>
  13. #include <boost/url/rfc/authority_rule.hpp>
  14. #include <cstdlib>
  15. namespace boost {
  16. namespace urls {
  17. namespace detail {
  18. /** Rule for hier-part
  19. @par BNF
  20. @code
  21. hier-part = "//" authority path-abempty
  22. / path-absolute
  23. / path-rootless
  24. / path-empty
  25. @endcode
  26. @par Specification
  27. @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
  28. >3. Syntax Components (rfc3986)</a>
  29. */
  30. struct hier_part_rule_t
  31. {
  32. struct value_type
  33. {
  34. authority_view authority;
  35. pct_string_view path;
  36. std::size_t segment_count = 0;
  37. bool has_authority = false;
  38. };
  39. BOOST_URL_DECL
  40. auto
  41. parse(
  42. char const*& it,
  43. char const* const end
  44. ) const noexcept ->
  45. system::result<value_type>;
  46. };
  47. constexpr hier_part_rule_t hier_part_rule{};
  48. } // detail
  49. } // urls
  50. } // boost
  51. #endif