Skip to content

Commit fb0d863

Browse files
committed
Remove NOLINTs and fixes all clang-tidy issues
1 parent fe66454 commit fb0d863

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/ystdlib/io_interface/WriterInterface.hpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ifndef YSTDLIB_IO_INTERFACE_WRITERINTERFACE_HPP
22
#define YSTDLIB_IO_INTERFACE_WRITERINTERFACE_HPP
3-
// NOLINTBEGIN
43

54
// TODO: https://github.com/y-scope/ystdlib-cpp/issues/50
65
// NOLINTNEXTLINE(misc-include-cleaner)
@@ -30,28 +29,32 @@ class WriterInterface {
3029

3130
// Methods
3231
/**
33-
* Writes the given data to the underlying medium
32+
* Writes the given data to the underlying medium.
3433
* @param data
3534
* @param data_length
3635
*/
37-
virtual void write(char const* data, size_t data_length) = 0;
38-
virtual void flush() = 0;
36+
[[nodiscard]] virtual auto write(char const* data, size_t data_length) -> ErrorCode = 0;
3937

4038
/**
41-
* Writes a numeric value
42-
* @param val Value to write
39+
* Forces any buffered output data to be available at the underlying medium.
40+
*/
41+
[[nodiscard]] virtual auto flush() -> ErrorCode = 0;
42+
43+
/**
44+
* Writes a numeric value to the underlying medium.
45+
* @param val
4346
*/
4447
template <typename ValueType>
45-
void write_numeric_value(ValueType value);
48+
[[nodiscard]] auto write_numeric_value(ValueType value) -> ErrorCode;
4649

4750
/**
48-
* Writes the given character to the underlying medium.
51+
* Writes a character to the underlying medium.
4952
* @param c
5053
*/
5154
[[nodiscard]] virtual auto write_char(char c) -> ErrorCode { return write(&c, 1); }
5255

5356
/**
54-
* Writes the given string to the underlying medium.
57+
* Writes a string to the underlying medium.
5558
* @param str
5659
*/
5760
[[nodiscard]] virtual auto write_string(std::string const& str) -> ErrorCode {
@@ -79,10 +82,9 @@ class WriterInterface {
7982
};
8083

8184
template <typename ValueType>
82-
void WriterInterface::write_numeric_value(ValueType val) {
83-
write(reinterpret_cast<char*>(&val), sizeof(val));
85+
auto WriterInterface::write_numeric_value(ValueType val) -> ErrorCode {
86+
return write(static_cast<char const*>(&val), sizeof(ValueType));
8487
}
8588
} // namespace ystdlib::io_interface
8689

87-
// NOLINTEND
8890
#endif // YSTDLIB_IO_INTERFACE_WRITERINTERFACE_HPP

0 commit comments

Comments
 (0)