1 | #include "cpr/redirect.h" |
---|---|
2 | |
3 | namespace cpr { |
4 | PostRedirectFlags operator|(PostRedirectFlags lhs, PostRedirectFlags rhs) { |
5 | return static_cast<PostRedirectFlags>(static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs)); |
6 | } |
7 | |
8 | PostRedirectFlags operator&(PostRedirectFlags lhs, PostRedirectFlags rhs) { |
9 | return static_cast<PostRedirectFlags>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs)); |
10 | } |
11 | |
12 | PostRedirectFlags operator^(PostRedirectFlags lhs, PostRedirectFlags rhs) { |
13 | return static_cast<PostRedirectFlags>(static_cast<uint8_t>(lhs) ^ static_cast<uint8_t>(rhs)); |
14 | } |
15 | |
16 | PostRedirectFlags operator~(PostRedirectFlags flag) { |
17 | return static_cast<PostRedirectFlags>(~static_cast<uint8_t>(flag)); |
18 | } |
19 | |
20 | PostRedirectFlags& operator|=(PostRedirectFlags& lhs, PostRedirectFlags rhs) { |
21 | lhs = static_cast<PostRedirectFlags>(static_cast<uint8_t>(lhs) | static_cast<uint8_t>(rhs)); |
22 | const uint8_t tmp = static_cast<uint8_t>(lhs); |
23 | lhs = static_cast<PostRedirectFlags>(tmp); |
24 | return lhs; |
25 | } |
26 | |
27 | PostRedirectFlags& operator&=(PostRedirectFlags& lhs, PostRedirectFlags rhs) { |
28 | lhs = static_cast<PostRedirectFlags>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs)); |
29 | return lhs; |
30 | } |
31 | |
32 | PostRedirectFlags& operator^=(PostRedirectFlags& lhs, PostRedirectFlags rhs) { |
33 | lhs = static_cast<PostRedirectFlags>(static_cast<uint8_t>(lhs) ^ static_cast<uint8_t>(rhs)); |
34 | return lhs; |
35 | } |
36 | |
37 | bool any(PostRedirectFlags flag) { |
38 | return flag != PostRedirectFlags::NONE; |
39 | } |
40 | } // namespace cpr |
41 |