parse_path.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
  3. // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // Official repository: https://github.com/boostorg/url
  9. //
  10. #ifndef BOOST_URL_PARSE_PATH_HPP
  11. #define BOOST_URL_PARSE_PATH_HPP
  12. #include <boost/url/detail/config.hpp>
  13. #include <boost/url/error_types.hpp>
  14. #include <boost/url/segments_encoded_view.hpp>
  15. namespace boost {
  16. namespace urls {
  17. /** Parse a string and return an encoded segment view
  18. This function parses the string and returns the
  19. corresponding path object if the string is valid,
  20. otherwise returns an error.
  21. @par BNF
  22. @code
  23. path = [ "/" ] segment *( "/" segment )
  24. @endcode
  25. @par Exception Safety
  26. No-throw guarantee.
  27. @return A valid view on success, otherwise an
  28. error code.
  29. @param s The string to parse
  30. @par Specification
  31. @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3"
  32. >3.3. Path (rfc3986)</a>
  33. @see
  34. @ref segments_encoded_view.
  35. */
  36. BOOST_URL_DECL
  37. system::result<segments_encoded_view>
  38. parse_path(core::string_view s) noexcept;
  39. } // urls
  40. } // boost
  41. #endif