aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp/absl/status/status.h
diff options
context:
space:
mode:
authorprime <prime@yandex-team.ru>2022-02-10 16:46:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:01 +0300
commite34f3f0e381020a427f44fbd50463d9a04089db3 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/restricted/abseil-cpp/absl/status/status.h
parent3695a7cd42b74a4987d8d5a8f2e2443556998943 (diff)
downloadydb-e34f3f0e381020a427f44fbd50463d9a04089db3.tar.gz
Restoring authorship annotation for <prime@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp/absl/status/status.h')
-rw-r--r--contrib/restricted/abseil-cpp/absl/status/status.h152
1 files changed, 76 insertions, 76 deletions
diff --git a/contrib/restricted/abseil-cpp/absl/status/status.h b/contrib/restricted/abseil-cpp/absl/status/status.h
index d43f526336..39071e5f4a 100644
--- a/contrib/restricted/abseil-cpp/absl/status/status.h
+++ b/contrib/restricted/abseil-cpp/absl/status/status.h
@@ -58,7 +58,7 @@
#include "absl/functional/function_ref.h"
#include "absl/status/internal/status_internal.h"
#include "absl/strings/cord.h"
-#include "absl/strings/string_view.h"
+#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
namespace absl {
@@ -282,59 +282,59 @@ std::string StatusCodeToString(StatusCode code);
// Streams StatusCodeToString(code) to `os`.
std::ostream& operator<<(std::ostream& os, StatusCode code);
-// absl::StatusToStringMode
-//
-// An `absl::StatusToStringMode` is an enumerated type indicating how
+// absl::StatusToStringMode
+//
+// An `absl::StatusToStringMode` is an enumerated type indicating how
// `absl::Status::ToString()` should construct the output string for a non-ok
-// status.
-enum class StatusToStringMode : int {
- // ToString will not contain any extra data (such as payloads). It will only
- // contain the error code and message, if any.
- kWithNoExtraData = 0,
- // ToString will contain the payloads.
- kWithPayload = 1 << 0,
- // ToString will include all the extra data this Status has.
- kWithEverything = ~kWithNoExtraData,
+// status.
+enum class StatusToStringMode : int {
+ // ToString will not contain any extra data (such as payloads). It will only
+ // contain the error code and message, if any.
+ kWithNoExtraData = 0,
+ // ToString will contain the payloads.
+ kWithPayload = 1 << 0,
+ // ToString will include all the extra data this Status has.
+ kWithEverything = ~kWithNoExtraData,
// Default mode used by ToString. Its exact value might change in the future.
kDefault = kWithPayload,
-};
-
-// absl::StatusToStringMode is specified as a bitmask type, which means the
-// following operations must be provided:
-inline constexpr StatusToStringMode operator&(StatusToStringMode lhs,
- StatusToStringMode rhs) {
- return static_cast<StatusToStringMode>(static_cast<int>(lhs) &
- static_cast<int>(rhs));
-}
-inline constexpr StatusToStringMode operator|(StatusToStringMode lhs,
- StatusToStringMode rhs) {
- return static_cast<StatusToStringMode>(static_cast<int>(lhs) |
- static_cast<int>(rhs));
-}
-inline constexpr StatusToStringMode operator^(StatusToStringMode lhs,
- StatusToStringMode rhs) {
- return static_cast<StatusToStringMode>(static_cast<int>(lhs) ^
- static_cast<int>(rhs));
-}
-inline constexpr StatusToStringMode operator~(StatusToStringMode arg) {
- return static_cast<StatusToStringMode>(~static_cast<int>(arg));
-}
-inline StatusToStringMode& operator&=(StatusToStringMode& lhs,
- StatusToStringMode rhs) {
- lhs = lhs & rhs;
- return lhs;
-}
-inline StatusToStringMode& operator|=(StatusToStringMode& lhs,
- StatusToStringMode rhs) {
- lhs = lhs | rhs;
- return lhs;
-}
-inline StatusToStringMode& operator^=(StatusToStringMode& lhs,
- StatusToStringMode rhs) {
- lhs = lhs ^ rhs;
- return lhs;
-}
-
+};
+
+// absl::StatusToStringMode is specified as a bitmask type, which means the
+// following operations must be provided:
+inline constexpr StatusToStringMode operator&(StatusToStringMode lhs,
+ StatusToStringMode rhs) {
+ return static_cast<StatusToStringMode>(static_cast<int>(lhs) &
+ static_cast<int>(rhs));
+}
+inline constexpr StatusToStringMode operator|(StatusToStringMode lhs,
+ StatusToStringMode rhs) {
+ return static_cast<StatusToStringMode>(static_cast<int>(lhs) |
+ static_cast<int>(rhs));
+}
+inline constexpr StatusToStringMode operator^(StatusToStringMode lhs,
+ StatusToStringMode rhs) {
+ return static_cast<StatusToStringMode>(static_cast<int>(lhs) ^
+ static_cast<int>(rhs));
+}
+inline constexpr StatusToStringMode operator~(StatusToStringMode arg) {
+ return static_cast<StatusToStringMode>(~static_cast<int>(arg));
+}
+inline StatusToStringMode& operator&=(StatusToStringMode& lhs,
+ StatusToStringMode rhs) {
+ lhs = lhs & rhs;
+ return lhs;
+}
+inline StatusToStringMode& operator|=(StatusToStringMode& lhs,
+ StatusToStringMode rhs) {
+ lhs = lhs | rhs;
+ return lhs;
+}
+inline StatusToStringMode& operator^=(StatusToStringMode& lhs,
+ StatusToStringMode rhs) {
+ lhs = lhs ^ rhs;
+ return lhs;
+}
+
// absl::Status
//
// The `absl::Status` class is generally used to gracefully handle errors
@@ -416,12 +416,12 @@ inline StatusToStringMode& operator^=(StatusToStringMode& lhs,
// return result;
// }
//
-// For documentation see https://abseil.io/docs/cpp/guides/status.
-//
-// Returned Status objects may not be ignored. status_internal.h has a forward
-// declaration of the form
-// class ABSL_MUST_USE_RESULT Status;
-class Status final {
+// For documentation see https://abseil.io/docs/cpp/guides/status.
+//
+// Returned Status objects may not be ignored. status_internal.h has a forward
+// declaration of the form
+// class ABSL_MUST_USE_RESULT Status;
+class Status final {
public:
// Constructors
@@ -431,10 +431,10 @@ class Status final {
Status();
// Creates a status in the canonical error space with the specified
- // `absl::StatusCode` and error message. If `code == absl::StatusCode::kOk`, // NOLINT
+ // `absl::StatusCode` and error message. If `code == absl::StatusCode::kOk`, // NOLINT
// `msg` is ignored and an object identical to an OK status is constructed.
//
- // The `msg` string must be in UTF-8. The implementation may complain (e.g., // NOLINT
+ // The `msg` string must be in UTF-8. The implementation may complain (e.g., // NOLINT
// by printing a warning) if it is not.
Status(absl::StatusCode code, absl::string_view msg);
@@ -503,16 +503,16 @@ class Status final {
// Status::ToString()
//
- // Returns a string based on the `mode`. By default, it returns combination of
- // the error code name, the message and any associated payload messages. This
- // string is designed simply to be human readable and its exact format should
- // not be load bearing. Do not depend on the exact format of the result of
- // `ToString()` which is subject to change.
+ // Returns a string based on the `mode`. By default, it returns combination of
+ // the error code name, the message and any associated payload messages. This
+ // string is designed simply to be human readable and its exact format should
+ // not be load bearing. Do not depend on the exact format of the result of
+ // `ToString()` which is subject to change.
//
// The printed code name and the message are generally substrings of the
// result, and the payloads to be printed use the status payload printer
// mechanism (which is internal).
- std::string ToString(
+ std::string ToString(
StatusToStringMode mode = StatusToStringMode::kDefault) const;
// Status::IgnoreError()
@@ -613,9 +613,9 @@ class Status final {
status_internal::Payloads* GetPayloads();
// Takes ownership of payload.
- static uintptr_t NewRep(
- absl::StatusCode code, absl::string_view msg,
- std::unique_ptr<status_internal::Payloads> payload);
+ static uintptr_t NewRep(
+ absl::StatusCode code, absl::string_view msg,
+ std::unique_ptr<status_internal::Payloads> payload);
static bool EqualsSlow(const absl::Status& a, const absl::Status& b);
// MSVC 14.0 limitation requires the const.
@@ -644,7 +644,7 @@ class Status final {
static uintptr_t PointerToRep(status_internal::StatusRep* r);
static status_internal::StatusRep* RepToPointer(uintptr_t r);
- std::string ToStringSlow(StatusToStringMode mode) const;
+ std::string ToStringSlow(StatusToStringMode mode) const;
// Status supports two different representations.
// - When the low bit is off it is an inlined representation.
@@ -767,11 +767,11 @@ inline Status::Status(Status&& x) noexcept : rep_(x.rep_) {
inline Status& Status::operator=(Status&& x) {
uintptr_t old_rep = rep_;
- if (x.rep_ != old_rep) {
- rep_ = x.rep_;
- x.rep_ = MovedFromRep();
- Unref(old_rep);
- }
+ if (x.rep_ != old_rep) {
+ rep_ = x.rep_;
+ x.rep_ = MovedFromRep();
+ Unref(old_rep);
+ }
return *this;
}
@@ -808,8 +808,8 @@ inline bool operator!=(const Status& lhs, const Status& rhs) {
return !(lhs == rhs);
}
-inline std::string Status::ToString(StatusToStringMode mode) const {
- return ok() ? "OK" : ToStringSlow(mode);
+inline std::string Status::ToString(StatusToStringMode mode) const {
+ return ok() ? "OK" : ToStringSlow(mode);
}
inline void Status::IgnoreError() const {