1  
//
1  
//
2  
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
2  
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
3  
// Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
3  
// Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
4  
//
4  
//
5  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
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)
6  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  
//
7  
//
8  
// Official repository: https://github.com/boostorg/url
8  
// Official repository: https://github.com/boostorg/url
9  
//
9  
//
10  

10  

11  
#ifndef BOOST_URL_IMPL_PARSE_HPP
11  
#ifndef BOOST_URL_IMPL_PARSE_HPP
12  
#define BOOST_URL_IMPL_PARSE_HPP
12  
#define BOOST_URL_IMPL_PARSE_HPP
13  

13  

14  
#include <boost/url/detail/config.hpp>
14  
#include <boost/url/detail/config.hpp>
15  
#include <boost/url/rfc/absolute_uri_rule.hpp>
15  
#include <boost/url/rfc/absolute_uri_rule.hpp>
16  
#include <boost/url/rfc/relative_ref_rule.hpp>
16  
#include <boost/url/rfc/relative_ref_rule.hpp>
17  
#include <boost/url/rfc/uri_rule.hpp>
17  
#include <boost/url/rfc/uri_rule.hpp>
18  
#include <boost/url/rfc/uri_reference_rule.hpp>
18  
#include <boost/url/rfc/uri_reference_rule.hpp>
19  
#include <boost/url/rfc/origin_form_rule.hpp>
19  
#include <boost/url/rfc/origin_form_rule.hpp>
20  

20  

21  
namespace boost {
21  
namespace boost {
22  
namespace urls {
22  
namespace urls {
23  

23  

24  
//------------------------------------------------
24  
//------------------------------------------------
25  
//
25  
//
26  
// parse functions
26  
// parse functions
27  
//
27  
//
28  
//------------------------------------------------
28  
//------------------------------------------------
29  

29  

30  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
30  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
31  
system::result<url_view>
31  
system::result<url_view>
32  
parse_absolute_uri(
32  
parse_absolute_uri(
33  
    core::string_view s)
33  
    core::string_view s)
34  
{
34  
{
35  
    return grammar::parse(
35  
    return grammar::parse(
36  
        s, absolute_uri_rule);
36  
        s, absolute_uri_rule);
37  
}
37  
}
38  

38  

39  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
39  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
40  
system::result<url_view>
40  
system::result<url_view>
41  
parse_origin_form(
41  
parse_origin_form(
42  
    core::string_view s)
42  
    core::string_view s)
43  
{
43  
{
44  
    return grammar::parse(
44  
    return grammar::parse(
45  
        s, origin_form_rule);
45  
        s, origin_form_rule);
46  
}
46  
}
47  

47  

48  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
48  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
49  
system::result<url_view>
49  
system::result<url_view>
50  
parse_relative_ref(
50  
parse_relative_ref(
51  
    core::string_view s)
51  
    core::string_view s)
52  
{
52  
{
53  
    return grammar::parse(
53  
    return grammar::parse(
54  
        s, relative_ref_rule);
54  
        s, relative_ref_rule);
55  
}
55  
}
56  

56  

57  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
57  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
58  
system::result<url_view>
58  
system::result<url_view>
59  
parse_uri(
59  
parse_uri(
60  
    core::string_view s)
60  
    core::string_view s)
61  
{
61  
{
62  
    return grammar::parse(
62  
    return grammar::parse(
63  
        s, uri_rule);
63  
        s, uri_rule);
64  
}
64  
}
65  

65  

66  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
66  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
67  
system::result<url_view>
67  
system::result<url_view>
68  
parse_uri_reference(
68  
parse_uri_reference(
69  
    core::string_view s)
69  
    core::string_view s)
70  
{
70  
{
71  
    return grammar::parse(
71  
    return grammar::parse(
72  
        s, uri_reference_rule);
72  
        s, uri_reference_rule);
73  
}
73  
}
74  

74  

75  
} // urls
75  
} // urls
76  
} // boost
76  
} // boost
77  

77  

78  
#endif
78  
#endif