| 206 | opipe::opipe() = default; // starting with C++20 could be in-class |
| 207 | |
| 208 | int opipe::write(std::string_view data) |
| 209 | { |
| 210 | constexpr auto CSIZE = sizeof(std::string_view::value_type); |
| 211 | if (!opened()) |
| 212 | return report(EINVAL, "opipe::write"); |
| 213 | if (auto sz = std::fwrite(data.data(), CSIZE, data.length(), file_); |
| 214 | sz != data.size()) { |
| 215 | if (auto err = std::ferror(file_); err != 0) |
| 216 | return report(EIO, "fwrite error"); |
| 217 | if (auto err = std::feof(file_); err != 0) |
| 218 | return report(EIO, "fwrite eof"); |
| 219 | } |
| 220 | return 0; |
| 221 | } |
| 222 | |
| 223 | int opipe::flush(std::string_view data) |
| 224 | { |
no test coverage detected