proto3.pb.cc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/util/internal/testdata/proto3.proto
  3. #include <google/protobuf/util/internal/testdata/proto3.pb.h>
  4. #include <algorithm>
  5. #include <google/protobuf/stubs/common.h>
  6. #include <google/protobuf/stubs/port.h>
  7. #include <google/protobuf/io/coded_stream.h>
  8. #include <google/protobuf/wire_format_lite_inl.h>
  9. #include <google/protobuf/descriptor.h>
  10. #include <google/protobuf/generated_message_reflection.h>
  11. #include <google/protobuf/reflection_ops.h>
  12. #include <google/protobuf/wire_format.h>
  13. // This is a temporary google only hack
  14. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  15. #include "third_party/protobuf/version.h"
  16. #endif
  17. // @@protoc_insertion_point(includes)
  18. namespace google {
  19. namespace protobuf {
  20. namespace testing {
  21. class Proto3MessageDefaultTypeInternal {
  22. public:
  23. ::google::protobuf::internal::ExplicitlyConstructed<Proto3Message>
  24. _instance;
  25. } _Proto3Message_default_instance_;
  26. } // namespace testing
  27. } // namespace protobuf
  28. } // namespace google
  29. namespace protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto {
  30. static void InitDefaultsProto3Message() {
  31. GOOGLE_PROTOBUF_VERIFY_VERSION;
  32. {
  33. void* ptr = &::google::protobuf::testing::_Proto3Message_default_instance_;
  34. new (ptr) ::google::protobuf::testing::Proto3Message();
  35. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  36. }
  37. ::google::protobuf::testing::Proto3Message::InitAsDefaultInstance();
  38. }
  39. ::google::protobuf::internal::SCCInfo<0> scc_info_Proto3Message =
  40. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsProto3Message}, {}};
  41. void InitDefaults() {
  42. ::google::protobuf::internal::InitSCC(&scc_info_Proto3Message.base);
  43. }
  44. ::google::protobuf::Metadata file_level_metadata[1];
  45. const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];
  46. const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  47. ~0u, // no _has_bits_
  48. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::testing::Proto3Message, _internal_metadata_),
  49. ~0u, // no _extensions_
  50. ~0u, // no _oneof_case_
  51. ~0u, // no _weak_field_map_
  52. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::testing::Proto3Message, enum_value_),
  53. };
  54. static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  55. { 0, -1, sizeof(::google::protobuf::testing::Proto3Message)},
  56. };
  57. static ::google::protobuf::Message const * const file_default_instances[] = {
  58. reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::testing::_Proto3Message_default_instance_),
  59. };
  60. void protobuf_AssignDescriptors() {
  61. AddDescriptors();
  62. AssignDescriptors(
  63. "google/protobuf/util/internal/testdata/proto3.proto", schemas, file_default_instances, TableStruct::offsets,
  64. file_level_metadata, file_level_enum_descriptors, NULL);
  65. }
  66. void protobuf_AssignDescriptorsOnce() {
  67. static ::google::protobuf::internal::once_flag once;
  68. ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
  69. }
  70. void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
  71. void protobuf_RegisterTypes(const ::std::string&) {
  72. protobuf_AssignDescriptorsOnce();
  73. ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
  74. }
  75. void AddDescriptorsImpl() {
  76. InitDefaults();
  77. static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  78. "\n3google/protobuf/util/internal/testdata"
  79. "/proto3.proto\022\027google.protobuf.testing\"\177"
  80. "\n\rProto3Message\022E\n\nenum_value\030\001 \001(\01621.go"
  81. "ogle.protobuf.testing.Proto3Message.Nest"
  82. "edEnum\"\'\n\nNestedEnum\022\007\n\003FOO\020\000\022\007\n\003BAR\020\001\022\007"
  83. "\n\003BAZ\020\002b\006proto3"
  84. };
  85. ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
  86. descriptor, 215);
  87. ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
  88. "google/protobuf/util/internal/testdata/proto3.proto", &protobuf_RegisterTypes);
  89. }
  90. void AddDescriptors() {
  91. static ::google::protobuf::internal::once_flag once;
  92. ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
  93. }
  94. // Force AddDescriptors() to be called at dynamic initialization time.
  95. struct StaticDescriptorInitializer {
  96. StaticDescriptorInitializer() {
  97. AddDescriptors();
  98. }
  99. } static_descriptor_initializer;
  100. } // namespace protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto
  101. namespace google {
  102. namespace protobuf {
  103. namespace testing {
  104. const ::google::protobuf::EnumDescriptor* Proto3Message_NestedEnum_descriptor() {
  105. protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto::protobuf_AssignDescriptorsOnce();
  106. return protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto::file_level_enum_descriptors[0];
  107. }
  108. bool Proto3Message_NestedEnum_IsValid(int value) {
  109. switch (value) {
  110. case 0:
  111. case 1:
  112. case 2:
  113. return true;
  114. default:
  115. return false;
  116. }
  117. }
  118. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  119. const Proto3Message_NestedEnum Proto3Message::FOO;
  120. const Proto3Message_NestedEnum Proto3Message::BAR;
  121. const Proto3Message_NestedEnum Proto3Message::BAZ;
  122. const Proto3Message_NestedEnum Proto3Message::NestedEnum_MIN;
  123. const Proto3Message_NestedEnum Proto3Message::NestedEnum_MAX;
  124. const int Proto3Message::NestedEnum_ARRAYSIZE;
  125. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  126. // ===================================================================
  127. void Proto3Message::InitAsDefaultInstance() {
  128. }
  129. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  130. const int Proto3Message::kEnumValueFieldNumber;
  131. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  132. Proto3Message::Proto3Message()
  133. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  134. ::google::protobuf::internal::InitSCC(
  135. &protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto::scc_info_Proto3Message.base);
  136. SharedCtor();
  137. // @@protoc_insertion_point(constructor:google.protobuf.testing.Proto3Message)
  138. }
  139. Proto3Message::Proto3Message(const Proto3Message& from)
  140. : ::google::protobuf::Message(),
  141. _internal_metadata_(NULL) {
  142. _internal_metadata_.MergeFrom(from._internal_metadata_);
  143. enum_value_ = from.enum_value_;
  144. // @@protoc_insertion_point(copy_constructor:google.protobuf.testing.Proto3Message)
  145. }
  146. void Proto3Message::SharedCtor() {
  147. enum_value_ = 0;
  148. }
  149. Proto3Message::~Proto3Message() {
  150. // @@protoc_insertion_point(destructor:google.protobuf.testing.Proto3Message)
  151. SharedDtor();
  152. }
  153. void Proto3Message::SharedDtor() {
  154. }
  155. void Proto3Message::SetCachedSize(int size) const {
  156. _cached_size_.Set(size);
  157. }
  158. const ::google::protobuf::Descriptor* Proto3Message::descriptor() {
  159. ::protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto::protobuf_AssignDescriptorsOnce();
  160. return ::protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  161. }
  162. const Proto3Message& Proto3Message::default_instance() {
  163. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto::scc_info_Proto3Message.base);
  164. return *internal_default_instance();
  165. }
  166. void Proto3Message::Clear() {
  167. // @@protoc_insertion_point(message_clear_start:google.protobuf.testing.Proto3Message)
  168. ::google::protobuf::uint32 cached_has_bits = 0;
  169. // Prevent compiler warnings about cached_has_bits being unused
  170. (void) cached_has_bits;
  171. enum_value_ = 0;
  172. _internal_metadata_.Clear();
  173. }
  174. bool Proto3Message::MergePartialFromCodedStream(
  175. ::google::protobuf::io::CodedInputStream* input) {
  176. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  177. ::google::protobuf::uint32 tag;
  178. // @@protoc_insertion_point(parse_start:google.protobuf.testing.Proto3Message)
  179. for (;;) {
  180. ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  181. tag = p.first;
  182. if (!p.second) goto handle_unusual;
  183. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  184. // .google.protobuf.testing.Proto3Message.NestedEnum enum_value = 1;
  185. case 1: {
  186. if (static_cast< ::google::protobuf::uint8>(tag) ==
  187. static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
  188. int value;
  189. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  190. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  191. input, &value)));
  192. set_enum_value(static_cast< ::google::protobuf::testing::Proto3Message_NestedEnum >(value));
  193. } else {
  194. goto handle_unusual;
  195. }
  196. break;
  197. }
  198. default: {
  199. handle_unusual:
  200. if (tag == 0) {
  201. goto success;
  202. }
  203. DO_(::google::protobuf::internal::WireFormat::SkipField(
  204. input, tag, _internal_metadata_.mutable_unknown_fields()));
  205. break;
  206. }
  207. }
  208. }
  209. success:
  210. // @@protoc_insertion_point(parse_success:google.protobuf.testing.Proto3Message)
  211. return true;
  212. failure:
  213. // @@protoc_insertion_point(parse_failure:google.protobuf.testing.Proto3Message)
  214. return false;
  215. #undef DO_
  216. }
  217. void Proto3Message::SerializeWithCachedSizes(
  218. ::google::protobuf::io::CodedOutputStream* output) const {
  219. // @@protoc_insertion_point(serialize_start:google.protobuf.testing.Proto3Message)
  220. ::google::protobuf::uint32 cached_has_bits = 0;
  221. (void) cached_has_bits;
  222. // .google.protobuf.testing.Proto3Message.NestedEnum enum_value = 1;
  223. if (this->enum_value() != 0) {
  224. ::google::protobuf::internal::WireFormatLite::WriteEnum(
  225. 1, this->enum_value(), output);
  226. }
  227. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  228. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  229. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  230. }
  231. // @@protoc_insertion_point(serialize_end:google.protobuf.testing.Proto3Message)
  232. }
  233. ::google::protobuf::uint8* Proto3Message::InternalSerializeWithCachedSizesToArray(
  234. bool deterministic, ::google::protobuf::uint8* target) const {
  235. (void)deterministic; // Unused
  236. // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.testing.Proto3Message)
  237. ::google::protobuf::uint32 cached_has_bits = 0;
  238. (void) cached_has_bits;
  239. // .google.protobuf.testing.Proto3Message.NestedEnum enum_value = 1;
  240. if (this->enum_value() != 0) {
  241. target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
  242. 1, this->enum_value(), target);
  243. }
  244. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  245. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  246. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  247. }
  248. // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.testing.Proto3Message)
  249. return target;
  250. }
  251. size_t Proto3Message::ByteSizeLong() const {
  252. // @@protoc_insertion_point(message_byte_size_start:google.protobuf.testing.Proto3Message)
  253. size_t total_size = 0;
  254. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  255. total_size +=
  256. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  257. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  258. }
  259. // .google.protobuf.testing.Proto3Message.NestedEnum enum_value = 1;
  260. if (this->enum_value() != 0) {
  261. total_size += 1 +
  262. ::google::protobuf::internal::WireFormatLite::EnumSize(this->enum_value());
  263. }
  264. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  265. SetCachedSize(cached_size);
  266. return total_size;
  267. }
  268. void Proto3Message::MergeFrom(const ::google::protobuf::Message& from) {
  269. // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.testing.Proto3Message)
  270. GOOGLE_DCHECK_NE(&from, this);
  271. const Proto3Message* source =
  272. ::google::protobuf::internal::DynamicCastToGenerated<const Proto3Message>(
  273. &from);
  274. if (source == NULL) {
  275. // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.testing.Proto3Message)
  276. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  277. } else {
  278. // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.testing.Proto3Message)
  279. MergeFrom(*source);
  280. }
  281. }
  282. void Proto3Message::MergeFrom(const Proto3Message& from) {
  283. // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.testing.Proto3Message)
  284. GOOGLE_DCHECK_NE(&from, this);
  285. _internal_metadata_.MergeFrom(from._internal_metadata_);
  286. ::google::protobuf::uint32 cached_has_bits = 0;
  287. (void) cached_has_bits;
  288. if (from.enum_value() != 0) {
  289. set_enum_value(from.enum_value());
  290. }
  291. }
  292. void Proto3Message::CopyFrom(const ::google::protobuf::Message& from) {
  293. // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.testing.Proto3Message)
  294. if (&from == this) return;
  295. Clear();
  296. MergeFrom(from);
  297. }
  298. void Proto3Message::CopyFrom(const Proto3Message& from) {
  299. // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.testing.Proto3Message)
  300. if (&from == this) return;
  301. Clear();
  302. MergeFrom(from);
  303. }
  304. bool Proto3Message::IsInitialized() const {
  305. return true;
  306. }
  307. void Proto3Message::Swap(Proto3Message* other) {
  308. if (other == this) return;
  309. InternalSwap(other);
  310. }
  311. void Proto3Message::InternalSwap(Proto3Message* other) {
  312. using std::swap;
  313. swap(enum_value_, other->enum_value_);
  314. _internal_metadata_.Swap(&other->_internal_metadata_);
  315. }
  316. ::google::protobuf::Metadata Proto3Message::GetMetadata() const {
  317. protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto::protobuf_AssignDescriptorsOnce();
  318. return ::protobuf_google_2fprotobuf_2futil_2finternal_2ftestdata_2fproto3_2eproto::file_level_metadata[kIndexInFileMessages];
  319. }
  320. // @@protoc_insertion_point(namespace_scope)
  321. } // namespace testing
  322. } // namespace protobuf
  323. } // namespace google
  324. namespace google {
  325. namespace protobuf {
  326. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::testing::Proto3Message* Arena::CreateMaybeMessage< ::google::protobuf::testing::Proto3Message >(Arena* arena) {
  327. return Arena::CreateInternal< ::google::protobuf::testing::Proto3Message >(arena);
  328. }
  329. } // namespace protobuf
  330. } // namespace google
  331. // @@protoc_insertion_point(global_scope)