mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-15 11:48:09 +00:00
Added thirdparty: boost library
This commit is contained in:
+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
|
||||
Reference in New Issue
Block a user