bundle.nanopb.cc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /*
  2. * Copyright 2023 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 tostring_header = PrintHeader(indent, "BundledQuery", this);
  98. std::string tostring_result;
  99. tostring_result += PrintPrimitiveField("parent: ",
  100. parent, indent + 1, false);
  101. switch (which_query_type) {
  102. case firestore_BundledQuery_structured_query_tag:
  103. tostring_result += PrintMessageField("structured_query ",
  104. structured_query, indent + 1, true);
  105. break;
  106. }
  107. tostring_result += PrintEnumField("limit_type: ",
  108. limit_type, indent + 1, false);
  109. bool is_root = indent == 0;
  110. if (!tostring_result.empty() || is_root) {
  111. std::string tostring_tail = PrintTail(indent);
  112. return tostring_header + tostring_result + tostring_tail;
  113. } else {
  114. return "";
  115. }
  116. }
  117. std::string firestore_NamedQuery::ToString(int indent) const {
  118. std::string tostring_header = PrintHeader(indent, "NamedQuery", this);
  119. std::string tostring_result;
  120. tostring_result += PrintPrimitiveField("name: ", name, indent + 1, false);
  121. tostring_result += PrintMessageField("bundled_query ",
  122. bundled_query, indent + 1, false);
  123. tostring_result += PrintMessageField("read_time ",
  124. read_time, indent + 1, false);
  125. std::string tostring_tail = PrintTail(indent);
  126. return tostring_header + tostring_result + tostring_tail;
  127. }
  128. std::string firestore_BundledDocumentMetadata::ToString(int indent) const {
  129. std::string tostring_header = PrintHeader(indent, "BundledDocumentMetadata", this);
  130. std::string tostring_result;
  131. tostring_result += PrintPrimitiveField("name: ", name, indent + 1, false);
  132. tostring_result += PrintMessageField("read_time ",
  133. read_time, indent + 1, false);
  134. tostring_result += PrintPrimitiveField("exists: ",
  135. exists, indent + 1, false);
  136. for (pb_size_t i = 0; i != queries_count; ++i) {
  137. tostring_result += PrintPrimitiveField("queries: ",
  138. queries[i], indent + 1, true);
  139. }
  140. std::string tostring_tail = PrintTail(indent);
  141. return tostring_header + tostring_result + tostring_tail;
  142. }
  143. std::string firestore_BundleMetadata::ToString(int indent) const {
  144. std::string tostring_header = PrintHeader(indent, "BundleMetadata", this);
  145. std::string tostring_result;
  146. tostring_result += PrintPrimitiveField("id: ", id, indent + 1, false);
  147. tostring_result += PrintMessageField("create_time ",
  148. create_time, indent + 1, false);
  149. tostring_result += PrintPrimitiveField("version: ",
  150. version, indent + 1, false);
  151. tostring_result += PrintPrimitiveField("total_documents: ",
  152. total_documents, indent + 1, false);
  153. tostring_result += PrintPrimitiveField("total_bytes: ",
  154. total_bytes, indent + 1, false);
  155. std::string tostring_tail = PrintTail(indent);
  156. return tostring_header + tostring_result + tostring_tail;
  157. }
  158. std::string firestore_BundleElement::ToString(int indent) const {
  159. std::string tostring_header = PrintHeader(indent, "BundleElement", this);
  160. std::string tostring_result;
  161. switch (which_element_type) {
  162. case firestore_BundleElement_metadata_tag:
  163. tostring_result += PrintMessageField("metadata ",
  164. metadata, indent + 1, true);
  165. break;
  166. case firestore_BundleElement_named_query_tag:
  167. tostring_result += PrintMessageField("named_query ",
  168. named_query, indent + 1, true);
  169. break;
  170. case firestore_BundleElement_document_metadata_tag:
  171. tostring_result += PrintMessageField("document_metadata ",
  172. document_metadata, indent + 1, true);
  173. break;
  174. case firestore_BundleElement_document_tag:
  175. tostring_result += PrintMessageField("document ",
  176. document, indent + 1, true);
  177. break;
  178. }
  179. bool is_root = indent == 0;
  180. if (!tostring_result.empty() || is_root) {
  181. std::string tostring_tail = PrintTail(indent);
  182. return tostring_header + tostring_result + tostring_tail;
  183. } else {
  184. return "";
  185. }
  186. }
  187. } // namespace firestore
  188. } // namespace firebase
  189. /* @@protoc_insertion_point(eof) */