bundle.nanopb.cc 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. * Copyright 2022 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 "bundle.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_BundledQuery_fields[4] = {
  32. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_BundledQuery, parent, parent, 0),
  33. PB_ANONYMOUS_ONEOF_FIELD(query_type, 2, MESSAGE , ONEOF, STATIC , OTHER, firestore_BundledQuery, structured_query, parent, &google_firestore_v1_StructuredQuery_fields),
  34. PB_FIELD( 3, UENUM , SINGULAR, STATIC , OTHER, firestore_BundledQuery, limit_type, structured_query, 0),
  35. PB_LAST_FIELD
  36. };
  37. const pb_field_t firestore_NamedQuery_fields[4] = {
  38. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_NamedQuery, name, name, 0),
  39. PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_NamedQuery, bundled_query, name, &firestore_BundledQuery_fields),
  40. PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, firestore_NamedQuery, read_time, bundled_query, &google_protobuf_Timestamp_fields),
  41. PB_LAST_FIELD
  42. };
  43. const pb_field_t firestore_BundledDocumentMetadata_fields[5] = {
  44. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_BundledDocumentMetadata, name, name, 0),
  45. PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_BundledDocumentMetadata, read_time, name, &google_protobuf_Timestamp_fields),
  46. PB_FIELD( 3, BOOL , SINGULAR, STATIC , OTHER, firestore_BundledDocumentMetadata, exists, read_time, 0),
  47. PB_FIELD( 4, BYTES , REPEATED, POINTER , OTHER, firestore_BundledDocumentMetadata, queries, exists, 0),
  48. PB_LAST_FIELD
  49. };
  50. const pb_field_t firestore_BundleMetadata_fields[6] = {
  51. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, firestore_BundleMetadata, id, id, 0),
  52. PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, firestore_BundleMetadata, create_time, id, &google_protobuf_Timestamp_fields),
  53. PB_FIELD( 3, UINT32 , SINGULAR, STATIC , OTHER, firestore_BundleMetadata, version, create_time, 0),
  54. PB_FIELD( 4, UINT32 , SINGULAR, STATIC , OTHER, firestore_BundleMetadata, total_documents, version, 0),
  55. PB_FIELD( 5, UINT64 , SINGULAR, STATIC , OTHER, firestore_BundleMetadata, total_bytes, total_documents, 0),
  56. PB_LAST_FIELD
  57. };
  58. const pb_field_t firestore_BundleElement_fields[5] = {
  59. PB_ANONYMOUS_ONEOF_FIELD(element_type, 1, MESSAGE , ONEOF, STATIC , FIRST, firestore_BundleElement, metadata, metadata, &firestore_BundleMetadata_fields),
  60. PB_ANONYMOUS_ONEOF_FIELD(element_type, 2, MESSAGE , ONEOF, STATIC , UNION, firestore_BundleElement, named_query, named_query, &firestore_NamedQuery_fields),
  61. PB_ANONYMOUS_ONEOF_FIELD(element_type, 3, MESSAGE , ONEOF, STATIC , UNION, firestore_BundleElement, document_metadata, document_metadata, &firestore_BundledDocumentMetadata_fields),
  62. PB_ANONYMOUS_ONEOF_FIELD(element_type, 4, MESSAGE , ONEOF, STATIC , UNION, firestore_BundleElement, document, document, &google_firestore_v1_Document_fields),
  63. PB_LAST_FIELD
  64. };
  65. /* Check that field information fits in pb_field_t */
  66. #if !defined(PB_FIELD_32BIT)
  67. /* If you get an error here, it means that you need to define PB_FIELD_32BIT
  68. * compile-time option. You can do that in pb.h or on compiler command line.
  69. *
  70. * The reason you need to do this is that some of your messages contain tag
  71. * numbers or field sizes that are larger than what can fit in 8 or 16 bit
  72. * field descriptors.
  73. */
  74. PB_STATIC_ASSERT((pb_membersize(firestore_BundledQuery, structured_query) < 65536 && pb_membersize(firestore_NamedQuery, bundled_query) < 65536 && pb_membersize(firestore_NamedQuery, read_time) < 65536 && pb_membersize(firestore_BundledDocumentMetadata, read_time) < 65536 && pb_membersize(firestore_BundleMetadata, create_time) < 65536 && pb_membersize(firestore_BundleElement, metadata) < 65536 && pb_membersize(firestore_BundleElement, named_query) < 65536 && pb_membersize(firestore_BundleElement, document_metadata) < 65536 && pb_membersize(firestore_BundleElement, document) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_firestore_BundledQuery_firestore_NamedQuery_firestore_BundledDocumentMetadata_firestore_BundleMetadata_firestore_BundleElement)
  75. #endif
  76. #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
  77. /* If you get an error here, it means that you need to define PB_FIELD_16BIT
  78. * compile-time option. You can do that in pb.h or on compiler command line.
  79. *
  80. * The reason you need to do this is that some of your messages contain tag
  81. * numbers or field sizes that are larger than what can fit in the default
  82. * 8 bit descriptors.
  83. */
  84. PB_STATIC_ASSERT((pb_membersize(firestore_BundledQuery, structured_query) < 256 && pb_membersize(firestore_NamedQuery, bundled_query) < 256 && pb_membersize(firestore_NamedQuery, read_time) < 256 && pb_membersize(firestore_BundledDocumentMetadata, read_time) < 256 && pb_membersize(firestore_BundleMetadata, create_time) < 256 && pb_membersize(firestore_BundleElement, metadata) < 256 && pb_membersize(firestore_BundleElement, named_query) < 256 && pb_membersize(firestore_BundleElement, document_metadata) < 256 && pb_membersize(firestore_BundleElement, document) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_firestore_BundledQuery_firestore_NamedQuery_firestore_BundledDocumentMetadata_firestore_BundleMetadata_firestore_BundleElement)
  85. #endif
  86. const char* EnumToString(
  87. firestore_BundledQuery_LimitType value) {
  88. switch (value) {
  89. case firestore_BundledQuery_LimitType_FIRST:
  90. return "FIRST";
  91. case firestore_BundledQuery_LimitType_LAST:
  92. return "LAST";
  93. }
  94. return "<unknown enum value>";
  95. }
  96. std::string firestore_BundledQuery::ToString(int indent) const {
  97. std::string header = PrintHeader(indent, "BundledQuery", this);
  98. std::string result;
  99. result += PrintPrimitiveField("parent: ", parent, indent + 1, false);
  100. switch (which_query_type) {
  101. case firestore_BundledQuery_structured_query_tag:
  102. result += PrintMessageField("structured_query ",
  103. structured_query, indent + 1, true);
  104. break;
  105. }
  106. result += PrintEnumField("limit_type: ", limit_type, indent + 1, false);
  107. bool is_root = indent == 0;
  108. if (!result.empty() || is_root) {
  109. std::string tail = PrintTail(indent);
  110. return header + result + tail;
  111. } else {
  112. return "";
  113. }
  114. }
  115. std::string firestore_NamedQuery::ToString(int indent) const {
  116. std::string header = PrintHeader(indent, "NamedQuery", this);
  117. std::string result;
  118. result += PrintPrimitiveField("name: ", name, indent + 1, false);
  119. result += PrintMessageField("bundled_query ",
  120. bundled_query, indent + 1, false);
  121. result += PrintMessageField("read_time ", read_time, indent + 1, false);
  122. std::string tail = PrintTail(indent);
  123. return header + result + tail;
  124. }
  125. std::string firestore_BundledDocumentMetadata::ToString(int indent) const {
  126. std::string header = PrintHeader(indent, "BundledDocumentMetadata", this);
  127. std::string result;
  128. result += PrintPrimitiveField("name: ", name, indent + 1, false);
  129. result += PrintMessageField("read_time ", read_time, indent + 1, false);
  130. result += PrintPrimitiveField("exists: ", exists, indent + 1, false);
  131. for (pb_size_t i = 0; i != queries_count; ++i) {
  132. result += PrintPrimitiveField("queries: ",
  133. queries[i], indent + 1, true);
  134. }
  135. std::string tail = PrintTail(indent);
  136. return header + result + tail;
  137. }
  138. std::string firestore_BundleMetadata::ToString(int indent) const {
  139. std::string header = PrintHeader(indent, "BundleMetadata", this);
  140. std::string result;
  141. result += PrintPrimitiveField("id: ", id, indent + 1, false);
  142. result += PrintMessageField("create_time ",
  143. create_time, indent + 1, false);
  144. result += PrintPrimitiveField("version: ", version, indent + 1, false);
  145. result += PrintPrimitiveField("total_documents: ",
  146. total_documents, indent + 1, false);
  147. result += PrintPrimitiveField("total_bytes: ",
  148. total_bytes, indent + 1, false);
  149. std::string tail = PrintTail(indent);
  150. return header + result + tail;
  151. }
  152. std::string firestore_BundleElement::ToString(int indent) const {
  153. std::string header = PrintHeader(indent, "BundleElement", this);
  154. std::string result;
  155. switch (which_element_type) {
  156. case firestore_BundleElement_metadata_tag:
  157. result += PrintMessageField("metadata ", metadata, indent + 1, true);
  158. break;
  159. case firestore_BundleElement_named_query_tag:
  160. result += PrintMessageField("named_query ",
  161. named_query, indent + 1, true);
  162. break;
  163. case firestore_BundleElement_document_metadata_tag:
  164. result += PrintMessageField("document_metadata ",
  165. document_metadata, indent + 1, true);
  166. break;
  167. case firestore_BundleElement_document_tag:
  168. result += PrintMessageField("document ", document, indent + 1, true);
  169. break;
  170. }
  171. bool is_root = indent == 0;
  172. if (!result.empty() || is_root) {
  173. std::string tail = PrintTail(indent);
  174. return header + result + tail;
  175. } else {
  176. return "";
  177. }
  178. }
  179. } // namespace firestore
  180. } // namespace firebase
  181. /* @@protoc_insertion_point(eof) */