⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
userver
C++ Async Framework v2.0
Documentation
API Groups
Namespaces
Reference
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
w
y
Variables
k
n
r
u
w
Typedefs
c
d
h
m
n
o
p
s
t
u
v
Enumerations
a
b
c
d
f
h
i
l
o
p
r
s
t
u
v
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Symbols
File List
File Members
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
Toggle main menu visibility
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
All results
read.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/fs/blocking/read.hpp
4
/// @brief functions for synchronous (blocking) file read operations
5
/// @ingroup userver_universal
6
7
#
include
<
string
>
8
9
#
include
<
boost
/
filesystem
/
operations
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
/// @brief blocking function and classes to work with filesystem
14
///
15
/// Use these with caution as they block current thread. It is probably OK to
16
/// use them during startup (on component load), but don't use them after server
17
/// start in the main TaskProcessor. Use asynchronous alternatives from `fs`
18
/// namespace instead.
19
namespace
fs::
blocking
{
20
21
/// @brief Reads file contents synchronously
22
/// @param path file to open
23
/// @returns file contents
24
/// @throws std::runtime_error if read fails for any reason (e.g. no such file,
25
/// read error, etc.),
26
std::string
ReadFileContents
(
const
std::string& path);
27
28
/// @brief Checks whether the file exists synchronously
29
/// @param path file path to check
30
/// @returns true if file exists, false if file doesn't exist
31
/// @throws std::runtime_error if something goes wrong (e.g. out of file
32
/// descriptors)
33
bool
FileExists
(
const
std::string& path);
34
35
/// @brief Get file type returned by stat(2) synchronously.
36
/// @param path file path
37
/// @throws std::runtime_error if something goes wrong
38
boost::filesystem::file_type
GetFileType
(
const
std::string& path);
39
40
}
// namespace fs::blocking
41
42
USERVER_NAMESPACE_END
Docs version:
v1.0
,
v2.0
,
trunk/develop
userver
fs
blocking
read.hpp
Generated on Wed May 15 2024 22:33:47 for userver by
Doxygen
1.10.0