Skip to content

Commit

Permalink
Add forward declaration headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtum committed Oct 16, 2024
1 parent 9660ae8 commit 407a2bf
Show file tree
Hide file tree
Showing 50 changed files with 662 additions and 56 deletions.
3 changes: 2 additions & 1 deletion include/boost/beast/http/basic_dynamic_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
#ifndef BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP
#define BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP

#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/buffer_traits.hpp>
#include <boost/beast/core/detail/buffer.hpp>
#include <boost/beast/core/detail/clamp.hpp>
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/http/basic_dynamic_body_fwd.hpp>
#include <boost/beast/http/error.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/optional.hpp>
Expand Down
24 changes: 24 additions & 0 deletions include/boost/beast/http/basic_dynamic_body_fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Copyright (c) 2024 Mohammad Nejati
//
// 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/beast
//

#ifndef BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_FWD_HPP
#define BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_FWD_HPP

namespace boost {
namespace beast {
namespace http {

template<class DynamicBuffer>
struct basic_dynamic_body;

} // http
} // beast
} // boost

#endif
1 change: 1 addition & 0 deletions include/boost/beast/http/basic_file_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/error.hpp>
#include <boost/beast/core/file_base.hpp>
#include <boost/beast/http/basic_file_body_fwd.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/assert.hpp>
#include <boost/optional.hpp>
Expand Down
24 changes: 24 additions & 0 deletions include/boost/beast/http/basic_file_body_fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Copyright (c) 2024 Mohammad Nejati
//
// 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/beast
//

#ifndef BOOST_BEAST_HTTP_BASIC_FILE_BODY_FWD_HPP
#define BOOST_BEAST_HTTP_BASIC_FILE_BODY_FWD_HPP

namespace boost {
namespace beast {
namespace http {

template<class File>
struct basic_file_body;

} // http
} // beast
} // boost

#endif
4 changes: 2 additions & 2 deletions include/boost/beast/http/buffer_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
#ifndef BOOST_BEAST_HTTP_BUFFER_BODY_HPP
#define BOOST_BEAST_HTTP_BUFFER_BODY_HPP

#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/buffer_traits.hpp>
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/http/buffer_body_fwd.hpp>
#include <boost/beast/http/error.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/beast/http/type_traits.hpp>
#include <boost/optional.hpp>

#include <cstdint>
#include <type_traits>
#include <utility>

namespace boost {
Expand Down
23 changes: 23 additions & 0 deletions include/boost/beast/http/buffer_body_fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Copyright (c) 2024 Mohammad Nejati
//
// 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/beast
//

#ifndef BOOST_BEAST_HTTP_BUFFER_BODY_FWD_HPP
#define BOOST_BEAST_HTTP_BUFFER_BODY_FWD_HPP

namespace boost {
namespace beast {
namespace http {

struct buffer_body;

} // http
} // beast
} // boost

#endif
12 changes: 2 additions & 10 deletions include/boost/beast/http/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,14 @@
#define BOOST_BEAST_HTTP_DETAIL_TYPE_TRAITS_HPP

#include <boost/beast/core/detail/type_traits.hpp>
#include <boost/beast/http/message_fwd.hpp>
#include <boost/beast/http/parser_fwd.hpp>
#include <boost/optional.hpp>
#include <cstdint>

namespace boost {
namespace beast {
namespace http {

template<bool isRequest, class Fields>
class header;

template<bool, class, class>
class message;

template<bool isRequest, class Body, class Fields>
class parser;

namespace detail {

template<class T>
Expand Down
32 changes: 32 additions & 0 deletions include/boost/beast/http/dynamic_body_fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Copyright (c) 2024 Mohammad Nejati
//
// 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/beast
//

#ifndef BOOST_BEAST_HTTP_DYNAMIC_BODY_FWD_HPP
#define BOOST_BEAST_HTTP_DYNAMIC_BODY_FWD_HPP

#include <boost/beast/http/basic_dynamic_body_fwd.hpp>
#include <memory>

namespace boost {
namespace beast {

template<class Allocator>
class basic_multi_buffer;

using multi_buffer = basic_multi_buffer<std::allocator<char>>;

namespace http {

using dynamic_body = basic_dynamic_body<multi_buffer>;

} // http
} // beast
} // boost

#endif
1 change: 1 addition & 0 deletions include/boost/beast/http/empty_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define BOOST_BEAST_HTTP_EMPTY_BODY_HPP

#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/http/empty_body_fwd.hpp>
#include <boost/beast/http/error.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/optional.hpp>
Expand Down
23 changes: 23 additions & 0 deletions include/boost/beast/http/empty_body_fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Copyright (c) 2024 Mohammad Nejati
//
// 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/beast
//

#ifndef BOOST_BEAST_HTTP_EMPTY_BODY_FWD_HPP
#define BOOST_BEAST_HTTP_EMPTY_BODY_FWD_HPP

namespace boost {
namespace beast {
namespace http {

struct empty_body;

} // http
} // beast
} // boost

#endif
4 changes: 2 additions & 2 deletions include/boost/beast/http/fields.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
#include <boost/beast/core/error.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/http/field.hpp>
#include <boost/beast/http/fields_fwd.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/core/empty_value.hpp>
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/set.hpp>
#include <boost/optional.hpp>
#include <algorithm>

#include <cctype>
#include <cstring>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>

Expand Down
28 changes: 28 additions & 0 deletions include/boost/beast/http/fields_fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Copyright (c) 2024 Mohammad Nejati
//
// 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/beast
//

#ifndef BOOST_BEAST_HTTP_FIELDS_FWD_HPP
#define BOOST_BEAST_HTTP_FIELDS_FWD_HPP

#include <memory>

namespace boost {
namespace beast {
namespace http {

template<class Allocator>
class basic_fields;

using fields = basic_fields<std::allocator<char>>;

} // http
} // beast
} // boost

#endif
4 changes: 1 addition & 3 deletions include/boost/beast/http/file_body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@

#include <boost/beast/core/file.hpp>
#include <boost/beast/http/basic_file_body.hpp>
#include <boost/beast/http/file_body_fwd.hpp>
#include <boost/assert.hpp>
#include <boost/optional.hpp>
#include <algorithm>
#include <cstdio>
#include <cstdint>
#include <utility>

namespace boost {
namespace beast {
Expand Down
26 changes: 26 additions & 0 deletions include/boost/beast/http/file_body_fwd.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright (c) 2024 Mohammad Nejati
//
// 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/beast
//

#ifndef BOOST_BEAST_HTTP_FILE_BODY_FWD_HPP
#define BOOST_BEAST_HTTP_FILE_BODY_FWD_HPP

#include <boost/beast/core/file.hpp>
#include <boost/beast/http/basic_file_body_fwd.hpp>

namespace boost {
namespace beast {
namespace http {

using file_body = basic_file_body<file>;

} // http
} // beast
} // boost

#endif
23 changes: 13 additions & 10 deletions include/boost/beast/http/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@
#define BOOST_BEAST_HTTP_MESSAGE_HPP

#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/http/fields.hpp>
#include <boost/beast/http/verb.hpp>
#include <boost/beast/http/message_fwd.hpp>
#include <boost/beast/http/status.hpp>
#include <boost/beast/http/type_traits.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/http/verb.hpp>
#include <boost/assert.hpp>
#include <boost/core/empty_value.hpp>
#include <boost/mp11/integer_sequence.hpp>
#include <boost/assert.hpp>
#include <boost/optional.hpp>
#include <boost/throw_exception.hpp>
#include <memory>
#include <stdexcept>
#include <string>

#include <tuple>
#include <utility>

Expand All @@ -48,11 +47,7 @@ namespace http {
#if BOOST_BEAST_DOXYGEN
template<bool isRequest, class Fields = fields>
class header : public Fields

#else
template<bool isRequest, class Fields = fields>
class header;

template<class Fields>
class header<true, Fields> : public Fields
#endif
Expand Down Expand Up @@ -445,13 +440,15 @@ class header<false, Fields> : public Fields
#endif
};

#if BOOST_BEAST_DOXYGEN
/// A typical HTTP request header
template<class Fields = fields>
using request_header = header<true, Fields>;

/// A typical HTTP response header
template<class Fields = fields>
using response_header = header<false, Fields>;
#endif

#if defined(BOOST_MSVC)
// Workaround for MSVC bug with private base classes
Expand Down Expand Up @@ -490,7 +487,11 @@ using value_type_t = typename T::value_type;
@tparam Fields The type of container used to hold the
field value pairs.
*/
#if BOOST_BEAST_DOXYGEN
template<bool isRequest, class Body, class Fields = fields>
#else
template<bool isRequest, class Body, class Fields>
#endif
class message
: public header<isRequest, Fields>
#if ! BOOST_BEAST_DOXYGEN
Expand Down Expand Up @@ -972,13 +973,15 @@ class message
prepare_payload(std::false_type);
};

#if BOOST_BEAST_DOXYGEN
/// A typical HTTP request
template<class Body, class Fields = fields>
using request = message<true, Body, Fields>;

/// A typical HTTP response
template<class Body, class Fields = fields>
using response = message<false, Body, Fields>;
#endif

//------------------------------------------------------------------------------

Expand Down
Loading

0 comments on commit 407a2bf

Please sign in to comment.