1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: icing/proto/status.proto
3 
4 #include "icing/proto/status.pb.h"
5 
6 #include <algorithm>
7 #include <cstdint>
8 
9 #include <google/protobuf/io/coded_stream.h>
10 #include <google/protobuf/extension_set.h>
11 #include <google/protobuf/wire_format_lite.h>
12 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
13 // @@protoc_insertion_point(includes)
14 #include <google/protobuf/port_def.inc>
15 
16 PROTOBUF_PRAGMA_INIT_SEG
17 
18 namespace _pb = ::PROTOBUF_NAMESPACE_ID;
19 namespace _pbi = _pb::internal;
20 
21 namespace icing {
22 namespace lib {
StatusProto(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR StatusProto::StatusProto(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.message_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
28   , /*decltype(_impl_.code_)*/0} {}
29 struct StatusProtoDefaultTypeInternal {
StatusProtoDefaultTypeInternalicing::lib::StatusProtoDefaultTypeInternal30   PROTOBUF_CONSTEXPR StatusProtoDefaultTypeInternal()
31       : _instance(::_pbi::ConstantInitialized{}) {}
~StatusProtoDefaultTypeInternalicing::lib::StatusProtoDefaultTypeInternal32   ~StatusProtoDefaultTypeInternal() {}
33   union {  // NOLINT(misc-non-private-member-variables-in-classes)
34     StatusProto _instance;
35   };
36 };
37 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StatusProtoDefaultTypeInternal _StatusProto_default_instance_;
38 }  // namespace lib
39 }  // namespace icing
40 namespace icing {
41 namespace lib {
StatusProto_Code_IsValid(int value)42 bool StatusProto_Code_IsValid(int value) {
43   switch (value) {
44     case 0:
45     case 1:
46     case 2:
47     case 3:
48     case 4:
49     case 5:
50     case 6:
51     case 7:
52     case 8:
53     case 9:
54       return true;
55     default:
56       return false;
57   }
58 }
59 
60 static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> StatusProto_Code_strings[10] = {};
61 
62 static const char StatusProto_Code_names[] =
63   "ABORTED"
64   "ALREADY_EXISTS"
65   "FAILED_PRECONDITION"
66   "INTERNAL"
67   "INVALID_ARGUMENT"
68   "NOT_FOUND"
69   "OK"
70   "OUT_OF_SPACE"
71   "UNKNOWN"
72   "WARNING_DATA_LOSS";
73 
74 static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry StatusProto_Code_entries[] = {
75   { {StatusProto_Code_names + 0, 7}, 6 },
76   { {StatusProto_Code_names + 7, 14}, 9 },
77   { {StatusProto_Code_names + 21, 19}, 5 },
78   { {StatusProto_Code_names + 40, 8}, 7 },
79   { {StatusProto_Code_names + 48, 16}, 3 },
80   { {StatusProto_Code_names + 64, 9}, 4 },
81   { {StatusProto_Code_names + 73, 2}, 1 },
82   { {StatusProto_Code_names + 75, 12}, 8 },
83   { {StatusProto_Code_names + 87, 7}, 0 },
84   { {StatusProto_Code_names + 94, 17}, 2 },
85 };
86 
87 static const int StatusProto_Code_entries_by_number[] = {
88   8, // 0 -> UNKNOWN
89   6, // 1 -> OK
90   9, // 2 -> WARNING_DATA_LOSS
91   4, // 3 -> INVALID_ARGUMENT
92   5, // 4 -> NOT_FOUND
93   2, // 5 -> FAILED_PRECONDITION
94   0, // 6 -> ABORTED
95   3, // 7 -> INTERNAL
96   7, // 8 -> OUT_OF_SPACE
97   1, // 9 -> ALREADY_EXISTS
98 };
99 
StatusProto_Code_Name(StatusProto_Code value)100 const std::string& StatusProto_Code_Name(
101     StatusProto_Code value) {
102   static const bool dummy =
103       ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
104           StatusProto_Code_entries,
105           StatusProto_Code_entries_by_number,
106           10, StatusProto_Code_strings);
107   (void) dummy;
108   int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
109       StatusProto_Code_entries,
110       StatusProto_Code_entries_by_number,
111       10, value);
112   return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
113                      StatusProto_Code_strings[idx].get();
114 }
StatusProto_Code_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,StatusProto_Code * value)115 bool StatusProto_Code_Parse(
116     ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, StatusProto_Code* value) {
117   int int_value;
118   bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
119       StatusProto_Code_entries, 10, name, &int_value);
120   if (success) {
121     *value = static_cast<StatusProto_Code>(int_value);
122   }
123   return success;
124 }
125 #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
126 constexpr StatusProto_Code StatusProto::UNKNOWN;
127 constexpr StatusProto_Code StatusProto::OK;
128 constexpr StatusProto_Code StatusProto::WARNING_DATA_LOSS;
129 constexpr StatusProto_Code StatusProto::INVALID_ARGUMENT;
130 constexpr StatusProto_Code StatusProto::NOT_FOUND;
131 constexpr StatusProto_Code StatusProto::FAILED_PRECONDITION;
132 constexpr StatusProto_Code StatusProto::ABORTED;
133 constexpr StatusProto_Code StatusProto::INTERNAL;
134 constexpr StatusProto_Code StatusProto::OUT_OF_SPACE;
135 constexpr StatusProto_Code StatusProto::ALREADY_EXISTS;
136 constexpr StatusProto_Code StatusProto::Code_MIN;
137 constexpr StatusProto_Code StatusProto::Code_MAX;
138 constexpr int StatusProto::Code_ARRAYSIZE;
139 #endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
140 
141 // ===================================================================
142 
143 class StatusProto::_Internal {
144  public:
145   using HasBits = decltype(std::declval<StatusProto>()._impl_._has_bits_);
set_has_code(HasBits * has_bits)146   static void set_has_code(HasBits* has_bits) {
147     (*has_bits)[0] |= 2u;
148   }
set_has_message(HasBits * has_bits)149   static void set_has_message(HasBits* has_bits) {
150     (*has_bits)[0] |= 1u;
151   }
152 };
153 
StatusProto(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)154 StatusProto::StatusProto(::PROTOBUF_NAMESPACE_ID::Arena* arena,
155                          bool is_message_owned)
156   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
157   SharedCtor(arena, is_message_owned);
158   // @@protoc_insertion_point(arena_constructor:icing.lib.StatusProto)
159 }
StatusProto(const StatusProto & from)160 StatusProto::StatusProto(const StatusProto& from)
161   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
162   StatusProto* const _this = this; (void)_this;
163   new (&_impl_) Impl_{
164       decltype(_impl_._has_bits_){from._impl_._has_bits_}
165     , /*decltype(_impl_._cached_size_)*/{}
166     , decltype(_impl_.message_){}
167     , decltype(_impl_.code_){}};
168 
169   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
170   _impl_.message_.InitDefault();
171   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
172     _impl_.message_.Set("", GetArenaForAllocation());
173   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
174   if (from._internal_has_message()) {
175     _this->_impl_.message_.Set(from._internal_message(),
176       _this->GetArenaForAllocation());
177   }
178   _this->_impl_.code_ = from._impl_.code_;
179   // @@protoc_insertion_point(copy_constructor:icing.lib.StatusProto)
180 }
181 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)182 inline void StatusProto::SharedCtor(
183     ::_pb::Arena* arena, bool is_message_owned) {
184   (void)arena;
185   (void)is_message_owned;
186   new (&_impl_) Impl_{
187       decltype(_impl_._has_bits_){}
188     , /*decltype(_impl_._cached_size_)*/{}
189     , decltype(_impl_.message_){}
190     , decltype(_impl_.code_){0}
191   };
192   _impl_.message_.InitDefault();
193   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
194     _impl_.message_.Set("", GetArenaForAllocation());
195   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
196 }
197 
~StatusProto()198 StatusProto::~StatusProto() {
199   // @@protoc_insertion_point(destructor:icing.lib.StatusProto)
200   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
201   (void)arena;
202     return;
203   }
204   SharedDtor();
205 }
206 
SharedDtor()207 inline void StatusProto::SharedDtor() {
208   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
209   _impl_.message_.Destroy();
210 }
211 
SetCachedSize(int size) const212 void StatusProto::SetCachedSize(int size) const {
213   _impl_._cached_size_.Set(size);
214 }
215 
Clear()216 void StatusProto::Clear() {
217 // @@protoc_insertion_point(message_clear_start:icing.lib.StatusProto)
218   ::uint32_t cached_has_bits = 0;
219   // Prevent compiler warnings about cached_has_bits being unused
220   (void) cached_has_bits;
221 
222   cached_has_bits = _impl_._has_bits_[0];
223   if (cached_has_bits & 0x00000001u) {
224     _impl_.message_.ClearNonDefaultToEmpty();
225   }
226   _impl_.code_ = 0;
227   _impl_._has_bits_.Clear();
228   _internal_metadata_.Clear<std::string>();
229 }
230 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)231 const char* StatusProto::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
232 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
233   _Internal::HasBits has_bits{};
234   while (!ctx->Done(&ptr)) {
235     ::uint32_t tag;
236     ptr = ::_pbi::ReadTag(ptr, &tag);
237     switch (tag >> 3) {
238       // optional .icing.lib.StatusProto.Code code = 1;
239       case 1:
240         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
241           ::uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
242           CHK_(ptr);
243           if (PROTOBUF_PREDICT_TRUE(::icing::lib::StatusProto_Code_IsValid(val))) {
244             _internal_set_code(static_cast<::icing::lib::StatusProto_Code>(val));
245           } else {
246             ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields());
247           }
248         } else {
249           goto handle_unusual;
250         }
251         continue;
252       // optional string message = 2;
253       case 2:
254         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 18)) {
255           auto str = _internal_mutable_message();
256           ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
257           CHK_(ptr);
258         } else {
259           goto handle_unusual;
260         }
261         continue;
262       default:
263         goto handle_unusual;
264     }  // switch
265   handle_unusual:
266     if ((tag == 0) || ((tag & 7) == 4)) {
267       CHK_(ptr);
268       ctx->SetLastTag(tag);
269       goto message_done;
270     }
271     ptr = UnknownFieldParse(
272         tag,
273         _internal_metadata_.mutable_unknown_fields<std::string>(),
274         ptr, ctx);
275     CHK_(ptr != nullptr);
276   }  // while
277 message_done:
278   _impl_._has_bits_.Or(has_bits);
279   return ptr;
280 failure:
281   ptr = nullptr;
282   goto message_done;
283 #undef CHK_
284 }
285 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const286 ::uint8_t* StatusProto::_InternalSerialize(
287     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
288   // @@protoc_insertion_point(serialize_to_array_start:icing.lib.StatusProto)
289   ::uint32_t cached_has_bits = 0;
290   (void) cached_has_bits;
291 
292   cached_has_bits = _impl_._has_bits_[0];
293   // optional .icing.lib.StatusProto.Code code = 1;
294   if (cached_has_bits & 0x00000002u) {
295     target = stream->EnsureSpace(target);
296     target = ::_pbi::WireFormatLite::WriteEnumToArray(
297       1, this->_internal_code(), target);
298   }
299 
300   // optional string message = 2;
301   if (cached_has_bits & 0x00000001u) {
302     target = stream->WriteStringMaybeAliased(
303         2, this->_internal_message(), target);
304   }
305 
306   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
307     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
308         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
309   }
310   // @@protoc_insertion_point(serialize_to_array_end:icing.lib.StatusProto)
311   return target;
312 }
313 
ByteSizeLong() const314 size_t StatusProto::ByteSizeLong() const {
315 // @@protoc_insertion_point(message_byte_size_start:icing.lib.StatusProto)
316   size_t total_size = 0;
317 
318   ::uint32_t cached_has_bits = 0;
319   // Prevent compiler warnings about cached_has_bits being unused
320   (void) cached_has_bits;
321 
322   cached_has_bits = _impl_._has_bits_[0];
323   if (cached_has_bits & 0x00000003u) {
324     // optional string message = 2;
325     if (cached_has_bits & 0x00000001u) {
326       total_size += 1 +
327         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
328           this->_internal_message());
329     }
330 
331     // optional .icing.lib.StatusProto.Code code = 1;
332     if (cached_has_bits & 0x00000002u) {
333       total_size += 1 +
334         ::_pbi::WireFormatLite::EnumSize(this->_internal_code());
335     }
336 
337   }
338   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
339     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
340   }
341   int cached_size = ::_pbi::ToCachedSize(total_size);
342   SetCachedSize(cached_size);
343   return total_size;
344 }
345 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)346 void StatusProto::CheckTypeAndMergeFrom(
347     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
348   MergeFrom(*::_pbi::DownCast<const StatusProto*>(
349       &from));
350 }
351 
MergeFrom(const StatusProto & from)352 void StatusProto::MergeFrom(const StatusProto& from) {
353   StatusProto* const _this = this;
354   // @@protoc_insertion_point(class_specific_merge_from_start:icing.lib.StatusProto)
355   GOOGLE_DCHECK_NE(&from, _this);
356   ::uint32_t cached_has_bits = 0;
357   (void) cached_has_bits;
358 
359   cached_has_bits = from._impl_._has_bits_[0];
360   if (cached_has_bits & 0x00000003u) {
361     if (cached_has_bits & 0x00000001u) {
362       _this->_internal_set_message(from._internal_message());
363     }
364     if (cached_has_bits & 0x00000002u) {
365       _this->_impl_.code_ = from._impl_.code_;
366     }
367     _this->_impl_._has_bits_[0] |= cached_has_bits;
368   }
369   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
370 }
371 
CopyFrom(const StatusProto & from)372 void StatusProto::CopyFrom(const StatusProto& from) {
373 // @@protoc_insertion_point(class_specific_copy_from_start:icing.lib.StatusProto)
374   if (&from == this) return;
375   Clear();
376   MergeFrom(from);
377 }
378 
IsInitialized() const379 bool StatusProto::IsInitialized() const {
380   return true;
381 }
382 
InternalSwap(StatusProto * other)383 void StatusProto::InternalSwap(StatusProto* other) {
384   using std::swap;
385   auto* lhs_arena = GetArenaForAllocation();
386   auto* rhs_arena = other->GetArenaForAllocation();
387   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
388   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
389   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
390       &_impl_.message_, lhs_arena,
391       &other->_impl_.message_, rhs_arena
392   );
393   swap(_impl_.code_, other->_impl_.code_);
394 }
395 
GetTypeName() const396 std::string StatusProto::GetTypeName() const {
397   return "icing.lib.StatusProto";
398 }
399 
400 
401 // @@protoc_insertion_point(namespace_scope)
402 }  // namespace lib
403 }  // namespace icing
404 PROTOBUF_NAMESPACE_OPEN
405 template<> PROTOBUF_NOINLINE ::icing::lib::StatusProto*
CreateMaybeMessage(Arena * arena)406 Arena::CreateMaybeMessage< ::icing::lib::StatusProto >(Arena* arena) {
407   return Arena::CreateMessageInternal< ::icing::lib::StatusProto >(arena);
408 }
409 PROTOBUF_NAMESPACE_CLOSE
410 
411 // @@protoc_insertion_point(global_scope)
412 #include <google/protobuf/port_undef.inc>
413