ゴミ箱
file_stdio.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2016 Vinnie Falco (vinnie dot falco at gmail dot 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/boostorg/beast
8 //
9 
10 #ifndef BOOST_BEAST_CORE_FILE_STDIO_HPP
11 #define BOOST_BEAST_CORE_FILE_STDIO_HPP
12 
13 #include <boost/beast/config.hpp>
16 #include <cstdio>
17 #include <cstdint>
18 
19 namespace boost {
20 namespace beast {
21 
28 {
29  FILE* f_ = nullptr;
30 
31 public:
36  using native_handle_type = FILE*;
37 
42  ~file_stdio();
43 
48  file_stdio() = default;
49 
54  file_stdio(file_stdio&& other);
55 
61 
63  FILE*
64  native_handle() const
65  {
66  return f_;
67  }
68 
75  void
76  native_handle(FILE* f);
77 
79  bool
80  is_open() const
81  {
82  return f_ != nullptr;
83  }
84 
89  void
90  close(error_code& ec);
91 
100  void
101  open(char const* path, file_mode mode, error_code& ec);
102 
109  std::uint64_t
110  size(error_code& ec) const;
111 
118  std::uint64_t
119  pos(error_code& ec) const;
120 
127  void
128  seek(std::uint64_t offset, error_code& ec);
129 
138  std::size_t
139  read(void* buffer, std::size_t n, error_code& ec) const;
140 
149  std::size_t
150  write(void const* buffer, std::size_t n, error_code& ec);
151 };
152 
153 } // beast
154 } // boost
155 
157 
158 #endif
file_mode
Definition: file_base.hpp:26
std::size_t write(void const *buffer, std::size_t n, error_code &ec)
Definition: file_stdio.ipp:220
void close(error_code &ec)
Definition: file_stdio.ipp:61
Definition: async_result.hpp:20
Definition: file_stdio.hpp:27
void open(char const *path, file_mode mode, error_code &ec)
Definition: file_stdio.ipp:79
file_stdio & operator=(file_stdio &&other)
Definition: file_stdio.ipp:37
~file_stdio()
Definition: file_stdio.ipp:20
FILE * native_handle() const
Returns the native handle associated with the file.
Definition: file_stdio.hpp:64
FILE * native_handle_type
Definition: file_stdio.hpp:36
std::size_t read(void *buffer, std::size_t n, error_code &ec) const
Definition: file_stdio.ipp:201
void seek(std::uint64_t offset, error_code &ec)
Definition: file_stdio.ipp:178
boost::system::error_code error_code
The type of error code used by the library.
Definition: error.hpp:21
bool is_open() const
Returns true if the file is open.
Definition: file_stdio.hpp:80
std::uint64_t size(error_code &ec) const
Definition: file_stdio.ipp:121
std::uint64_t pos(error_code &ec) const
Definition: file_stdio.ipp:158