aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/stubs/statusor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/stubs/statusor.h')
-rw-r--r--src/google/protobuf/stubs/statusor.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/google/protobuf/stubs/statusor.h b/src/google/protobuf/stubs/statusor.h
index 29f869ad..90fd5f0d 100644
--- a/src/google/protobuf/stubs/statusor.h
+++ b/src/google/protobuf/stubs/statusor.h
@@ -33,7 +33,7 @@
// usable value, or an error Status explaining why such a value is
// not present. To this end, StatusOr<T> does not allow its Status
// value to be Status::OK. Further, StatusOr<T*> does not allow the
-// contained pointer to be NULL.
+// contained pointer to be nullptr.
//
// The primary use-case for StatusOr<T> is as the return value of a
// function which may fail.
@@ -89,6 +89,8 @@
#include <google/protobuf/stubs/status.h>
+#include <google/protobuf/port_def.inc>
+
namespace google {
namespace protobuf {
namespace util {
@@ -114,15 +116,15 @@ class StatusOr {
StatusOr(const Status& status); // NOLINT
// Construct a new StatusOr with the given value. If T is a plain pointer,
- // value must not be NULL. After calling this constructor, calls to
+ // value must not be nullptr. After calling this constructor, calls to
// ValueOrDie() will succeed, and calls to status() will return OK.
//
// NOTE: Not explicit - we want to use StatusOr<T> as a return type
// so it is convenient and sensible to be able to do 'return T()'
// when when the return type is StatusOr<T>.
//
- // REQUIRES: if T is a plain pointer, value != NULL. This requirement is
- // DCHECKed. In optimized builds, passing a NULL pointer here will have
+ // REQUIRES: if T is a plain pointer, value != nullptr. This requirement is
+ // DCHECKed. In optimized builds, passing a null pointer here will have
// the effect of passing PosixErrorSpace::EINVAL as a fallback.
StatusOr(const T& value); // NOLINT
@@ -162,7 +164,7 @@ class StatusOr {
namespace internal {
-class LIBPROTOBUF_EXPORT StatusOrHelper {
+class PROTOBUF_EXPORT StatusOrHelper {
public:
// Move type-agnostic error handling to the .cc.
static void Crash(const util::Status& status);
@@ -174,13 +176,13 @@ class LIBPROTOBUF_EXPORT StatusOrHelper {
template<typename T>
struct StatusOrHelper::Specialize {
- // For non-pointer T, a reference can never be NULL.
+ // For non-pointer T, a reference can never be nullptr.
static inline bool IsValueNull(const T& t) { return false; }
};
template<typename T>
struct StatusOrHelper::Specialize<T*> {
- static inline bool IsValueNull(const T* t) { return t == NULL; }
+ static inline bool IsValueNull(const T* t) { return t == nullptr; }
};
} // namespace internal
@@ -202,7 +204,7 @@ inline StatusOr<T>::StatusOr(const Status& status) {
template<typename T>
inline StatusOr<T>::StatusOr(const T& value) {
if (internal::StatusOrHelper::Specialize<T>::IsValueNull(value)) {
- status_ = Status(error::INTERNAL, "NULL is not a vaild argument.");
+ status_ = Status(error::INTERNAL, "nullptr is not a vaild argument.");
} else {
status_ = Status::OK;
value_ = value;
@@ -256,4 +258,6 @@ inline const T& StatusOr<T>::ValueOrDie() const {
} // namespace protobuf
} // namespace google
+#include <google/protobuf/port_undef.inc>
+
#endif // GOOGLE_PROTOBUF_STUBS_STATUSOR_H_