1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: user_demographics.proto
3 
4 #include "user_demographics.pb.h"
5 
6 #include <algorithm>
7 
8 #include <google/protobuf/io/coded_stream.h>
9 #include <google/protobuf/extension_set.h>
10 #include <google/protobuf/wire_format_lite.h>
11 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
12 // @@protoc_insertion_point(includes)
13 #include <google/protobuf/port_def.inc>
14 
15 PROTOBUF_PRAGMA_INIT_SEG
16 
17 namespace _pb = ::PROTOBUF_NAMESPACE_ID;
18 namespace _pbi = _pb::internal;
19 
20 namespace metrics {
UserDemographicsProto(::_pbi::ConstantInitialized)21 PROTOBUF_CONSTEXPR UserDemographicsProto::UserDemographicsProto(
22     ::_pbi::ConstantInitialized): _impl_{
23     /*decltype(_impl_._has_bits_)*/{}
24   , /*decltype(_impl_._cached_size_)*/{}
25   , /*decltype(_impl_.birth_year_)*/0
26   , /*decltype(_impl_.gender_)*/0} {}
27 struct UserDemographicsProtoDefaultTypeInternal {
UserDemographicsProtoDefaultTypeInternalmetrics::UserDemographicsProtoDefaultTypeInternal28   PROTOBUF_CONSTEXPR UserDemographicsProtoDefaultTypeInternal()
29       : _instance(::_pbi::ConstantInitialized{}) {}
~UserDemographicsProtoDefaultTypeInternalmetrics::UserDemographicsProtoDefaultTypeInternal30   ~UserDemographicsProtoDefaultTypeInternal() {}
31   union {
32     UserDemographicsProto _instance;
33   };
34 };
35 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UserDemographicsProtoDefaultTypeInternal _UserDemographicsProto_default_instance_;
36 }  // namespace metrics
37 namespace metrics {
UserDemographicsProto_Gender_IsValid(int value)38 bool UserDemographicsProto_Gender_IsValid(int value) {
39   switch (value) {
40     case 0:
41     case 1:
42     case 2:
43     case 3:
44       return true;
45     default:
46       return false;
47   }
48 }
49 
50 static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> UserDemographicsProto_Gender_strings[4] = {};
51 
52 static const char UserDemographicsProto_Gender_names[] =
53   "GENDER_CUSTOM_OR_OTHER"
54   "GENDER_FEMALE"
55   "GENDER_MALE"
56   "GENDER_UNKNOWN";
57 
58 static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry UserDemographicsProto_Gender_entries[] = {
59   { {UserDemographicsProto_Gender_names + 0, 22}, 3 },
60   { {UserDemographicsProto_Gender_names + 22, 13}, 2 },
61   { {UserDemographicsProto_Gender_names + 35, 11}, 1 },
62   { {UserDemographicsProto_Gender_names + 46, 14}, 0 },
63 };
64 
65 static const int UserDemographicsProto_Gender_entries_by_number[] = {
66   3, // 0 -> GENDER_UNKNOWN
67   2, // 1 -> GENDER_MALE
68   1, // 2 -> GENDER_FEMALE
69   0, // 3 -> GENDER_CUSTOM_OR_OTHER
70 };
71 
UserDemographicsProto_Gender_Name(UserDemographicsProto_Gender value)72 const std::string& UserDemographicsProto_Gender_Name(
73     UserDemographicsProto_Gender value) {
74   static const bool dummy =
75       ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
76           UserDemographicsProto_Gender_entries,
77           UserDemographicsProto_Gender_entries_by_number,
78           4, UserDemographicsProto_Gender_strings);
79   (void) dummy;
80   int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
81       UserDemographicsProto_Gender_entries,
82       UserDemographicsProto_Gender_entries_by_number,
83       4, value);
84   return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
85                      UserDemographicsProto_Gender_strings[idx].get();
86 }
UserDemographicsProto_Gender_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,UserDemographicsProto_Gender * value)87 bool UserDemographicsProto_Gender_Parse(
88     ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, UserDemographicsProto_Gender* value) {
89   int int_value;
90   bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
91       UserDemographicsProto_Gender_entries, 4, name, &int_value);
92   if (success) {
93     *value = static_cast<UserDemographicsProto_Gender>(int_value);
94   }
95   return success;
96 }
97 #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
98 constexpr UserDemographicsProto_Gender UserDemographicsProto::GENDER_UNKNOWN;
99 constexpr UserDemographicsProto_Gender UserDemographicsProto::GENDER_MALE;
100 constexpr UserDemographicsProto_Gender UserDemographicsProto::GENDER_FEMALE;
101 constexpr UserDemographicsProto_Gender UserDemographicsProto::GENDER_CUSTOM_OR_OTHER;
102 constexpr UserDemographicsProto_Gender UserDemographicsProto::Gender_MIN;
103 constexpr UserDemographicsProto_Gender UserDemographicsProto::Gender_MAX;
104 constexpr int UserDemographicsProto::Gender_ARRAYSIZE;
105 #endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
106 
107 // ===================================================================
108 
109 class UserDemographicsProto::_Internal {
110  public:
111   using HasBits = decltype(std::declval<UserDemographicsProto>()._impl_._has_bits_);
set_has_birth_year(HasBits * has_bits)112   static void set_has_birth_year(HasBits* has_bits) {
113     (*has_bits)[0] |= 1u;
114   }
set_has_gender(HasBits * has_bits)115   static void set_has_gender(HasBits* has_bits) {
116     (*has_bits)[0] |= 2u;
117   }
118 };
119 
UserDemographicsProto(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)120 UserDemographicsProto::UserDemographicsProto(::PROTOBUF_NAMESPACE_ID::Arena* arena,
121                          bool is_message_owned)
122   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
123   SharedCtor(arena, is_message_owned);
124   // @@protoc_insertion_point(arena_constructor:metrics.UserDemographicsProto)
125 }
UserDemographicsProto(const UserDemographicsProto & from)126 UserDemographicsProto::UserDemographicsProto(const UserDemographicsProto& from)
127   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
128   UserDemographicsProto* const _this = this; (void)_this;
129   new (&_impl_) Impl_{
130       decltype(_impl_._has_bits_){from._impl_._has_bits_}
131     , /*decltype(_impl_._cached_size_)*/{}
132     , decltype(_impl_.birth_year_){}
133     , decltype(_impl_.gender_){}};
134 
135   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
136   ::memcpy(&_impl_.birth_year_, &from._impl_.birth_year_,
137     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.gender_) -
138     reinterpret_cast<char*>(&_impl_.birth_year_)) + sizeof(_impl_.gender_));
139   // @@protoc_insertion_point(copy_constructor:metrics.UserDemographicsProto)
140 }
141 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)142 inline void UserDemographicsProto::SharedCtor(
143     ::_pb::Arena* arena, bool is_message_owned) {
144   (void)arena;
145   (void)is_message_owned;
146   new (&_impl_) Impl_{
147       decltype(_impl_._has_bits_){}
148     , /*decltype(_impl_._cached_size_)*/{}
149     , decltype(_impl_.birth_year_){0}
150     , decltype(_impl_.gender_){0}
151   };
152 }
153 
~UserDemographicsProto()154 UserDemographicsProto::~UserDemographicsProto() {
155   // @@protoc_insertion_point(destructor:metrics.UserDemographicsProto)
156   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
157   (void)arena;
158     return;
159   }
160   SharedDtor();
161 }
162 
SharedDtor()163 inline void UserDemographicsProto::SharedDtor() {
164   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
165 }
166 
SetCachedSize(int size) const167 void UserDemographicsProto::SetCachedSize(int size) const {
168   _impl_._cached_size_.Set(size);
169 }
170 
Clear()171 void UserDemographicsProto::Clear() {
172 // @@protoc_insertion_point(message_clear_start:metrics.UserDemographicsProto)
173   uint32_t cached_has_bits = 0;
174   // Prevent compiler warnings about cached_has_bits being unused
175   (void) cached_has_bits;
176 
177   cached_has_bits = _impl_._has_bits_[0];
178   if (cached_has_bits & 0x00000003u) {
179     ::memset(&_impl_.birth_year_, 0, static_cast<size_t>(
180         reinterpret_cast<char*>(&_impl_.gender_) -
181         reinterpret_cast<char*>(&_impl_.birth_year_)) + sizeof(_impl_.gender_));
182   }
183   _impl_._has_bits_.Clear();
184   _internal_metadata_.Clear<std::string>();
185 }
186 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)187 const char* UserDemographicsProto::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
188 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
189   _Internal::HasBits has_bits{};
190   while (!ctx->Done(&ptr)) {
191     uint32_t tag;
192     ptr = ::_pbi::ReadTag(ptr, &tag);
193     switch (tag >> 3) {
194       // optional int32 birth_year = 1;
195       case 1:
196         if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
197           _Internal::set_has_birth_year(&has_bits);
198           _impl_.birth_year_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
199           CHK_(ptr);
200         } else
201           goto handle_unusual;
202         continue;
203       // optional .metrics.UserDemographicsProto.Gender gender = 2;
204       case 2:
205         if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
206           uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
207           CHK_(ptr);
208           if (PROTOBUF_PREDICT_TRUE(::metrics::UserDemographicsProto_Gender_IsValid(val))) {
209             _internal_set_gender(static_cast<::metrics::UserDemographicsProto_Gender>(val));
210           } else {
211             ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields());
212           }
213         } else
214           goto handle_unusual;
215         continue;
216       default:
217         goto handle_unusual;
218     }  // switch
219   handle_unusual:
220     if ((tag == 0) || ((tag & 7) == 4)) {
221       CHK_(ptr);
222       ctx->SetLastTag(tag);
223       goto message_done;
224     }
225     ptr = UnknownFieldParse(
226         tag,
227         _internal_metadata_.mutable_unknown_fields<std::string>(),
228         ptr, ctx);
229     CHK_(ptr != nullptr);
230   }  // while
231 message_done:
232   _impl_._has_bits_.Or(has_bits);
233   return ptr;
234 failure:
235   ptr = nullptr;
236   goto message_done;
237 #undef CHK_
238 }
239 
_InternalSerialize(uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const240 uint8_t* UserDemographicsProto::_InternalSerialize(
241     uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
242   // @@protoc_insertion_point(serialize_to_array_start:metrics.UserDemographicsProto)
243   uint32_t cached_has_bits = 0;
244   (void) cached_has_bits;
245 
246   cached_has_bits = _impl_._has_bits_[0];
247   // optional int32 birth_year = 1;
248   if (cached_has_bits & 0x00000001u) {
249     target = stream->EnsureSpace(target);
250     target = ::_pbi::WireFormatLite::WriteInt32ToArray(1, this->_internal_birth_year(), target);
251   }
252 
253   // optional .metrics.UserDemographicsProto.Gender gender = 2;
254   if (cached_has_bits & 0x00000002u) {
255     target = stream->EnsureSpace(target);
256     target = ::_pbi::WireFormatLite::WriteEnumToArray(
257       2, this->_internal_gender(), target);
258   }
259 
260   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
261     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
262         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
263   }
264   // @@protoc_insertion_point(serialize_to_array_end:metrics.UserDemographicsProto)
265   return target;
266 }
267 
ByteSizeLong() const268 size_t UserDemographicsProto::ByteSizeLong() const {
269 // @@protoc_insertion_point(message_byte_size_start:metrics.UserDemographicsProto)
270   size_t total_size = 0;
271 
272   uint32_t cached_has_bits = 0;
273   // Prevent compiler warnings about cached_has_bits being unused
274   (void) cached_has_bits;
275 
276   cached_has_bits = _impl_._has_bits_[0];
277   if (cached_has_bits & 0x00000003u) {
278     // optional int32 birth_year = 1;
279     if (cached_has_bits & 0x00000001u) {
280       total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_birth_year());
281     }
282 
283     // optional .metrics.UserDemographicsProto.Gender gender = 2;
284     if (cached_has_bits & 0x00000002u) {
285       total_size += 1 +
286         ::_pbi::WireFormatLite::EnumSize(this->_internal_gender());
287     }
288 
289   }
290   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
291     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
292   }
293   int cached_size = ::_pbi::ToCachedSize(total_size);
294   SetCachedSize(cached_size);
295   return total_size;
296 }
297 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)298 void UserDemographicsProto::CheckTypeAndMergeFrom(
299     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
300   MergeFrom(*::_pbi::DownCast<const UserDemographicsProto*>(
301       &from));
302 }
303 
MergeFrom(const UserDemographicsProto & from)304 void UserDemographicsProto::MergeFrom(const UserDemographicsProto& from) {
305   UserDemographicsProto* const _this = this;
306   // @@protoc_insertion_point(class_specific_merge_from_start:metrics.UserDemographicsProto)
307   GOOGLE_DCHECK_NE(&from, _this);
308   uint32_t cached_has_bits = 0;
309   (void) cached_has_bits;
310 
311   cached_has_bits = from._impl_._has_bits_[0];
312   if (cached_has_bits & 0x00000003u) {
313     if (cached_has_bits & 0x00000001u) {
314       _this->_impl_.birth_year_ = from._impl_.birth_year_;
315     }
316     if (cached_has_bits & 0x00000002u) {
317       _this->_impl_.gender_ = from._impl_.gender_;
318     }
319     _this->_impl_._has_bits_[0] |= cached_has_bits;
320   }
321   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
322 }
323 
CopyFrom(const UserDemographicsProto & from)324 void UserDemographicsProto::CopyFrom(const UserDemographicsProto& from) {
325 // @@protoc_insertion_point(class_specific_copy_from_start:metrics.UserDemographicsProto)
326   if (&from == this) return;
327   Clear();
328   MergeFrom(from);
329 }
330 
IsInitialized() const331 bool UserDemographicsProto::IsInitialized() const {
332   return true;
333 }
334 
InternalSwap(UserDemographicsProto * other)335 void UserDemographicsProto::InternalSwap(UserDemographicsProto* other) {
336   using std::swap;
337   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
338   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
339   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
340       PROTOBUF_FIELD_OFFSET(UserDemographicsProto, _impl_.gender_)
341       + sizeof(UserDemographicsProto::_impl_.gender_)
342       - PROTOBUF_FIELD_OFFSET(UserDemographicsProto, _impl_.birth_year_)>(
343           reinterpret_cast<char*>(&_impl_.birth_year_),
344           reinterpret_cast<char*>(&other->_impl_.birth_year_));
345 }
346 
GetTypeName() const347 std::string UserDemographicsProto::GetTypeName() const {
348   return "metrics.UserDemographicsProto";
349 }
350 
351 
352 // @@protoc_insertion_point(namespace_scope)
353 }  // namespace metrics
354 PROTOBUF_NAMESPACE_OPEN
355 template<> PROTOBUF_NOINLINE ::metrics::UserDemographicsProto*
CreateMaybeMessage(Arena * arena)356 Arena::CreateMaybeMessage< ::metrics::UserDemographicsProto >(Arena* arena) {
357   return Arena::CreateMessageInternal< ::metrics::UserDemographicsProto >(arena);
358 }
359 PROTOBUF_NAMESPACE_CLOSE
360 
361 // @@protoc_insertion_point(global_scope)
362 #include <google/protobuf/port_undef.inc>
363