protobuf
src
google
protobuf
stubs
status.h
Go to the documentation of this file.
1
// Protocol Buffers - Google's data interchange format
2
// Copyright 2008 Google Inc. All rights reserved.
3
// https://developers.google.com/protocol-buffers/
4
//
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are
7
// met:
8
//
9
// * Redistributions of source code must retain the above copyright
10
// notice, this list of conditions and the following disclaimer.
11
// * Redistributions in binary form must reproduce the above
12
// copyright notice, this list of conditions and the following disclaimer
13
// in the documentation and/or other materials provided with the
14
// distribution.
15
// * Neither the name of Google Inc. nor the names of its
16
// contributors may be used to endorse or promote products derived from
17
// this software without specific prior written permission.
18
//
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
#ifndef GOOGLE_PROTOBUF_STUBS_STATUS_H_
31
#define GOOGLE_PROTOBUF_STUBS_STATUS_H_
32
33
#include <iosfwd>
34
#include <string>
35
36
#include <
google/protobuf/stubs/common.h
>
37
#include <
google/protobuf/stubs/stringpiece.h
>
38
39
#include <google/protobuf/port_def.inc>
40
41
namespace
google
{
42
namespace
protobuf {
43
namespace
util {
44
namespace
error
{
45
// These values must match error codes defined in google/rpc/code.proto.
46
enum
Code
{
47
OK
= 0,
48
CANCELLED
= 1,
49
UNKNOWN
= 2,
50
INVALID_ARGUMENT
= 3,
51
DEADLINE_EXCEEDED
= 4,
52
NOT_FOUND
= 5,
53
ALREADY_EXISTS
= 6,
54
PERMISSION_DENIED
= 7,
55
UNAUTHENTICATED
= 16,
56
RESOURCE_EXHAUSTED
= 8,
57
FAILED_PRECONDITION
= 9,
58
ABORTED
= 10,
59
OUT_OF_RANGE
= 11,
60
UNIMPLEMENTED
= 12,
61
INTERNAL
= 13,
62
UNAVAILABLE
= 14,
63
DATA_LOSS
= 15,
64
};
65
}
// namespace error
66
67
class
PROTOBUF_EXPORT
Status
{
68
public
:
69
// Creates a "successful" status.
70
Status
();
71
72
// Create a status in the canonical error space with the specified
73
// code, and error message. If "code == 0", error_message is
74
// ignored and a Status object identical to Status::OK is
75
// constructed.
76
Status
(
error::Code
error_code,
StringPiece
error_message);
77
Status
(
const
Status
&);
78
Status
& operator=(
const
Status
&
x
);
79
~Status
() {}
80
81
// Some pre-defined Status objects
82
static
const
Status
OK
;
// Identical to 0-arg constructor
83
static
const
Status
CANCELLED
;
84
static
const
Status
UNKNOWN
;
85
86
// Accessor
87
bool
ok
()
const
{
88
return
error_code_ ==
error::OK
;
89
}
90
int
error_code
()
const
{
91
return
error_code_;
92
}
93
error::Code
code
()
const
{
94
return
error_code_;
95
}
96
StringPiece
error_message
()
const
{
97
return
error_message_;
98
}
99
StringPiece
message
()
const
{
100
return
error_message_;
101
}
102
103
bool
operator==
(
const
Status
&
x
)
const
;
104
bool
operator!=
(
const
Status
&
x
)
const
{
105
return
!
operator==
(
x
);
106
}
107
108
// Return a combination of the error code name and message.
109
string
ToString()
const
;
110
111
private
:
112
error::Code
error_code_
;
113
string
error_message_
;
114
};
115
116
// Prints a human-readable representation of 'x' to 'os'.
117
PROTOBUF_EXPORT std::ostream&
operator<<
(std::ostream& os,
const
Status
&
x
);
118
119
#define EXPECT_OK(value) EXPECT_TRUE((value).ok())
120
121
}
// namespace util
122
}
// namespace protobuf
123
}
// namespace google
124
125
#include <google/protobuf/port_undef.inc>
126
127
#endif // GOOGLE_PROTOBUF_STUBS_STATUS_H_
google::protobuf::util::Status::OK
static const Status OK
Definition:
status.h:82
google::protobuf::util::Status::error_code_
error::Code error_code_
Definition:
status.h:112
google::protobuf::util::error::RESOURCE_EXHAUSTED
@ RESOURCE_EXHAUSTED
Definition:
status.h:56
google::protobuf::util::operator<<
std::ostream & operator<<(std::ostream &os, const Status &x)
Definition:
status.cc:127
google::protobuf::util::Status::code
error::Code code() const
Definition:
status.h:93
google::protobuf::util::error::CANCELLED
@ CANCELLED
Definition:
status.h:48
google::protobuf::util::error::Code
Code
Definition:
status.h:46
google::protobuf::util::error::DEADLINE_EXCEEDED
@ DEADLINE_EXCEEDED
Definition:
status.h:51
google::protobuf::util::Status::error_message
StringPiece error_message() const
Definition:
status.h:96
x
GLint GLenum GLint x
Definition:
glcorearb.h:2834
google::protobuf::util::error::UNKNOWN
@ UNKNOWN
Definition:
status.h:49
error
Definition:
cJSON.c:88
google::protobuf::util::error::FAILED_PRECONDITION
@ FAILED_PRECONDITION
Definition:
status.h:57
google::protobuf::util::error::UNAVAILABLE
@ UNAVAILABLE
Definition:
status.h:62
stringpiece.h
google::protobuf::util::Status::error_message_
string error_message_
Definition:
status.h:113
google::protobuf::util::Status::UNKNOWN
static const Status UNKNOWN
Definition:
status.h:84
google::protobuf::StringPiece
Definition:
stringpiece.h:180
google::protobuf::util::error::DATA_LOSS
@ DATA_LOSS
Definition:
status.h:63
google::protobuf::util::Status::error_code
int error_code() const
Definition:
status.h:90
google::protobuf::util::error::OK
@ OK
Definition:
status.h:47
google::protobuf::util::error::NOT_FOUND
@ NOT_FOUND
Definition:
status.h:52
google::protobuf::util::error::INVALID_ARGUMENT
@ INVALID_ARGUMENT
Definition:
status.h:50
google::protobuf::util::Status::CANCELLED
static const Status CANCELLED
Definition:
status.h:83
google::protobuf::util::error::UNAUTHENTICATED
@ UNAUTHENTICATED
Definition:
status.h:55
aditof::Status
Status
Status of any operation that the TOF sdk performs.
Definition:
status_definitions.h:48
google::protobuf::util::error::INTERNAL
@ INTERNAL
Definition:
status.h:61
google::protobuf::util::Status::ok
bool ok() const
Definition:
status.h:87
common.h
google::protobuf::util::error::ABORTED
@ ABORTED
Definition:
status.h:58
google::protobuf::util::error::PERMISSION_DENIED
@ PERMISSION_DENIED
Definition:
status.h:54
google::protobuf::util::Status::message
StringPiece message() const
Definition:
status.h:99
google::protobuf::util::error::ALREADY_EXISTS
@ ALREADY_EXISTS
Definition:
status.h:53
google::protobuf::util::Status::operator!=
bool operator!=(const Status &x) const
Definition:
status.h:104
google::protobuf::operator==
bool operator==(const uint128 &lhs, const uint128 &rhs)
Definition:
int128.h:138
google::protobuf::util::Status
Definition:
status.h:67
google::protobuf::util::error::UNIMPLEMENTED
@ UNIMPLEMENTED
Definition:
status.h:60
google::protobuf::util::error::OUT_OF_RANGE
@ OUT_OF_RANGE
Definition:
status.h:59
google
Definition:
data_proto2_to_proto3_util.h:11
google::protobuf::util::Status::~Status
~Status()
Definition:
status.h:79
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:58