File indexing completed on 2025-12-16 09:58:20
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_MYSQL_DETAIL_ROW_IMPL_HPP
0009 #define BOOST_MYSQL_DETAIL_ROW_IMPL_HPP
0010
0011 #include <boost/mysql/field_view.hpp>
0012
0013 #include <boost/mysql/detail/config.hpp>
0014
0015 #include <boost/core/span.hpp>
0016
0017 #include <cstddef>
0018 #include <vector>
0019
0020 namespace boost {
0021 namespace mysql {
0022 namespace detail {
0023
0024
0025
0026 inline span<field_view> add_fields(std::vector<field_view>& storage, std::size_t num_fields)
0027 {
0028 std::size_t old_size = storage.size();
0029 storage.resize(old_size + num_fields);
0030 return span<field_view>(storage.data() + old_size, num_fields);
0031 }
0032
0033
0034
0035 class row_impl
0036 {
0037 public:
0038 row_impl() = default;
0039
0040 BOOST_MYSQL_DECL
0041 row_impl(const row_impl&);
0042
0043 row_impl(row_impl&&) = default;
0044
0045 BOOST_MYSQL_DECL
0046 row_impl& operator=(const row_impl&);
0047
0048 row_impl& operator=(row_impl&&) = default;
0049
0050 ~row_impl() = default;
0051
0052
0053 BOOST_MYSQL_DECL
0054 row_impl(const field_view* fields, std::size_t size);
0055
0056
0057 BOOST_MYSQL_DECL
0058 void assign(const field_view* fields, std::size_t size);
0059
0060
0061 span<field_view> add_fields(std::size_t num_fields)
0062 {
0063 return ::boost::mysql::detail::add_fields(fields_, num_fields);
0064 }
0065
0066
0067 BOOST_MYSQL_DECL
0068 void copy_strings_as_offsets(std::size_t first, std::size_t num_fields);
0069
0070
0071 BOOST_MYSQL_DECL
0072 void offsets_to_string_views();
0073
0074 const std::vector<field_view>& fields() const noexcept { return fields_; }
0075
0076 void clear() noexcept
0077 {
0078 fields_.clear();
0079 string_buffer_.clear();
0080 }
0081
0082 private:
0083 std::vector<field_view> fields_;
0084 std::vector<unsigned char> string_buffer_;
0085 };
0086
0087 }
0088 }
0089 }
0090
0091 #ifdef BOOST_MYSQL_HEADER_ONLY
0092 #include <boost/mysql/impl/row_impl.ipp>
0093 #endif
0094
0095 #endif