LCOV - code coverage report
Current view: top level - include/boost/http/detail - file_stdio.hpp (source / functions) Coverage Total Hit
Test: coverage_remapped.info Lines: 100.0 % 4 4
Test Date: 2026-06-13 19:44:58 Functions: 100.0 % 2 2

           TLA  Line data    Source code
       1                 : //
       2                 : // Copyright (c) 2022 Vinnie Falco (vinnie.falco@gmail.com)
       3                 : //
       4                 : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5                 : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6                 : //
       7                 : // Official repository: https://github.com/cppalliance/http
       8                 : //
       9                 : 
      10                 : #ifndef BOOST_HTTP_DETAIL_FILE_STDIO_HPP
      11                 : #define BOOST_HTTP_DETAIL_FILE_STDIO_HPP
      12                 : 
      13                 : #include <boost/http/detail/config.hpp>
      14                 : #include <boost/http/error.hpp>
      15                 : #include <boost/http/file_mode.hpp>
      16                 : #include <cstdio>
      17                 : #include <cstdint>
      18                 : 
      19                 : namespace boost {
      20                 : namespace http {
      21                 : namespace detail {
      22                 : 
      23                 : // Implementation of File which uses cstdio.
      24                 : class file_stdio
      25                 : {
      26                 :     std::FILE* f_ = nullptr;
      27                 : 
      28                 : public:
      29                 :     using native_handle_type = std::FILE*;
      30                 : 
      31                 :     BOOST_HTTP_DECL
      32                 :     ~file_stdio();
      33                 : 
      34                 :     file_stdio() = default;
      35                 : 
      36                 :     BOOST_HTTP_DECL
      37                 :     file_stdio(file_stdio&& other) noexcept;
      38                 : 
      39                 :     BOOST_HTTP_DECL
      40                 :     file_stdio&
      41                 :     operator=(file_stdio&& other) noexcept;
      42                 : 
      43                 :     std::FILE*
      44 HIT           2 :     native_handle() const
      45                 :     {
      46               2 :         return f_;
      47                 :     }
      48                 : 
      49                 :     BOOST_HTTP_DECL
      50                 :     void
      51                 :     native_handle(std::FILE* f);
      52                 : 
      53                 :     bool
      54              10 :     is_open() const
      55                 :     {
      56              10 :         return f_ != nullptr;
      57                 :     }
      58                 : 
      59                 :     BOOST_HTTP_DECL
      60                 :     void
      61                 :     close(system::error_code& ec);
      62                 : 
      63                 :     BOOST_HTTP_DECL
      64                 :     void
      65                 :     open(char const* path, file_mode mode, system::error_code& ec);
      66                 : 
      67                 :     BOOST_HTTP_DECL
      68                 :     std::uint64_t
      69                 :     size(system::error_code& ec) const;
      70                 : 
      71                 :     BOOST_HTTP_DECL
      72                 :     std::uint64_t
      73                 :     pos(system::error_code& ec) const;
      74                 : 
      75                 :     BOOST_HTTP_DECL
      76                 :     void
      77                 :     seek(std::uint64_t offset, system::error_code& ec);
      78                 : 
      79                 :     BOOST_HTTP_DECL
      80                 :     std::size_t
      81                 :     read(void* buffer, std::size_t n, system::error_code& ec);
      82                 : 
      83                 :     BOOST_HTTP_DECL
      84                 :     std::size_t
      85                 :     write(void const* buffer, std::size_t n, system::error_code& ec);
      86                 : };
      87                 : 
      88                 : } // detail
      89                 : } // http
      90                 : } // boost
      91                 : 
      92                 : #endif
        

Generated by: LCOV version 2.3