1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: icing/proto/document_wrapper.proto
3 
4 #include "icing/proto/document_wrapper.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 {
DocumentWrapper(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR DocumentWrapper::DocumentWrapper(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.document_)*/nullptr} {}
28 struct DocumentWrapperDefaultTypeInternal {
DocumentWrapperDefaultTypeInternalicing::lib::DocumentWrapperDefaultTypeInternal29   PROTOBUF_CONSTEXPR DocumentWrapperDefaultTypeInternal()
30       : _instance(::_pbi::ConstantInitialized{}) {}
~DocumentWrapperDefaultTypeInternalicing::lib::DocumentWrapperDefaultTypeInternal31   ~DocumentWrapperDefaultTypeInternal() {}
32   union {  // NOLINT(misc-non-private-member-variables-in-classes)
33     DocumentWrapper _instance;
34   };
35 };
36 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 DocumentWrapperDefaultTypeInternal _DocumentWrapper_default_instance_;
37 }  // namespace lib
38 }  // namespace icing
39 namespace icing {
40 namespace lib {
41 
42 // ===================================================================
43 
44 class DocumentWrapper::_Internal {
45  public:
46   using HasBits = decltype(std::declval<DocumentWrapper>()._impl_._has_bits_);
47   static const ::icing::lib::DocumentProto& document(const DocumentWrapper* msg);
set_has_document(HasBits * has_bits)48   static void set_has_document(HasBits* has_bits) {
49     (*has_bits)[0] |= 1u;
50   }
51 };
52 
53 const ::icing::lib::DocumentProto&
document(const DocumentWrapper * msg)54 DocumentWrapper::_Internal::document(const DocumentWrapper* msg) {
55   return *msg->_impl_.document_;
56 }
clear_document()57 void DocumentWrapper::clear_document() {
58   if (_impl_.document_ != nullptr) _impl_.document_->Clear();
59   _impl_._has_bits_[0] &= ~0x00000001u;
60 }
DocumentWrapper(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)61 DocumentWrapper::DocumentWrapper(::PROTOBUF_NAMESPACE_ID::Arena* arena,
62                          bool is_message_owned)
63   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
64   SharedCtor(arena, is_message_owned);
65   // @@protoc_insertion_point(arena_constructor:icing.lib.DocumentWrapper)
66 }
DocumentWrapper(const DocumentWrapper & from)67 DocumentWrapper::DocumentWrapper(const DocumentWrapper& from)
68   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
69   DocumentWrapper* const _this = this; (void)_this;
70   new (&_impl_) Impl_{
71       decltype(_impl_._has_bits_){from._impl_._has_bits_}
72     , /*decltype(_impl_._cached_size_)*/{}
73     , decltype(_impl_.document_){nullptr}};
74 
75   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
76   if (from._internal_has_document()) {
77     _this->_impl_.document_ = new ::icing::lib::DocumentProto(*from._impl_.document_);
78   }
79   // @@protoc_insertion_point(copy_constructor:icing.lib.DocumentWrapper)
80 }
81 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)82 inline void DocumentWrapper::SharedCtor(
83     ::_pb::Arena* arena, bool is_message_owned) {
84   (void)arena;
85   (void)is_message_owned;
86   new (&_impl_) Impl_{
87       decltype(_impl_._has_bits_){}
88     , /*decltype(_impl_._cached_size_)*/{}
89     , decltype(_impl_.document_){nullptr}
90   };
91 }
92 
~DocumentWrapper()93 DocumentWrapper::~DocumentWrapper() {
94   // @@protoc_insertion_point(destructor:icing.lib.DocumentWrapper)
95   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
96   (void)arena;
97     return;
98   }
99   SharedDtor();
100 }
101 
SharedDtor()102 inline void DocumentWrapper::SharedDtor() {
103   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
104   if (this != internal_default_instance()) delete _impl_.document_;
105 }
106 
SetCachedSize(int size) const107 void DocumentWrapper::SetCachedSize(int size) const {
108   _impl_._cached_size_.Set(size);
109 }
110 
Clear()111 void DocumentWrapper::Clear() {
112 // @@protoc_insertion_point(message_clear_start:icing.lib.DocumentWrapper)
113   ::uint32_t cached_has_bits = 0;
114   // Prevent compiler warnings about cached_has_bits being unused
115   (void) cached_has_bits;
116 
117   cached_has_bits = _impl_._has_bits_[0];
118   if (cached_has_bits & 0x00000001u) {
119     GOOGLE_DCHECK(_impl_.document_ != nullptr);
120     _impl_.document_->Clear();
121   }
122   _impl_._has_bits_.Clear();
123   _internal_metadata_.Clear<std::string>();
124 }
125 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)126 const char* DocumentWrapper::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
127 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
128   _Internal::HasBits has_bits{};
129   while (!ctx->Done(&ptr)) {
130     ::uint32_t tag;
131     ptr = ::_pbi::ReadTag(ptr, &tag);
132     switch (tag >> 3) {
133       // optional .icing.lib.DocumentProto document = 1;
134       case 1:
135         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 10)) {
136           ptr = ctx->ParseMessage(_internal_mutable_document(), ptr);
137           CHK_(ptr);
138         } else {
139           goto handle_unusual;
140         }
141         continue;
142       default:
143         goto handle_unusual;
144     }  // switch
145   handle_unusual:
146     if ((tag == 0) || ((tag & 7) == 4)) {
147       CHK_(ptr);
148       ctx->SetLastTag(tag);
149       goto message_done;
150     }
151     ptr = UnknownFieldParse(
152         tag,
153         _internal_metadata_.mutable_unknown_fields<std::string>(),
154         ptr, ctx);
155     CHK_(ptr != nullptr);
156   }  // while
157 message_done:
158   _impl_._has_bits_.Or(has_bits);
159   return ptr;
160 failure:
161   ptr = nullptr;
162   goto message_done;
163 #undef CHK_
164 }
165 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const166 ::uint8_t* DocumentWrapper::_InternalSerialize(
167     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
168   // @@protoc_insertion_point(serialize_to_array_start:icing.lib.DocumentWrapper)
169   ::uint32_t cached_has_bits = 0;
170   (void) cached_has_bits;
171 
172   cached_has_bits = _impl_._has_bits_[0];
173   // optional .icing.lib.DocumentProto document = 1;
174   if (cached_has_bits & 0x00000001u) {
175     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
176       InternalWriteMessage(1, _Internal::document(this),
177         _Internal::document(this).GetCachedSize(), target, stream);
178   }
179 
180   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
181     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
182         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
183   }
184   // @@protoc_insertion_point(serialize_to_array_end:icing.lib.DocumentWrapper)
185   return target;
186 }
187 
ByteSizeLong() const188 size_t DocumentWrapper::ByteSizeLong() const {
189 // @@protoc_insertion_point(message_byte_size_start:icing.lib.DocumentWrapper)
190   size_t total_size = 0;
191 
192   ::uint32_t cached_has_bits = 0;
193   // Prevent compiler warnings about cached_has_bits being unused
194   (void) cached_has_bits;
195 
196   // optional .icing.lib.DocumentProto document = 1;
197   cached_has_bits = _impl_._has_bits_[0];
198   if (cached_has_bits & 0x00000001u) {
199     total_size += 1 +
200       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
201         *_impl_.document_);
202   }
203 
204   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
205     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
206   }
207   int cached_size = ::_pbi::ToCachedSize(total_size);
208   SetCachedSize(cached_size);
209   return total_size;
210 }
211 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)212 void DocumentWrapper::CheckTypeAndMergeFrom(
213     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
214   MergeFrom(*::_pbi::DownCast<const DocumentWrapper*>(
215       &from));
216 }
217 
MergeFrom(const DocumentWrapper & from)218 void DocumentWrapper::MergeFrom(const DocumentWrapper& from) {
219   DocumentWrapper* const _this = this;
220   // @@protoc_insertion_point(class_specific_merge_from_start:icing.lib.DocumentWrapper)
221   GOOGLE_DCHECK_NE(&from, _this);
222   ::uint32_t cached_has_bits = 0;
223   (void) cached_has_bits;
224 
225   if (from._internal_has_document()) {
226     _this->_internal_mutable_document()->::icing::lib::DocumentProto::MergeFrom(
227         from._internal_document());
228   }
229   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
230 }
231 
CopyFrom(const DocumentWrapper & from)232 void DocumentWrapper::CopyFrom(const DocumentWrapper& from) {
233 // @@protoc_insertion_point(class_specific_copy_from_start:icing.lib.DocumentWrapper)
234   if (&from == this) return;
235   Clear();
236   MergeFrom(from);
237 }
238 
IsInitialized() const239 bool DocumentWrapper::IsInitialized() const {
240   return true;
241 }
242 
InternalSwap(DocumentWrapper * other)243 void DocumentWrapper::InternalSwap(DocumentWrapper* other) {
244   using std::swap;
245   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
246   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
247   swap(_impl_.document_, other->_impl_.document_);
248 }
249 
GetTypeName() const250 std::string DocumentWrapper::GetTypeName() const {
251   return "icing.lib.DocumentWrapper";
252 }
253 
254 
255 // @@protoc_insertion_point(namespace_scope)
256 }  // namespace lib
257 }  // namespace icing
258 PROTOBUF_NAMESPACE_OPEN
259 template<> PROTOBUF_NOINLINE ::icing::lib::DocumentWrapper*
CreateMaybeMessage(Arena * arena)260 Arena::CreateMaybeMessage< ::icing::lib::DocumentWrapper >(Arena* arena) {
261   return Arena::CreateMessageInternal< ::icing::lib::DocumentWrapper >(arena);
262 }
263 PROTOBUF_NAMESPACE_CLOSE
264 
265 // @@protoc_insertion_point(global_scope)
266 #include <google/protobuf/port_undef.inc>
267