pattern.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.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_DETAIL_PATTERN_HPP
  10. #define BOOST_URL_DETAIL_PATTERN_HPP
  11. #include <boost/url/error_types.hpp>
  12. #include <boost/url/url_base.hpp>
  13. #include <boost/core/detail/string_view.hpp>
  14. // This file includes functions and classes
  15. // to parse uri templates or format strings
  16. namespace boost {
  17. namespace urls {
  18. namespace detail {
  19. class format_args;
  20. struct pattern
  21. {
  22. core::string_view scheme;
  23. core::string_view user;
  24. core::string_view pass;
  25. core::string_view host;
  26. core::string_view port;
  27. core::string_view path;
  28. core::string_view query;
  29. core::string_view frag;
  30. bool has_authority = false;
  31. bool has_user = false;
  32. bool has_pass = false;
  33. bool has_port = false;
  34. bool has_query = false;
  35. bool has_frag = false;
  36. BOOST_URL_DECL
  37. void
  38. apply(
  39. url_base& u,
  40. format_args const& args) const;
  41. };
  42. BOOST_URL_DECL
  43. system::result<pattern>
  44. parse_pattern(
  45. core::string_view s);
  46. } // detail
  47. } // url
  48. } // boost
  49. #endif