• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: google/protobuf/duration.proto
3 
4 #include <google/protobuf/duration.pb.h>
5 
6 #include <algorithm>
7 
8 #include <google/protobuf/stubs/common.h>
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/descriptor.h>
13 #include <google/protobuf/generated_message_reflection.h>
14 #include <google/protobuf/reflection_ops.h>
15 #include <google/protobuf/wire_format.h>
16 // @@protoc_insertion_point(includes)
17 #include <google/protobuf/port_def.inc>
18 PROTOBUF_NAMESPACE_OPEN
19 class DurationDefaultTypeInternal {
20  public:
21   ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<Duration> _instance;
22 } _Duration_default_instance_;
23 PROTOBUF_NAMESPACE_CLOSE
InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto()24 static void InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto() {
25   GOOGLE_PROTOBUF_VERIFY_VERSION;
26 
27   {
28     void* ptr = &PROTOBUF_NAMESPACE_ID::_Duration_default_instance_;
29     new (ptr) PROTOBUF_NAMESPACE_ID::Duration();
30     ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
31   }
32   PROTOBUF_NAMESPACE_ID::Duration::InitAsDefaultInstance();
33 }
34 
35 PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Duration_google_2fprotobuf_2fduration_2eproto =
36     {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto}, {}};
37 
38 static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fduration_2eproto[1];
39 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
40 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
41 
42 const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
43   ~0u,  // no _has_bits_
44   PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, _internal_metadata_),
45   ~0u,  // no _extensions_
46   ~0u,  // no _oneof_case_
47   ~0u,  // no _weak_field_map_
48   PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, seconds_),
49   PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, nanos_),
50 };
51 static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
52   { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Duration)},
53 };
54 
55 static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
56   reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Duration_default_instance_),
57 };
58 
59 const char descriptor_table_protodef_google_2fprotobuf_2fduration_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
60   "\n\036google/protobuf/duration.proto\022\017google"
61   ".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r"
62   "\n\005nanos\030\002 \001(\005B|\n\023com.google.protobufB\rDu"
63   "rationProtoP\001Z*github.com/golang/protobu"
64   "f/ptypes/duration\370\001\001\242\002\003GPB\252\002\036Google.Prot"
65   "obuf.WellKnownTypesb\006proto3"
66   ;
67 static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_google_2fprotobuf_2fduration_2eproto_deps[1] = {
68 };
69 static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_google_2fprotobuf_2fduration_2eproto_sccs[1] = {
70   &scc_info_Duration_google_2fprotobuf_2fduration_2eproto.base,
71 };
72 static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_google_2fprotobuf_2fduration_2eproto_once;
73 static bool descriptor_table_google_2fprotobuf_2fduration_2eproto_initialized = false;
74 const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto = {
75   &descriptor_table_google_2fprotobuf_2fduration_2eproto_initialized, descriptor_table_protodef_google_2fprotobuf_2fduration_2eproto, "google/protobuf/duration.proto", 227,
76   &descriptor_table_google_2fprotobuf_2fduration_2eproto_once, descriptor_table_google_2fprotobuf_2fduration_2eproto_sccs, descriptor_table_google_2fprotobuf_2fduration_2eproto_deps, 1, 0,
77   schemas, file_default_instances, TableStruct_google_2fprotobuf_2fduration_2eproto::offsets,
78   file_level_metadata_google_2fprotobuf_2fduration_2eproto, 1, file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto, file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto,
79 };
80 
81 // Force running AddDescriptors() at dynamic initialization time.
82 static bool dynamic_init_dummy_google_2fprotobuf_2fduration_2eproto = (  ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_google_2fprotobuf_2fduration_2eproto), true);
83 PROTOBUF_NAMESPACE_OPEN
84 
85 // ===================================================================
86 
InitAsDefaultInstance()87 void Duration::InitAsDefaultInstance() {
88 }
89 class Duration::_Internal {
90  public:
91 };
92 
Duration()93 Duration::Duration()
94   : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
95   SharedCtor();
96   // @@protoc_insertion_point(constructor:google.protobuf.Duration)
97 }
Duration(::PROTOBUF_NAMESPACE_ID::Arena * arena)98 Duration::Duration(::PROTOBUF_NAMESPACE_ID::Arena* arena)
99   : ::PROTOBUF_NAMESPACE_ID::Message(),
100   _internal_metadata_(arena) {
101   SharedCtor();
102   RegisterArenaDtor(arena);
103   // @@protoc_insertion_point(arena_constructor:google.protobuf.Duration)
104 }
Duration(const Duration & from)105 Duration::Duration(const Duration& from)
106   : ::PROTOBUF_NAMESPACE_ID::Message(),
107       _internal_metadata_(nullptr) {
108   _internal_metadata_.MergeFrom(from._internal_metadata_);
109   ::memcpy(&seconds_, &from.seconds_,
110     static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -
111     reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
112   // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration)
113 }
114 
SharedCtor()115 void Duration::SharedCtor() {
116   ::memset(&seconds_, 0, static_cast<size_t>(
117       reinterpret_cast<char*>(&nanos_) -
118       reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
119 }
120 
~Duration()121 Duration::~Duration() {
122   // @@protoc_insertion_point(destructor:google.protobuf.Duration)
123   SharedDtor();
124 }
125 
SharedDtor()126 void Duration::SharedDtor() {
127   GOOGLE_DCHECK(GetArenaNoVirtual() == nullptr);
128 }
129 
ArenaDtor(void * object)130 void Duration::ArenaDtor(void* object) {
131   Duration* _this = reinterpret_cast< Duration* >(object);
132   (void)_this;
133 }
RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena *)134 void Duration::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
135 }
SetCachedSize(int size) const136 void Duration::SetCachedSize(int size) const {
137   _cached_size_.Set(size);
138 }
default_instance()139 const Duration& Duration::default_instance() {
140   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_Duration_google_2fprotobuf_2fduration_2eproto.base);
141   return *internal_default_instance();
142 }
143 
144 
Clear()145 void Duration::Clear() {
146 // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration)
147   ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
148   // Prevent compiler warnings about cached_has_bits being unused
149   (void) cached_has_bits;
150 
151   ::memset(&seconds_, 0, static_cast<size_t>(
152       reinterpret_cast<char*>(&nanos_) -
153       reinterpret_cast<char*>(&seconds_)) + sizeof(nanos_));
154   _internal_metadata_.Clear();
155 }
156 
157 #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
_InternalParse(const char * ptr,::PROTOBUF_NAMESPACE_ID::internal::ParseContext * ctx)158 const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
159 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
160   ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaNoVirtual(); (void)arena;
161   while (!ctx->Done(&ptr)) {
162     ::PROTOBUF_NAMESPACE_ID::uint32 tag;
163     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
164     CHK_(ptr);
165     switch (tag >> 3) {
166       // int64 seconds = 1;
167       case 1:
168         if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
169           seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
170           CHK_(ptr);
171         } else goto handle_unusual;
172         continue;
173       // int32 nanos = 2;
174       case 2:
175         if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
176           nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
177           CHK_(ptr);
178         } else goto handle_unusual;
179         continue;
180       default: {
181       handle_unusual:
182         if ((tag & 7) == 4 || tag == 0) {
183           ctx->SetLastTag(tag);
184           goto success;
185         }
186         ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
187         CHK_(ptr != nullptr);
188         continue;
189       }
190     }  // switch
191   }  // while
192 success:
193   return ptr;
194 failure:
195   ptr = nullptr;
196   goto success;
197 #undef CHK_
198 }
199 #else  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
MergePartialFromCodedStream(::PROTOBUF_NAMESPACE_ID::io::CodedInputStream * input)200 bool Duration::MergePartialFromCodedStream(
201     ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
202 #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
203   ::PROTOBUF_NAMESPACE_ID::uint32 tag;
204   // @@protoc_insertion_point(parse_start:google.protobuf.Duration)
205   for (;;) {
206     ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
207     tag = p.first;
208     if (!p.second) goto handle_unusual;
209     switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
210       // int64 seconds = 1;
211       case 1: {
212         if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) {
213 
214           DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
215                    ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>(
216                  input, &seconds_)));
217         } else {
218           goto handle_unusual;
219         }
220         break;
221       }
222 
223       // int32 nanos = 2;
224       case 2: {
225         if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) {
226 
227           DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
228                    ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>(
229                  input, &nanos_)));
230         } else {
231           goto handle_unusual;
232         }
233         break;
234       }
235 
236       default: {
237       handle_unusual:
238         if (tag == 0) {
239           goto success;
240         }
241         DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
242               input, tag, _internal_metadata_.mutable_unknown_fields()));
243         break;
244       }
245     }
246   }
247 success:
248   // @@protoc_insertion_point(parse_success:google.protobuf.Duration)
249   return true;
250 failure:
251   // @@protoc_insertion_point(parse_failure:google.protobuf.Duration)
252   return false;
253 #undef DO_
254 }
255 #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
256 
SerializeWithCachedSizes(::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream * output) const257 void Duration::SerializeWithCachedSizes(
258     ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
259   // @@protoc_insertion_point(serialize_start:google.protobuf.Duration)
260   ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
261   (void) cached_has_bits;
262 
263   // int64 seconds = 1;
264   if (this->seconds() != 0) {
265     ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(1, this->seconds(), output);
266   }
267 
268   // int32 nanos = 2;
269   if (this->nanos() != 0) {
270     ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(2, this->nanos(), output);
271   }
272 
273   if (_internal_metadata_.have_unknown_fields()) {
274     ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
275         _internal_metadata_.unknown_fields(), output);
276   }
277   // @@protoc_insertion_point(serialize_end:google.protobuf.Duration)
278 }
279 
InternalSerializeWithCachedSizesToArray(::PROTOBUF_NAMESPACE_ID::uint8 * target) const280 ::PROTOBUF_NAMESPACE_ID::uint8* Duration::InternalSerializeWithCachedSizesToArray(
281     ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
282   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration)
283   ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
284   (void) cached_has_bits;
285 
286   // int64 seconds = 1;
287   if (this->seconds() != 0) {
288     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->seconds(), target);
289   }
290 
291   // int32 nanos = 2;
292   if (this->nanos() != 0) {
293     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->nanos(), target);
294   }
295 
296   if (_internal_metadata_.have_unknown_fields()) {
297     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
298         _internal_metadata_.unknown_fields(), target);
299   }
300   // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Duration)
301   return target;
302 }
303 
ByteSizeLong() const304 size_t Duration::ByteSizeLong() const {
305 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration)
306   size_t total_size = 0;
307 
308   if (_internal_metadata_.have_unknown_fields()) {
309     total_size +=
310       ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
311         _internal_metadata_.unknown_fields());
312   }
313   ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
314   // Prevent compiler warnings about cached_has_bits being unused
315   (void) cached_has_bits;
316 
317   // int64 seconds = 1;
318   if (this->seconds() != 0) {
319     total_size += 1 +
320       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size(
321         this->seconds());
322   }
323 
324   // int32 nanos = 2;
325   if (this->nanos() != 0) {
326     total_size += 1 +
327       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
328         this->nanos());
329   }
330 
331   int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
332   SetCachedSize(cached_size);
333   return total_size;
334 }
335 
MergeFrom(const::PROTOBUF_NAMESPACE_ID::Message & from)336 void Duration::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
337 // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Duration)
338   GOOGLE_DCHECK_NE(&from, this);
339   const Duration* source =
340       ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<Duration>(
341           &from);
342   if (source == nullptr) {
343   // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Duration)
344     ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
345   } else {
346   // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Duration)
347     MergeFrom(*source);
348   }
349 }
350 
MergeFrom(const Duration & from)351 void Duration::MergeFrom(const Duration& from) {
352 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration)
353   GOOGLE_DCHECK_NE(&from, this);
354   _internal_metadata_.MergeFrom(from._internal_metadata_);
355   ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
356   (void) cached_has_bits;
357 
358   if (from.seconds() != 0) {
359     set_seconds(from.seconds());
360   }
361   if (from.nanos() != 0) {
362     set_nanos(from.nanos());
363   }
364 }
365 
CopyFrom(const::PROTOBUF_NAMESPACE_ID::Message & from)366 void Duration::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
367 // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Duration)
368   if (&from == this) return;
369   Clear();
370   MergeFrom(from);
371 }
372 
CopyFrom(const Duration & from)373 void Duration::CopyFrom(const Duration& from) {
374 // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Duration)
375   if (&from == this) return;
376   Clear();
377   MergeFrom(from);
378 }
379 
IsInitialized() const380 bool Duration::IsInitialized() const {
381   return true;
382 }
383 
InternalSwap(Duration * other)384 void Duration::InternalSwap(Duration* other) {
385   using std::swap;
386   _internal_metadata_.Swap(&other->_internal_metadata_);
387   swap(seconds_, other->seconds_);
388   swap(nanos_, other->nanos_);
389 }
390 
GetMetadata() const391 ::PROTOBUF_NAMESPACE_ID::Metadata Duration::GetMetadata() const {
392   return GetMetadataStatic();
393 }
394 
395 
396 // @@protoc_insertion_point(namespace_scope)
397 PROTOBUF_NAMESPACE_CLOSE
398 PROTOBUF_NAMESPACE_OPEN
CreateMaybeMessage(Arena * arena)399 template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Duration >(Arena* arena) {
400   return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Duration >(arena);
401 }
402 PROTOBUF_NAMESPACE_CLOSE
403 
404 // @@protoc_insertion_point(global_scope)
405 #include <google/protobuf/port_undef.inc>
406