Home | History | Annotate | Download | only in protobuf
      1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
      2 // source: google/protobuf/any.proto
      3 
      4 #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
      5 #include <google/protobuf/any.pb.h>
      6 
      7 #include <algorithm>
      8 
      9 #include <google/protobuf/stubs/common.h>
     10 #include <google/protobuf/stubs/port.h>
     11 #include <google/protobuf/stubs/once.h>
     12 #include <google/protobuf/io/coded_stream.h>
     13 #include <google/protobuf/wire_format_lite_inl.h>
     14 #include <google/protobuf/descriptor.h>
     15 #include <google/protobuf/generated_message_reflection.h>
     16 #include <google/protobuf/reflection_ops.h>
     17 #include <google/protobuf/wire_format.h>
     18 // @@protoc_insertion_point(includes)
     19 
     20 namespace google {
     21 namespace protobuf {
     22 
     23 namespace {
     24 
     25 const ::google::protobuf::Descriptor* Any_descriptor_ = NULL;
     26 const ::google::protobuf::internal::GeneratedMessageReflection*
     27   Any_reflection_ = NULL;
     28 
     29 }  // namespace
     30 
     31 
     32 void protobuf_AssignDesc_google_2fprotobuf_2fany_2eproto() {
     33   protobuf_AddDesc_google_2fprotobuf_2fany_2eproto();
     34   const ::google::protobuf::FileDescriptor* file =
     35     ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
     36       "google/protobuf/any.proto");
     37   GOOGLE_CHECK(file != NULL);
     38   Any_descriptor_ = file->message_type(0);
     39   static const int Any_offsets_[2] = {
     40     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, type_url_),
     41     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, value_),
     42   };
     43   Any_reflection_ =
     44     ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
     45       Any_descriptor_,
     46       Any::default_instance_,
     47       Any_offsets_,
     48       -1,
     49       -1,
     50       -1,
     51       sizeof(Any),
     52       GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, _internal_metadata_),
     53       GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, _is_default_instance_));
     54 }
     55 
     56 namespace {
     57 
     58 GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
     59 inline void protobuf_AssignDescriptorsOnce() {
     60   ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
     61                  &protobuf_AssignDesc_google_2fprotobuf_2fany_2eproto);
     62 }
     63 
     64 void protobuf_RegisterTypes(const ::std::string&) {
     65   protobuf_AssignDescriptorsOnce();
     66   ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
     67       Any_descriptor_, &Any::default_instance());
     68 }
     69 
     70 }  // namespace
     71 
     72 void protobuf_ShutdownFile_google_2fprotobuf_2fany_2eproto() {
     73   delete Any::default_instance_;
     74   delete Any_reflection_;
     75 }
     76 
     77 void protobuf_AddDesc_google_2fprotobuf_2fany_2eproto() {
     78   static bool already_here = false;
     79   if (already_here) return;
     80   already_here = true;
     81   GOOGLE_PROTOBUF_VERIFY_VERSION;
     82 
     83   ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
     84     "\n\031google/protobuf/any.proto\022\017google.prot"
     85     "obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002"
     86     " \001(\014Br\n\023com.google.protobufB\010AnyProtoP\001Z"
     87     "%github.com/golang/protobuf/ptypes/any\240\001"
     88     "\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes"
     89     "b\006proto3", 208);
     90   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     91     "google/protobuf/any.proto", &protobuf_RegisterTypes);
     92   Any::default_instance_ = new Any();
     93   Any::default_instance_->InitAsDefaultInstance();
     94   ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fany_2eproto);
     95 }
     96 
     97 // Force AddDescriptors() to be called at static initialization time.
     98 struct StaticDescriptorInitializer_google_2fprotobuf_2fany_2eproto {
     99   StaticDescriptorInitializer_google_2fprotobuf_2fany_2eproto() {
    100     protobuf_AddDesc_google_2fprotobuf_2fany_2eproto();
    101   }
    102 } static_descriptor_initializer_google_2fprotobuf_2fany_2eproto_;
    103 
    104 namespace {
    105 
    106 static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD;
    107 static void MergeFromFail(int line) {
    108   GOOGLE_CHECK(false) << __FILE__ << ":" << line;
    109 }
    110 
    111 }  // namespace
    112 
    113 
    114 // ===================================================================
    115 
    116 void Any::PackFrom(const ::google::protobuf::Message& message) {
    117   _any_metadata_.PackFrom(message);
    118 }
    119 
    120 void Any::PackFrom(const ::google::protobuf::Message& message,
    121                            const ::std::string& type_url_prefix) {
    122   _any_metadata_.PackFrom(message, type_url_prefix);
    123 }
    124 
    125 bool Any::UnpackTo(::google::protobuf::Message* message) const {
    126   return _any_metadata_.UnpackTo(message);
    127 }
    128 
    129 #if !defined(_MSC_VER) || _MSC_VER >= 1900
    130 const int Any::kTypeUrlFieldNumber;
    131 const int Any::kValueFieldNumber;
    132 #endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
    133 
    134 Any::Any()
    135   : ::google::protobuf::Message(), _internal_metadata_(NULL), _any_metadata_(&type_url_, &value_) {
    136   SharedCtor();
    137   // @@protoc_insertion_point(constructor:google.protobuf.Any)
    138 }
    139 
    140 void Any::InitAsDefaultInstance() {
    141   _is_default_instance_ = true;
    142 }
    143 
    144 Any::Any(const Any& from)
    145   : ::google::protobuf::Message(),
    146     _internal_metadata_(NULL),
    147     _any_metadata_(&type_url_, &value_) {
    148   SharedCtor();
    149   MergeFrom(from);
    150   // @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
    151 }
    152 
    153 void Any::SharedCtor() {
    154     _is_default_instance_ = false;
    155   ::google::protobuf::internal::GetEmptyString();
    156   _cached_size_ = 0;
    157   type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    158   value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    159 }
    160 
    161 Any::~Any() {
    162   // @@protoc_insertion_point(destructor:google.protobuf.Any)
    163   SharedDtor();
    164 }
    165 
    166 void Any::SharedDtor() {
    167   type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    168   value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    169   if (this != default_instance_) {
    170   }
    171 }
    172 
    173 void Any::SetCachedSize(int size) const {
    174   GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
    175   _cached_size_ = size;
    176   GOOGLE_SAFE_CONCURRENT_WRITES_END();
    177 }
    178 const ::google::protobuf::Descriptor* Any::descriptor() {
    179   protobuf_AssignDescriptorsOnce();
    180   return Any_descriptor_;
    181 }
    182 
    183 const Any& Any::default_instance() {
    184   if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fany_2eproto();
    185   return *default_instance_;
    186 }
    187 
    188 Any* Any::default_instance_ = NULL;
    189 
    190 Any* Any::New(::google::protobuf::Arena* arena) const {
    191   Any* n = new Any;
    192   if (arena != NULL) {
    193     arena->Own(n);
    194   }
    195   return n;
    196 }
    197 
    198 void Any::Clear() {
    199 // @@protoc_insertion_point(message_clear_start:google.protobuf.Any)
    200   type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    201   value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    202 }
    203 
    204 bool Any::MergePartialFromCodedStream(
    205     ::google::protobuf::io::CodedInputStream* input) {
    206 #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
    207   ::google::protobuf::uint32 tag;
    208   // @@protoc_insertion_point(parse_start:google.protobuf.Any)
    209   for (;;) {
    210     ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
    211     tag = p.first;
    212     if (!p.second) goto handle_unusual;
    213     switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
    214       // optional string type_url = 1;
    215       case 1: {
    216         if (tag == 10) {
    217           DO_(::google::protobuf::internal::WireFormatLite::ReadString(
    218                 input, this->mutable_type_url()));
    219           DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
    220             this->type_url().data(), this->type_url().length(),
    221             ::google::protobuf::internal::WireFormatLite::PARSE,
    222             "google.protobuf.Any.type_url"));
    223         } else {
    224           goto handle_unusual;
    225         }
    226         if (input->ExpectTag(18)) goto parse_value;
    227         break;
    228       }
    229 
    230       // optional bytes value = 2;
    231       case 2: {
    232         if (tag == 18) {
    233          parse_value:
    234           DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
    235                 input, this->mutable_value()));
    236         } else {
    237           goto handle_unusual;
    238         }
    239         if (input->ExpectAtEnd()) goto success;
    240         break;
    241       }
    242 
    243       default: {
    244       handle_unusual:
    245         if (tag == 0 ||
    246             ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
    247             ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
    248           goto success;
    249         }
    250         DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
    251         break;
    252       }
    253     }
    254   }
    255 success:
    256   // @@protoc_insertion_point(parse_success:google.protobuf.Any)
    257   return true;
    258 failure:
    259   // @@protoc_insertion_point(parse_failure:google.protobuf.Any)
    260   return false;
    261 #undef DO_
    262 }
    263 
    264 void Any::SerializeWithCachedSizes(
    265     ::google::protobuf::io::CodedOutputStream* output) const {
    266   // @@protoc_insertion_point(serialize_start:google.protobuf.Any)
    267   // optional string type_url = 1;
    268   if (this->type_url().size() > 0) {
    269     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
    270       this->type_url().data(), this->type_url().length(),
    271       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
    272       "google.protobuf.Any.type_url");
    273     ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
    274       1, this->type_url(), output);
    275   }
    276 
    277   // optional bytes value = 2;
    278   if (this->value().size() > 0) {
    279     ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
    280       2, this->value(), output);
    281   }
    282 
    283   // @@protoc_insertion_point(serialize_end:google.protobuf.Any)
    284 }
    285 
    286 ::google::protobuf::uint8* Any::SerializeWithCachedSizesToArray(
    287     ::google::protobuf::uint8* target) const {
    288   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any)
    289   // optional string type_url = 1;
    290   if (this->type_url().size() > 0) {
    291     ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
    292       this->type_url().data(), this->type_url().length(),
    293       ::google::protobuf::internal::WireFormatLite::SERIALIZE,
    294       "google.protobuf.Any.type_url");
    295     target =
    296       ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
    297         1, this->type_url(), target);
    298   }
    299 
    300   // optional bytes value = 2;
    301   if (this->value().size() > 0) {
    302     target =
    303       ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
    304         2, this->value(), target);
    305   }
    306 
    307   // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Any)
    308   return target;
    309 }
    310 
    311 int Any::ByteSize() const {
    312 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any)
    313   int total_size = 0;
    314 
    315   // optional string type_url = 1;
    316   if (this->type_url().size() > 0) {
    317     total_size += 1 +
    318       ::google::protobuf::internal::WireFormatLite::StringSize(
    319         this->type_url());
    320   }
    321 
    322   // optional bytes value = 2;
    323   if (this->value().size() > 0) {
    324     total_size += 1 +
    325       ::google::protobuf::internal::WireFormatLite::BytesSize(
    326         this->value());
    327   }
    328 
    329   GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
    330   _cached_size_ = total_size;
    331   GOOGLE_SAFE_CONCURRENT_WRITES_END();
    332   return total_size;
    333 }
    334 
    335 void Any::MergeFrom(const ::google::protobuf::Message& from) {
    336 // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Any)
    337   if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
    338   const Any* source =
    339       ::google::protobuf::internal::DynamicCastToGenerated<const Any>(
    340           &from);
    341   if (source == NULL) {
    342   // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Any)
    343     ::google::protobuf::internal::ReflectionOps::Merge(from, this);
    344   } else {
    345   // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Any)
    346     MergeFrom(*source);
    347   }
    348 }
    349 
    350 void Any::MergeFrom(const Any& from) {
    351 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any)
    352   if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
    353   if (from.type_url().size() > 0) {
    354 
    355     type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_url_);
    356   }
    357   if (from.value().size() > 0) {
    358 
    359     value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.value_);
    360   }
    361 }
    362 
    363 void Any::CopyFrom(const ::google::protobuf::Message& from) {
    364 // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Any)
    365   if (&from == this) return;
    366   Clear();
    367   MergeFrom(from);
    368 }
    369 
    370 void Any::CopyFrom(const Any& from) {
    371 // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Any)
    372   if (&from == this) return;
    373   Clear();
    374   MergeFrom(from);
    375 }
    376 
    377 bool Any::IsInitialized() const {
    378 
    379   return true;
    380 }
    381 
    382 void Any::Swap(Any* other) {
    383   if (other == this) return;
    384   InternalSwap(other);
    385 }
    386 void Any::InternalSwap(Any* other) {
    387   type_url_.Swap(&other->type_url_);
    388   value_.Swap(&other->value_);
    389   _internal_metadata_.Swap(&other->_internal_metadata_);
    390   std::swap(_cached_size_, other->_cached_size_);
    391 }
    392 
    393 ::google::protobuf::Metadata Any::GetMetadata() const {
    394   protobuf_AssignDescriptorsOnce();
    395   ::google::protobuf::Metadata metadata;
    396   metadata.descriptor = Any_descriptor_;
    397   metadata.reflection = Any_reflection_;
    398   return metadata;
    399 }
    400 
    401 #if PROTOBUF_INLINE_NOT_IN_HEADERS
    402 // Any
    403 
    404 // optional string type_url = 1;
    405 void Any::clear_type_url() {
    406   type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    407 }
    408  const ::std::string& Any::type_url() const {
    409   // @@protoc_insertion_point(field_get:google.protobuf.Any.type_url)
    410   return type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    411 }
    412  void Any::set_type_url(const ::std::string& value) {
    413 
    414   type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
    415   // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
    416 }
    417  void Any::set_type_url(const char* value) {
    418 
    419   type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
    420   // @@protoc_insertion_point(field_set_char:google.protobuf.Any.type_url)
    421 }
    422  void Any::set_type_url(const char* value, size_t size) {
    423 
    424   type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    425       ::std::string(reinterpret_cast<const char*>(value), size));
    426   // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url)
    427 }
    428  ::std::string* Any::mutable_type_url() {
    429 
    430   // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url)
    431   return type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    432 }
    433  ::std::string* Any::release_type_url() {
    434   // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url)
    435 
    436   return type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    437 }
    438  void Any::set_allocated_type_url(::std::string* type_url) {
    439   if (type_url != NULL) {
    440 
    441   } else {
    442 
    443   }
    444   type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url);
    445   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
    446 }
    447 
    448 // optional bytes value = 2;
    449 void Any::clear_value() {
    450   value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    451 }
    452  const ::std::string& Any::value() const {
    453   // @@protoc_insertion_point(field_get:google.protobuf.Any.value)
    454   return value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    455 }
    456  void Any::set_value(const ::std::string& value) {
    457 
    458   value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
    459   // @@protoc_insertion_point(field_set:google.protobuf.Any.value)
    460 }
    461  void Any::set_value(const char* value) {
    462 
    463   value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
    464   // @@protoc_insertion_point(field_set_char:google.protobuf.Any.value)
    465 }
    466  void Any::set_value(const void* value, size_t size) {
    467 
    468   value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    469       ::std::string(reinterpret_cast<const char*>(value), size));
    470   // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value)
    471 }
    472  ::std::string* Any::mutable_value() {
    473 
    474   // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value)
    475   return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    476 }
    477  ::std::string* Any::release_value() {
    478   // @@protoc_insertion_point(field_release:google.protobuf.Any.value)
    479 
    480   return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
    481 }
    482  void Any::set_allocated_value(::std::string* value) {
    483   if (value != NULL) {
    484 
    485   } else {
    486 
    487   }
    488   value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
    489   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
    490 }
    491 
    492 #endif  // PROTOBUF_INLINE_NOT_IN_HEADERS
    493 
    494 // @@protoc_insertion_point(namespace_scope)
    495 
    496 }  // namespace protobuf
    497 }  // namespace google
    498 
    499 // @@protoc_insertion_point(global_scope)
    500