diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:44 +0300 |
commit | 59e19371de37995fcb36beb16cd6ec030af960bc (patch) | |
tree | fa68e36093ebff8b805462e9e6d331fe9d348214 /library/cpp/coroutine/engine/iostatus.h | |
parent | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff) | |
download | ydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine/iostatus.h')
-rw-r--r-- | library/cpp/coroutine/engine/iostatus.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/coroutine/engine/iostatus.h b/library/cpp/coroutine/engine/iostatus.h index bf6036805d..201cc77825 100644 --- a/library/cpp/coroutine/engine/iostatus.h +++ b/library/cpp/coroutine/engine/iostatus.h @@ -1,41 +1,41 @@ -#pragma once +#pragma once #include <util/generic/yexception.h> class TIOStatus { public: - TIOStatus(int status) noexcept + TIOStatus(int status) noexcept : Status_(status) { } - static TIOStatus Error(int status) noexcept { + static TIOStatus Error(int status) noexcept { return TIOStatus(status); } - static TIOStatus Error() noexcept { + static TIOStatus Error() noexcept { return TIOStatus(LastSystemError()); } - static TIOStatus Success() noexcept { + static TIOStatus Success() noexcept { return TIOStatus(0); } - void Check() const { + void Check() const { if (Status_) { ythrow TSystemError(Status_) << "io error"; } } - bool Failed() const noexcept { + bool Failed() const noexcept { return (bool)Status_; } - bool Succeed() const noexcept { + bool Succeed() const noexcept { return !Failed(); } - int Status() const noexcept { + int Status() const noexcept { return Status_; } @@ -43,43 +43,43 @@ private: int Status_; }; - + class TContIOStatus { public: - TContIOStatus(size_t processed, TIOStatus status) noexcept + TContIOStatus(size_t processed, TIOStatus status) noexcept : Processed_(processed) , Status_(status) { } - static TContIOStatus Error(TIOStatus status) noexcept { + static TContIOStatus Error(TIOStatus status) noexcept { return TContIOStatus(0, status); } - static TContIOStatus Error() noexcept { + static TContIOStatus Error() noexcept { return TContIOStatus(0, TIOStatus::Error()); } - static TContIOStatus Success(size_t processed) noexcept { + static TContIOStatus Success(size_t processed) noexcept { return TContIOStatus(processed, TIOStatus::Success()); } - static TContIOStatus Eof() noexcept { + static TContIOStatus Eof() noexcept { return Success(0); } - ~TContIOStatus() { + ~TContIOStatus() { } - size_t Processed() const noexcept { + size_t Processed() const noexcept { return Processed_; } - int Status() const noexcept { + int Status() const noexcept { return Status_.Status(); } - size_t Checked() const { + size_t Checked() const { Status_.Check(); return Processed_; |