forked from eoserv/eomap-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcio.cpp
More file actions
45 lines (35 loc) · 947 Bytes
/
cio.cpp
File metadata and controls
45 lines (35 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "cio.hpp"
namespace cio
{
namespace impl
{
std::string flags_to_modestr(cio::mode flags) noexcept
{
std::string modestr;
bool read = (flags & mode::read) == mode::read;
bool write = (flags & mode::write) == mode::write;
bool append = (flags & mode::append) == mode::append;
bool text = (flags & mode::text) == mode::text;
bool no_overwrite = (flags & mode::no_overwrite) == mode::no_overwrite;
modestr += append ? 'a' : (write ? 'w' : 'r');
if (read && (write || append))
modestr += '+';
if (!text)
modestr += 'b';
if (no_overwrite)
modestr += 'x';
return modestr;
}
}
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#pragma clang diagnostic ignored "-Wexit-time-destructors"
#endif
stream in(stdin, no_ownership);
stream out(stdout, no_ownership);
stream err(stderr, no_ownership);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}