mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-08 16:37:51 +00:00
Added thirdparty: boost library
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_ABSOLUTE_URI_RULE_HPP
|
||||
#define BOOST_URL_RFC_ABSOLUTE_URI_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/url_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for absolute-URI
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = url_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< url_view > rv = grammar::parse( "http://example.com/index.htm?id=1", absolute_uri_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
absolute-URI = scheme ":" hier-part [ "?" query ]
|
||||
|
||||
hier-part = "//" authority path-abempty
|
||||
/ path-absolute
|
||||
/ path-rootless
|
||||
/ path-empty
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.3"
|
||||
>4.3. Absolute URI (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::parse,
|
||||
@ref parse_absolute_uri,
|
||||
@ref url_view.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ absolute_uri_rule;
|
||||
#else
|
||||
struct absolute_uri_rule_t
|
||||
{
|
||||
using value_type = url_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr absolute_uri_rule_t absolute_uri_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_AUTHORITY_RULE_HPP
|
||||
#define BOOST_URL_RFC_AUTHORITY_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/authority_view.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for authority
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = authority_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< authority_view > rv = grammar::parse( "user:pass@example.com:8080", authority_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
authority = [ userinfo "@" ] host [ ":" port ]
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2"
|
||||
>3.2. Authority (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref authority_view,
|
||||
@ref grammar::parse,
|
||||
@ref parse_authority.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ authority_rule;
|
||||
#else
|
||||
struct authority_rule_t
|
||||
{
|
||||
using value_type = authority_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr authority_rule_t authority_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Copyright (c) 2022 alandefreitas (alandefreitas@gmail.com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_CHARSETS_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_CHARSETS_HPP
|
||||
|
||||
#include <boost/url/rfc/pchars.hpp>
|
||||
#include <boost/url/rfc/sub_delim_chars.hpp>
|
||||
#include <boost/url/rfc/unreserved_chars.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
constexpr
|
||||
auto
|
||||
user_chars =
|
||||
unreserved_chars + sub_delim_chars;
|
||||
|
||||
constexpr
|
||||
auto
|
||||
password_chars =
|
||||
unreserved_chars + sub_delim_chars + ':';
|
||||
|
||||
constexpr
|
||||
auto
|
||||
userinfo_chars =
|
||||
password_chars;
|
||||
|
||||
constexpr
|
||||
auto
|
||||
host_chars =
|
||||
unreserved_chars + sub_delim_chars;
|
||||
|
||||
constexpr
|
||||
auto
|
||||
reg_name_chars =
|
||||
unreserved_chars + '-' + '.';
|
||||
|
||||
constexpr
|
||||
auto
|
||||
segment_chars =
|
||||
pchars;
|
||||
|
||||
constexpr
|
||||
auto
|
||||
path_chars =
|
||||
segment_chars + '/';
|
||||
|
||||
constexpr
|
||||
auto
|
||||
query_chars =
|
||||
pchars + '/' + '?';
|
||||
|
||||
constexpr
|
||||
auto
|
||||
param_key_chars = pchars
|
||||
+ '/' + '?' + '[' + ']'
|
||||
- '&' - '=';
|
||||
|
||||
constexpr
|
||||
auto
|
||||
param_value_chars = pchars
|
||||
+ '/' + '?'
|
||||
- '&';
|
||||
|
||||
constexpr
|
||||
auto
|
||||
fragment_chars =
|
||||
pchars + '/' + '?' + '#';
|
||||
|
||||
constexpr
|
||||
auto
|
||||
nocolon_pchars =
|
||||
pchars - ':';
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_FRAGMENT_PART_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_FRAGMENT_PART_RULE_HPP
|
||||
|
||||
#include <boost/url/rfc/pct_encoded_rule.hpp>
|
||||
#include <boost/url/rfc/detail/charsets.hpp>
|
||||
#include <boost/url/grammar/parse.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for fragment-part
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
fragment-part = [ "#" fragment ]
|
||||
|
||||
fragment = *( pchar / "/" / "?" )
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.5"
|
||||
>3.5. Fragment (rfc3986)</a>
|
||||
*/
|
||||
struct fragment_part_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
pct_string_view fragment;
|
||||
bool has_fragment = false;
|
||||
};
|
||||
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept
|
||||
{
|
||||
if( it == end ||
|
||||
*it != '#')
|
||||
return {};
|
||||
++it;
|
||||
auto rv = grammar::parse(
|
||||
it, end, pct_encoded_rule(
|
||||
fragment_chars));
|
||||
if(! rv)
|
||||
return rv.error();
|
||||
value_type t;
|
||||
t.fragment = *rv;
|
||||
t.has_fragment = true;
|
||||
return t;
|
||||
}
|
||||
};
|
||||
constexpr fragment_part_rule_t fragment_part_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_H16_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_H16_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for h16
|
||||
|
||||
This parses a sixteen bit unsigned
|
||||
hexadecimal number.
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
h16 = 1*4HEXDIG
|
||||
; 16 bits of address represented in hexadecimal
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
*/
|
||||
struct h16_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
std::uint8_t hi;
|
||||
std::uint8_t lo;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr h16_rule_t h16_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_HIER_PART_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_HIER_PART_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
#include <boost/url/rfc/authority_rule.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for hier-part
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
hier-part = "//" authority path-abempty
|
||||
/ path-absolute
|
||||
/ path-rootless
|
||||
/ path-empty
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
|
||||
>3. Syntax Components (rfc3986)</a>
|
||||
*/
|
||||
struct hier_part_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
authority_view authority;
|
||||
pct_string_view path;
|
||||
std::size_t segment_count = 0;
|
||||
bool has_authority = false;
|
||||
};
|
||||
|
||||
BOOST_URL_DECL
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* const end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr hier_part_rule_t hier_part_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_HOST_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_HOST_RULE_HPP
|
||||
|
||||
#include <boost/url/host_type.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
#include <boost/url/ipv4_address.hpp>
|
||||
#include <boost/url/ipv6_address.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for host
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
host = IP-literal / IPv4address / reg-name
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref host_type,
|
||||
@ref ipv4_address,
|
||||
@ref ipv6_address.
|
||||
*/
|
||||
struct host_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
urls::host_type host_type =
|
||||
urls::host_type::none;
|
||||
core::string_view match;
|
||||
unsigned char addr[16] = {};
|
||||
pct_string_view name;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr host_rule_t host_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
// Copyright (c) 2022 Alan de Freitas (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_IP_LITERAL_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_IP_LITERAL_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/ipv6_address.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for IP-literal
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref ipv6_address.
|
||||
*/
|
||||
struct ip_literal_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
bool is_ipv6 = false;
|
||||
ipv6_address ipv6;
|
||||
core::string_view ipvfuture;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr ip_literal_rule_t ip_literal_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_IPV6ADDRZ_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_IPV6ADDRZ_RULE_HPP
|
||||
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/ipv6_address.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for IPvFuture
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
IPv6addrz = IPv6address "%25" ZoneID
|
||||
ZoneID = 1*( unreserved / pct-encoded )
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
*/
|
||||
struct ipv6_addrz_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
ipv6_address ipv6;
|
||||
pct_string_view zone_id;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* const end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr ipv6_addrz_rule_t ipv6_addrz_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_IPVFUTURE_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_IPVFUTURE_RULE_HPP
|
||||
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for IPvFuture
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
*/
|
||||
struct ipvfuture_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
core::string_view str;
|
||||
core::string_view major;
|
||||
core::string_view minor;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* const end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr ipvfuture_rule_t ipvfuture_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_PATH_RULES_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_PATH_RULES_HPP
|
||||
|
||||
#include <boost/url/rfc/pchars.hpp>
|
||||
#include <boost/url/rfc/pct_encoded_rule.hpp>
|
||||
#include <boost/url/grammar/delim_rule.hpp>
|
||||
#include <boost/url/grammar/range_rule.hpp>
|
||||
#include <boost/url/grammar/tuple_rule.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for segment
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
segment = *pchar
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3"
|
||||
>3.3. Path (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::parse.
|
||||
*/
|
||||
constexpr auto segment_rule =
|
||||
pct_encoded_rule(pchars);
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_PORT_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_PORT_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for port
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
port = *DIGIT
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref port_part_rule.
|
||||
*/
|
||||
struct port_rule
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
core::string_view str;
|
||||
std::uint16_t number = 0;
|
||||
bool has_number = false;
|
||||
};
|
||||
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept;
|
||||
};
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
/** Rule for port-part
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
port-part = [ ":" port ]
|
||||
|
||||
port = *DIGIT
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref port_rule.
|
||||
*/
|
||||
struct port_part_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
bool has_port = false;
|
||||
core::string_view port;
|
||||
bool has_number = false;
|
||||
std::uint16_t port_number = 0;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr port_part_rule_t port_part_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_QUERY_PART_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_QUERY_PART_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
#include <boost/url/rfc/query_rule.hpp>
|
||||
#include <boost/url/grammar/parse.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for query-part
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
query-part = [ "?" query ]
|
||||
@endcode
|
||||
*/
|
||||
struct query_part_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
pct_string_view query;
|
||||
std::size_t count = 0;
|
||||
bool has_query = false;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>
|
||||
{
|
||||
if( it == end ||
|
||||
*it != '?')
|
||||
return {};
|
||||
++it;
|
||||
auto rv = grammar::parse(
|
||||
it, end, query_rule);
|
||||
if(! rv)
|
||||
return rv.error();
|
||||
value_type t;
|
||||
t.query = rv->buffer();
|
||||
t.count = rv->size();
|
||||
t.has_query = true;
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
constexpr query_part_rule_t query_part_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_REG_NAME_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_REG_NAME_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/rfc/pct_encoded_rule.hpp>
|
||||
#include <boost/url/rfc/sub_delim_chars.hpp>
|
||||
#include <boost/url/rfc/unreserved_chars.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/* VFALCO In theory we could enforce these
|
||||
additional requirements from errata 4942:
|
||||
|
||||
Such a name consists of a sequence of domain
|
||||
labels separated by ".", each domain label
|
||||
starting and ending with an alphanumeric character
|
||||
and possibly also containing "-" characters. The
|
||||
rightmost domain label of a fully qualified domain
|
||||
name in DNS may be followed by a single "." and
|
||||
should be if it is necessary to distinguish between
|
||||
the complete domain name and some local domain.
|
||||
*/
|
||||
|
||||
/** Rule for reg-name
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
reg-name = *( unreserved / pct-encoded / "-" / ".")
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
@li <a href="https://www.rfc-editor.org/errata/eid4942"
|
||||
>Errata ID: 4942</a>
|
||||
*/
|
||||
constexpr auto reg_name_rule =
|
||||
pct_encoded_rule(unreserved_chars + sub_delim_chars);
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_RELATIVE_PART_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_RELATIVE_PART_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
#include <boost/url/rfc/authority_rule.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for relative-part
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
relative-part = "//" authority path-abempty
|
||||
/ path-absolute
|
||||
/ path-noscheme
|
||||
/ path-abempty
|
||||
/ path-empty
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.2"
|
||||
>4.2. Relative Reference (rfc3986)</a>
|
||||
@li <a href="https://www.rfc-editor.org/errata/eid5428"
|
||||
>Errata ID: 5428 (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref authority_rule.
|
||||
*/
|
||||
struct relative_part_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
authority_view authority;
|
||||
pct_string_view path;
|
||||
std::size_t segment_count = 0;
|
||||
bool has_authority = false;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr relative_part_rule_t relative_part_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_SCHEME_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_SCHEME_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/scheme.hpp>
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for scheme
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1"
|
||||
>3.1. Scheme (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref scheme.
|
||||
*/
|
||||
struct scheme_rule
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
core::string_view scheme;
|
||||
urls::scheme scheme_id =
|
||||
urls::scheme::unknown;
|
||||
};
|
||||
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept;
|
||||
};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_DETAIL_USERINFO_RULE_HPP
|
||||
#define BOOST_URL_RFC_DETAIL_USERINFO_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
namespace detail {
|
||||
|
||||
/** Rule for userinfo
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
userinfo = user [ ":" [ password ] ]
|
||||
|
||||
user = *( unreserved / pct-encoded / sub-delims )
|
||||
password = *( unreserved / pct-encoded / sub-delims / ":" )
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
<a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1"
|
||||
>3.2.1. User Information (3986)</a>
|
||||
*/
|
||||
struct userinfo_rule_t
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
pct_string_view user;
|
||||
pct_string_view password;
|
||||
bool has_password = false;
|
||||
};
|
||||
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr userinfo_rule_t userinfo_rule{};
|
||||
|
||||
} // detail
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_GEN_DELIM_CHARS_HPP
|
||||
#define BOOST_URL_RFC_GEN_DELIM_CHARS_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/grammar/lut_chars.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** The gen-delims character set
|
||||
|
||||
@par Example
|
||||
Character sets are used with rules and
|
||||
the functions @ref grammar::find_if and
|
||||
@ref grammar::find_if_not.
|
||||
@code
|
||||
system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( gen_delim_chars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-2.2"
|
||||
>2.2. Reserved Characters (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::find_if,
|
||||
@ref grammar::find_if_not,
|
||||
@ref grammar::parse,
|
||||
@ref pct_encoded_rule.
|
||||
*/
|
||||
constexpr
|
||||
grammar::lut_chars
|
||||
gen_delim_chars = ":/?#[]@";
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_IMPL_PCT_ENCODED_RULE_HPP
|
||||
#define BOOST_URL_RFC_IMPL_PCT_ENCODED_RULE_HPP
|
||||
|
||||
#include <boost/url/grammar/charset.hpp>
|
||||
#include <boost/url/grammar/error.hpp>
|
||||
#include <boost/url/grammar/hexdig_chars.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class CharSet>
|
||||
auto
|
||||
parse_encoded(
|
||||
char const*& it,
|
||||
char const* end,
|
||||
CharSet const& cs) noexcept ->
|
||||
system::result<pct_string_view>
|
||||
{
|
||||
auto const start = it;
|
||||
std::size_t n = 0;
|
||||
char const* it0;
|
||||
skip:
|
||||
it0 = it;
|
||||
it = grammar::find_if_not(
|
||||
it0, end, cs);
|
||||
n += it - it0;
|
||||
if(it == end)
|
||||
goto finish;
|
||||
if(*it != '%')
|
||||
goto finish;
|
||||
for(;;)
|
||||
{
|
||||
++it;
|
||||
if(it == end)
|
||||
{
|
||||
// expected HEXDIG
|
||||
BOOST_URL_RETURN_EC(
|
||||
grammar::error::invalid);
|
||||
}
|
||||
auto r = grammar::hexdig_value(*it);
|
||||
if(r < 0)
|
||||
{
|
||||
// expected HEXDIG
|
||||
BOOST_URL_RETURN_EC(
|
||||
grammar::error::invalid);
|
||||
}
|
||||
++it;
|
||||
if(it == end)
|
||||
{
|
||||
// expected HEXDIG
|
||||
BOOST_URL_RETURN_EC(
|
||||
grammar::error::invalid);
|
||||
}
|
||||
r = grammar::hexdig_value(*it);
|
||||
if(r < 0)
|
||||
{
|
||||
// expected HEXDIG
|
||||
BOOST_URL_RETURN_EC(
|
||||
grammar::error::invalid);
|
||||
}
|
||||
++n;
|
||||
++it;
|
||||
if(it == end)
|
||||
break;
|
||||
if(*it != '%')
|
||||
goto skip;
|
||||
}
|
||||
finish:
|
||||
return make_pct_string_view_unsafe(
|
||||
start, it - start, n);
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
template<class CharSet>
|
||||
auto
|
||||
pct_encoded_rule_t<CharSet>::
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept ->
|
||||
system::result<value_type>
|
||||
{
|
||||
return detail::parse_encoded(
|
||||
it, end, cs_);
|
||||
}
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_IPV4_ADDRESS_RULE_HPP
|
||||
#define BOOST_URL_RFC_IPV4_ADDRESS_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/ipv4_address.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for an IP version 4 style address
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = ipv4_address;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< ipv4_address > rv = grammar::parse( "192.168.0.1", ipv4_address_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
|
||||
|
||||
dec-octet = DIGIT ; 0-9
|
||||
/ %x31-39 DIGIT ; 10-99
|
||||
/ "1" 2DIGIT ; 100-199
|
||||
/ "2" %x30-34 DIGIT ; 200-249
|
||||
/ "25" %x30-35 ; 250-255
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://en.wikipedia.org/wiki/IPv4"
|
||||
>IPv4 (Wikipedia)</a>
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref ipv4_address,
|
||||
@ref parse_ipv4_address,
|
||||
@ref grammar::parse.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ ipv4_address_rule;
|
||||
#else
|
||||
struct ipv4_address_rule_t
|
||||
{
|
||||
using value_type =
|
||||
ipv4_address;
|
||||
|
||||
BOOST_URL_DECL
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<ipv4_address>;
|
||||
};
|
||||
|
||||
constexpr ipv4_address_rule_t ipv4_address_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// Copyright (c) 2022 Vinnie Falco (vinnie.falco@gmail.com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_IPV6_ADDRESS_RULE_HPP
|
||||
#define BOOST_URL_RFC_IPV6_ADDRESS_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/ipv6_address.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for An IP version 6 style address
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = ipv6_address;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< ipv6_address > rv = grammar::parse( "2001:0db8:85a3:0000:0000:8a2e:0370:7334", ipv6_address_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
IPv6address = 6( h16 ":" ) ls32
|
||||
/ "::" 5( h16 ":" ) ls32
|
||||
/ [ h16 ] "::" 4( h16 ":" ) ls32
|
||||
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
||||
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
||||
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
||||
/ [ *4( h16 ":" ) h16 ] "::" ls32
|
||||
/ [ *5( h16 ":" ) h16 ] "::" h16
|
||||
/ [ *6( h16 ":" ) h16 ] "::"
|
||||
|
||||
ls32 = ( h16 ":" h16 ) / IPv4address
|
||||
; least-significant 32 bits of address
|
||||
|
||||
h16 = 1*4HEXDIG
|
||||
; 16 bits of address represented in hexadecimal
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc4291"
|
||||
>IP Version 6 Addressing Architecture (rfc4291)</a>
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
|
||||
>3.2.2. Host (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref ipv6_address,
|
||||
@ref parse_ipv6_address,
|
||||
@ref grammar::parse.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ ipv6_address_rule;
|
||||
#else
|
||||
struct ipv6_address_rule_t
|
||||
{
|
||||
using value_type =
|
||||
ipv6_address;
|
||||
|
||||
BOOST_URL_DECL
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<ipv6_address>;
|
||||
};
|
||||
|
||||
constexpr ipv6_address_rule_t ipv6_address_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_ORIGIN_FORM_RULE_HPP
|
||||
#define BOOST_URL_RFC_ORIGIN_FORM_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/url_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for origin-form
|
||||
|
||||
This appears in the HTTP/1 request-line grammar.
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = url_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< url_view > rv = grammar::parse( "/index.htm?layout=mobile", origin_form_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
origin-form = absolute-path [ "?" query ]
|
||||
|
||||
absolute-path = 1*( "/" segment )
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1"
|
||||
>5.3.1. origin-form (rfc7230)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::parse,
|
||||
@ref parse_origin_form,
|
||||
@ref url_view.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ origin_form_rule;
|
||||
#else
|
||||
struct origin_form_rule_t
|
||||
{
|
||||
using value_type =
|
||||
url_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept;
|
||||
};
|
||||
|
||||
constexpr origin_form_rule_t origin_form_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_PCHARS_HPP
|
||||
#define BOOST_URL_RFC_PCHARS_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/rfc/sub_delim_chars.hpp>
|
||||
#include <boost/url/rfc/unreserved_chars.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** The path character set
|
||||
|
||||
@par Example
|
||||
Character sets are used with rules and
|
||||
the functions @ref grammar::find_if and
|
||||
@ref grammar::find_if_not.
|
||||
@code
|
||||
system::result< decode_view > rv = grammar::parse( "Program%20Files", pchars );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.3"
|
||||
>3.3. Path (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::find_if,
|
||||
@ref grammar::find_if_not,
|
||||
@ref grammar::parse,
|
||||
@ref pct_encoded_rule.
|
||||
*/
|
||||
constexpr auto pchars =
|
||||
unreserved_chars + sub_delim_chars + ':' + '@';
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_PCT_ENCODED_RULE_HPP
|
||||
#define BOOST_URL_RFC_PCT_ENCODED_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/pct_string_view.hpp>
|
||||
#include <boost/url/grammar/charset.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for a string with percent-encoded escapes
|
||||
|
||||
This function returns a rule which matches
|
||||
a percent-encoded string, permitting characters
|
||||
in the string which are also in the specified
|
||||
character set to be used unescaped.
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = pct_string_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
// pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
|
||||
system::result< pct_string_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( pchars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
pct-encoded = "%" HEXDIG HEXDIG
|
||||
@endcode
|
||||
|
||||
@param cs The character set indicating
|
||||
which characters are allowed without escapes.
|
||||
Any character which is not in this set must be
|
||||
escaped, or else parsing returns an error.
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-2.1">
|
||||
2.1. Percent-Encoding (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::parse,
|
||||
@ref pchars,
|
||||
@ref pct_string_view.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
/**@{*/
|
||||
template<class CharSet>
|
||||
constexpr
|
||||
__implementation_defined__
|
||||
pct_encoded_rule( CharSet const& cs ) noexcept;
|
||||
/**@}*/
|
||||
#else
|
||||
template<class CharSet>
|
||||
struct pct_encoded_rule_t
|
||||
{
|
||||
using value_type = pct_string_view;
|
||||
|
||||
template<class CharSet_>
|
||||
friend
|
||||
constexpr
|
||||
auto
|
||||
pct_encoded_rule(
|
||||
CharSet_ const& cs) noexcept ->
|
||||
pct_encoded_rule_t<CharSet_>;
|
||||
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end) const noexcept;
|
||||
|
||||
private:
|
||||
constexpr
|
||||
pct_encoded_rule_t(
|
||||
CharSet const& cs) noexcept
|
||||
: cs_(cs)
|
||||
{
|
||||
}
|
||||
|
||||
CharSet cs_;
|
||||
};
|
||||
|
||||
template<class CharSet>
|
||||
constexpr
|
||||
auto
|
||||
pct_encoded_rule(
|
||||
CharSet const& cs) noexcept ->
|
||||
pct_encoded_rule_t<CharSet>
|
||||
{
|
||||
// If an error occurs here it means that
|
||||
// the value of your type does not meet
|
||||
// the requirements. Please check the
|
||||
// documentation!
|
||||
static_assert(
|
||||
grammar::is_charset<CharSet>::value,
|
||||
"CharSet requirements not met");
|
||||
|
||||
return pct_encoded_rule_t<CharSet>(cs);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#include <boost/url/rfc/impl/pct_encoded_rule.hpp>
|
||||
|
||||
#endif
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_QUERY_RULE_HPP
|
||||
#define BOOST_URL_RFC_QUERY_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/params_encoded_view.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for query
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = params_encoded_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< params_encoded_view > rv = grammar::parse( "format=web&id=42&compact", query_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
query = *( pchar / "/" / "?" )
|
||||
|
||||
query-params = [ query-param ] *( "&" query-param )
|
||||
query-param = key [ "=" value ]
|
||||
key = *qpchar
|
||||
value = *( qpchar / "=" )
|
||||
qpchar = unreserved
|
||||
/ pct-encoded
|
||||
/ "!" / "$" / "'" / "(" / ")"
|
||||
/ "*" / "+" / "," / ";"
|
||||
/ ":" / "@" / "/" / "?"
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.4"
|
||||
>3.4. Query (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::parse,
|
||||
@ref params_encoded_view.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ query_rule;
|
||||
#else
|
||||
struct query_rule_t
|
||||
{
|
||||
using value_type = params_encoded_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
system::result<value_type>
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept;
|
||||
};
|
||||
|
||||
constexpr query_rule_t query_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_RELATIVE_REF_RULE_HPP
|
||||
#define BOOST_URL_RFC_RELATIVE_REF_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/url_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for relative-ref
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = url_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< url_view > rv = grammar::parse( "images/dot.gif?v=hide#a", relative_ref_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.2"
|
||||
>4.2. Relative Reference (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::parse,
|
||||
@ref parse_relative_ref,
|
||||
@ref url_view.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ relative_ref_rule;
|
||||
#else
|
||||
struct relative_ref_rule_t
|
||||
{
|
||||
using value_type = url_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr relative_ref_rule_t relative_ref_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_RESERVED_CHARS_HPP
|
||||
#define BOOST_URL_RFC_RESERVED_CHARS_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/rfc/unreserved_chars.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** The reserved character set
|
||||
|
||||
@par Example
|
||||
Character sets are used with rules and
|
||||
the functions @ref grammar::find_if and
|
||||
@ref grammar::find_if_not.
|
||||
@code
|
||||
system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( reserved_chars ) );
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-2.3"
|
||||
>2.3. Unreserved Characters (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::find_if,
|
||||
@ref grammar::find_if_not,
|
||||
@ref grammar::parse,
|
||||
@ref pct_encoded_rule.
|
||||
*/
|
||||
constexpr auto reserved_chars = ~unreserved_chars;
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_SUB_DELIM_CHARS_HPP
|
||||
#define BOOST_URL_RFC_SUB_DELIM_CHARS_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/grammar/lut_chars.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** The sub-delims character set
|
||||
|
||||
@par Example
|
||||
Character sets are used with rules and
|
||||
the functions @ref grammar::find_if and
|
||||
@ref grammar::find_if_not.
|
||||
@code
|
||||
system::result< decode_view > = grammar::parse( "Program%20Files", pct_encoded_rule( sub_delim_chars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
||||
/ "*" / "+" / "," / ";" / "="
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-2.2"
|
||||
>2.2. Reserved Characters (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::find_if,
|
||||
@ref grammar::find_if_not,
|
||||
@ref grammar::parse,
|
||||
@ref pct_encoded_rule.
|
||||
*/
|
||||
constexpr
|
||||
grammar::lut_chars
|
||||
sub_delim_chars = "!$&()*+,;=\x27";
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_UNRESERVED_CHARS_HPP
|
||||
#define BOOST_URL_RFC_UNRESERVED_CHARS_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/grammar/lut_chars.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** The unreserved character set
|
||||
|
||||
@par Example
|
||||
Character sets are used with rules and
|
||||
the functions @ref grammar::find_if and
|
||||
@ref grammar::find_if_not.
|
||||
@code
|
||||
system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( unreserved_chars ) );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-2.3"
|
||||
>2.3. Unreserved Characters (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::find_if,
|
||||
@ref grammar::find_if_not,
|
||||
@ref grammar::parse,
|
||||
@ref pct_encoded_rule.
|
||||
*/
|
||||
constexpr
|
||||
grammar::lut_chars
|
||||
unreserved_chars =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789"
|
||||
"-._~";
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_URI_REFERENCE_RULE_HPP
|
||||
#define BOOST_URL_RFC_URI_REFERENCE_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/url_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for URI-reference
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = url_view;
|
||||
@endcode;
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< url_view > rv = grammar::parse( "ws://echo.example.com/?name=boost#demo", uri_reference_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
URI-reference = URI / relative-ref
|
||||
|
||||
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
||||
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
|
||||
>3. Syntax Components (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::parse,
|
||||
@ref parse_uri_reference,
|
||||
@ref url_view.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ uri_reference_rule{};
|
||||
#else
|
||||
struct uri_reference_rule_t
|
||||
{
|
||||
using value_type = url_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr uri_reference_rule_t uri_reference_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/url
|
||||
//
|
||||
|
||||
#ifndef BOOST_URL_RFC_URI_RULE_HPP
|
||||
#define BOOST_URL_RFC_URI_RULE_HPP
|
||||
|
||||
#include <boost/url/detail/config.hpp>
|
||||
#include <boost/url/error_types.hpp>
|
||||
#include <boost/url/url_view.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace urls {
|
||||
|
||||
/** Rule for URI
|
||||
|
||||
@par Value Type
|
||||
@code
|
||||
using value_type = url_view;
|
||||
@endcode
|
||||
|
||||
@par Example
|
||||
Rules are used with the function @ref grammar::parse.
|
||||
@code
|
||||
system::result< url_view > rv = grammar::parse( "https://www.example.com/index.htm?id=guest#s1", uri_rule );
|
||||
@endcode
|
||||
|
||||
@par BNF
|
||||
@code
|
||||
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
||||
@endcode
|
||||
|
||||
@par Specification
|
||||
@li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3"
|
||||
>3. Syntax Components (rfc3986)</a>
|
||||
|
||||
@see
|
||||
@ref grammar::parse,
|
||||
@ref parse_uri,
|
||||
@ref url_view.
|
||||
*/
|
||||
#ifdef BOOST_URL_DOCS
|
||||
constexpr __implementation_defined__ uri_rule{};
|
||||
#else
|
||||
struct uri_rule_t
|
||||
{
|
||||
using value_type = url_view;
|
||||
|
||||
BOOST_URL_DECL
|
||||
auto
|
||||
parse(
|
||||
char const*& it,
|
||||
char const* const end
|
||||
) const noexcept ->
|
||||
system::result<value_type>;
|
||||
};
|
||||
|
||||
constexpr uri_rule_t uri_rule{};
|
||||
#endif
|
||||
|
||||
} // urls
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user