maybe_document.nanopb.cc 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright 2024 Google LLC
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* Automatically generated nanopb constant definitions */
  17. /* Generated by nanopb-0.3.9.8 */
  18. #include "maybe_document.nanopb.h"
  19. #include "Firestore/core/src/nanopb/pretty_printing.h"
  20. namespace firebase {
  21. namespace firestore {
  22. using nanopb::PrintEnumField;
  23. using nanopb::PrintHeader;
  24. using nanopb::PrintMessageField;
  25. using nanopb::PrintPrimitiveField;
  26. using nanopb::PrintTail;
  27. /* @@protoc_insertion_point(includes) */
  28. #if PB_PROTO_HEADER_VERSION != 30
  29. #error Regenerate this file with the current version of nanopb generator.
  30. #endif
  31. const pb_field_t firestore_client_NoDocument_fields[3] = {
  32. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_client_NoDocument, name, name, 0),
  33. PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_client_NoDocument, read_time, name, &google_protobuf_Timestamp_fields),
  34. PB_LAST_FIELD
  35. };
  36. const pb_field_t firestore_client_UnknownDocument_fields[3] = {
  37. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_client_UnknownDocument, name, name, 0),
  38. PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_client_UnknownDocument, version, name, &google_protobuf_Timestamp_fields),
  39. PB_LAST_FIELD
  40. };
  41. const pb_field_t firestore_client_MaybeDocument_fields[5] = {
  42. PB_ANONYMOUS_ONEOF_FIELD(document_type, 1, MESSAGE , ONEOF, STATIC , FIRST, firestore_client_MaybeDocument, no_document, no_document, &firestore_client_NoDocument_fields),
  43. PB_ANONYMOUS_ONEOF_FIELD(document_type, 2, MESSAGE , ONEOF, STATIC , UNION, firestore_client_MaybeDocument, document, document, &google_firestore_v1_Document_fields),
  44. PB_ANONYMOUS_ONEOF_FIELD(document_type, 3, MESSAGE , ONEOF, STATIC , UNION, firestore_client_MaybeDocument, unknown_document, unknown_document, &firestore_client_UnknownDocument_fields),
  45. PB_FIELD( 4, BOOL , SINGULAR, STATIC , OTHER, firestore_client_MaybeDocument, has_committed_mutations, unknown_document, 0),
  46. PB_LAST_FIELD
  47. };
  48. /* Check that field information fits in pb_field_t */
  49. #if !defined(PB_FIELD_32BIT)
  50. /* If you get an error here, it means that you need to define PB_FIELD_32BIT
  51. * compile-time option. You can do that in pb.h or on compiler command line.
  52. *
  53. * The reason you need to do this is that some of your messages contain tag
  54. * numbers or field sizes that are larger than what can fit in 8 or 16 bit
  55. * field descriptors.
  56. */
  57. PB_STATIC_ASSERT((pb_membersize(firestore_client_NoDocument, read_time) < 65536 && pb_membersize(firestore_client_UnknownDocument, version) < 65536 && pb_membersize(firestore_client_MaybeDocument, no_document) < 65536 && pb_membersize(firestore_client_MaybeDocument, document) < 65536 && pb_membersize(firestore_client_MaybeDocument, unknown_document) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_firestore_client_NoDocument_firestore_client_UnknownDocument_firestore_client_MaybeDocument)
  58. #endif
  59. #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
  60. /* If you get an error here, it means that you need to define PB_FIELD_16BIT
  61. * compile-time option. You can do that in pb.h or on compiler command line.
  62. *
  63. * The reason you need to do this is that some of your messages contain tag
  64. * numbers or field sizes that are larger than what can fit in the default
  65. * 8 bit descriptors.
  66. */
  67. PB_STATIC_ASSERT((pb_membersize(firestore_client_NoDocument, read_time) < 256 && pb_membersize(firestore_client_UnknownDocument, version) < 256 && pb_membersize(firestore_client_MaybeDocument, no_document) < 256 && pb_membersize(firestore_client_MaybeDocument, document) < 256 && pb_membersize(firestore_client_MaybeDocument, unknown_document) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_firestore_client_NoDocument_firestore_client_UnknownDocument_firestore_client_MaybeDocument)
  68. #endif
  69. std::string firestore_client_NoDocument::ToString(int indent) const {
  70. std::string tostring_header = PrintHeader(indent, "NoDocument", this);
  71. std::string tostring_result;
  72. tostring_result += PrintPrimitiveField("name: ", name, indent + 1, false);
  73. tostring_result += PrintMessageField("read_time ",
  74. read_time, indent + 1, false);
  75. std::string tostring_tail = PrintTail(indent);
  76. return tostring_header + tostring_result + tostring_tail;
  77. }
  78. std::string firestore_client_UnknownDocument::ToString(int indent) const {
  79. std::string tostring_header = PrintHeader(indent, "UnknownDocument", this);
  80. std::string tostring_result;
  81. tostring_result += PrintPrimitiveField("name: ", name, indent + 1, false);
  82. tostring_result += PrintMessageField("version ",
  83. version, indent + 1, false);
  84. std::string tostring_tail = PrintTail(indent);
  85. return tostring_header + tostring_result + tostring_tail;
  86. }
  87. std::string firestore_client_MaybeDocument::ToString(int indent) const {
  88. std::string tostring_header = PrintHeader(indent, "MaybeDocument", this);
  89. std::string tostring_result;
  90. switch (which_document_type) {
  91. case firestore_client_MaybeDocument_no_document_tag:
  92. tostring_result += PrintMessageField("no_document ",
  93. no_document, indent + 1, true);
  94. break;
  95. case firestore_client_MaybeDocument_document_tag:
  96. tostring_result += PrintMessageField("document ",
  97. document, indent + 1, true);
  98. break;
  99. case firestore_client_MaybeDocument_unknown_document_tag:
  100. tostring_result += PrintMessageField("unknown_document ",
  101. unknown_document, indent + 1, true);
  102. break;
  103. }
  104. tostring_result += PrintPrimitiveField("has_committed_mutations: ",
  105. has_committed_mutations, indent + 1, false);
  106. bool is_root = indent == 0;
  107. if (!tostring_result.empty() || is_root) {
  108. std::string tostring_tail = PrintTail(indent);
  109. return tostring_header + tostring_result + tostring_tail;
  110. } else {
  111. return "";
  112. }
  113. }
  114. } // namespace firestore
  115. } // namespace firebase
  116. /* @@protoc_insertion_point(eof) */