userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
c_file.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <cstdint>
7
#include <cstdio>
8
#include <filesystem>
9
#include <span>
10
#include <string_view>
11
12
#include <
userver/fs/blocking/open_mode.hpp
>
13
#include <
userver/utils/fast_pimpl.hpp
>
14
#include <
userver/utils/zstring_view.hpp
>
15
16
USERVER_NAMESPACE_BEGIN
17
18
namespace
fs::blocking
{
19
25
class
CFile
final {
26
public
:
28
CFile
();
29
30
CFile
(
CFile
&&) noexcept;
31
CFile
& operator=(
CFile
&&) noexcept;
32
~
CFile
();
33
36
CFile
(
37
utils
::zstring_view path,
38
OpenMode
flags,
39
std
::filesystem::perms perms =
std
::filesystem::perms::owner_read |
std
::filesystem::perms::owner_write
40
);
41
43
explicit
CFile
(
std
::FILE* file) noexcept;
44
46
bool
IsOpen
() const noexcept;
47
49
std
::FILE*
GetNative
() &;
50
52
std
::FILE*
Release
() &&;
53
56
void
Close
() &&;
57
62
std
::
size_t
Read
(
std
::span<
char
> buffer);
63
68
void
Write
(
std
::string_view data);
69
72
void
Flush
();
73
77
void
FlushLight
();
78
81
std
::uint64_t
GetPosition
() const;
82
85
std
::uint64_t
GetSize
() const;
86
87
private:
88
struct Impl;
89
utils
::FastPimpl<Impl, sizeof(
char
*), alignof(
char
*)> impl_;
90
};
91
92
}
// namespace fs::blocking
93
94
USERVER_NAMESPACE_END
userver
fs
blocking
c_file.hpp
Generated on
for userver by
Doxygen
1.17.0