document.nanopb.cc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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 "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 google_firestore_v1_Document_fields[5] = {
  32. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_Document, name, name, 0),
  33. PB_FIELD( 2, MESSAGE , REPEATED, POINTER , OTHER, google_firestore_v1_Document, fields, name, &google_firestore_v1_Document_FieldsEntry_fields),
  34. PB_FIELD( 3, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_Document, create_time, fields, &google_protobuf_Timestamp_fields),
  35. PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, google_firestore_v1_Document, update_time, create_time, &google_protobuf_Timestamp_fields),
  36. PB_LAST_FIELD
  37. };
  38. const pb_field_t google_firestore_v1_Document_FieldsEntry_fields[3] = {
  39. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_Document_FieldsEntry, key, key, 0),
  40. PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_Document_FieldsEntry, value, key, &google_firestore_v1_Value_fields),
  41. PB_LAST_FIELD
  42. };
  43. const pb_field_t google_firestore_v1_Value_fields[12] = {
  44. PB_ANONYMOUS_ONEOF_FIELD(value_type, 1, BOOL , ONEOF, STATIC , FIRST, google_firestore_v1_Value, boolean_value, boolean_value, 0),
  45. PB_ANONYMOUS_ONEOF_FIELD(value_type, 2, INT64 , ONEOF, STATIC , UNION, google_firestore_v1_Value, integer_value, integer_value, 0),
  46. PB_ANONYMOUS_ONEOF_FIELD(value_type, 3, DOUBLE , ONEOF, STATIC , UNION, google_firestore_v1_Value, double_value, double_value, 0),
  47. PB_ANONYMOUS_ONEOF_FIELD(value_type, 5, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_Value, reference_value, reference_value, 0),
  48. PB_ANONYMOUS_ONEOF_FIELD(value_type, 6, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Value, map_value, map_value, &google_firestore_v1_MapValue_fields),
  49. PB_ANONYMOUS_ONEOF_FIELD(value_type, 8, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Value, geo_point_value, geo_point_value, &google_type_LatLng_fields),
  50. PB_ANONYMOUS_ONEOF_FIELD(value_type, 9, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Value, array_value, array_value, &google_firestore_v1_ArrayValue_fields),
  51. PB_ANONYMOUS_ONEOF_FIELD(value_type, 10, MESSAGE , ONEOF, STATIC , UNION, google_firestore_v1_Value, timestamp_value, timestamp_value, &google_protobuf_Timestamp_fields),
  52. PB_ANONYMOUS_ONEOF_FIELD(value_type, 11, UENUM , ONEOF, STATIC , UNION, google_firestore_v1_Value, null_value, null_value, 0),
  53. PB_ANONYMOUS_ONEOF_FIELD(value_type, 17, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_Value, string_value, string_value, 0),
  54. PB_ANONYMOUS_ONEOF_FIELD(value_type, 18, BYTES , ONEOF, POINTER , UNION, google_firestore_v1_Value, bytes_value, bytes_value, 0),
  55. PB_LAST_FIELD
  56. };
  57. const pb_field_t google_firestore_v1_ArrayValue_fields[2] = {
  58. PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_firestore_v1_ArrayValue, values, values, &google_firestore_v1_Value_fields),
  59. PB_LAST_FIELD
  60. };
  61. const pb_field_t google_firestore_v1_MapValue_fields[2] = {
  62. PB_FIELD( 1, MESSAGE , REPEATED, POINTER , FIRST, google_firestore_v1_MapValue, fields, fields, &google_firestore_v1_MapValue_FieldsEntry_fields),
  63. PB_LAST_FIELD
  64. };
  65. const pb_field_t google_firestore_v1_MapValue_FieldsEntry_fields[3] = {
  66. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_firestore_v1_MapValue_FieldsEntry, key, key, 0),
  67. PB_FIELD( 2, MESSAGE , SINGULAR, STATIC , OTHER, google_firestore_v1_MapValue_FieldsEntry, value, key, &google_firestore_v1_Value_fields),
  68. PB_LAST_FIELD
  69. };
  70. /* Check that field information fits in pb_field_t */
  71. #if !defined(PB_FIELD_32BIT)
  72. /* If you get an error here, it means that you need to define PB_FIELD_32BIT
  73. * compile-time option. You can do that in pb.h or on compiler command line.
  74. *
  75. * The reason you need to do this is that some of your messages contain tag
  76. * numbers or field sizes that are larger than what can fit in 8 or 16 bit
  77. * field descriptors.
  78. */
  79. PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Document, create_time) < 65536 && pb_membersize(google_firestore_v1_Document, update_time) < 65536 && pb_membersize(google_firestore_v1_Document_FieldsEntry, value) < 65536 && pb_membersize(google_firestore_v1_Value, map_value) < 65536 && pb_membersize(google_firestore_v1_Value, geo_point_value) < 65536 && pb_membersize(google_firestore_v1_Value, array_value) < 65536 && pb_membersize(google_firestore_v1_Value, timestamp_value) < 65536 && pb_membersize(google_firestore_v1_MapValue_FieldsEntry, value) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_firestore_v1_Document_google_firestore_v1_Document_FieldsEntry_google_firestore_v1_Value_google_firestore_v1_ArrayValue_google_firestore_v1_MapValue_google_firestore_v1_MapValue_FieldsEntry)
  80. #endif
  81. #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
  82. /* If you get an error here, it means that you need to define PB_FIELD_16BIT
  83. * compile-time option. You can do that in pb.h or on compiler command line.
  84. *
  85. * The reason you need to do this is that some of your messages contain tag
  86. * numbers or field sizes that are larger than what can fit in the default
  87. * 8 bit descriptors.
  88. */
  89. PB_STATIC_ASSERT((pb_membersize(google_firestore_v1_Document, create_time) < 256 && pb_membersize(google_firestore_v1_Document, update_time) < 256 && pb_membersize(google_firestore_v1_Document_FieldsEntry, value) < 256 && pb_membersize(google_firestore_v1_Value, map_value) < 256 && pb_membersize(google_firestore_v1_Value, geo_point_value) < 256 && pb_membersize(google_firestore_v1_Value, array_value) < 256 && pb_membersize(google_firestore_v1_Value, timestamp_value) < 256 && pb_membersize(google_firestore_v1_MapValue_FieldsEntry, value) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_firestore_v1_Document_google_firestore_v1_Document_FieldsEntry_google_firestore_v1_Value_google_firestore_v1_ArrayValue_google_firestore_v1_MapValue_google_firestore_v1_MapValue_FieldsEntry)
  90. #endif
  91. /* On some platforms (such as AVR), double is really float.
  92. * These are not directly supported by nanopb, but see example_avr_double.
  93. * To get rid of this error, remove any double fields from your .proto.
  94. */
  95. PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
  96. std::string google_firestore_v1_Document::ToString(int indent) const {
  97. std::string tostring_header = PrintHeader(indent, "Document", this);
  98. std::string tostring_result;
  99. tostring_result += PrintPrimitiveField("name: ", name, indent + 1, false);
  100. for (pb_size_t i = 0; i != fields_count; ++i) {
  101. tostring_result += PrintMessageField("fields ",
  102. fields[i], indent + 1, true);
  103. }
  104. tostring_result += PrintMessageField("create_time ",
  105. create_time, indent + 1, false);
  106. if (has_update_time) {
  107. tostring_result += PrintMessageField("update_time ",
  108. update_time, indent + 1, true);
  109. }
  110. std::string tostring_tail = PrintTail(indent);
  111. return tostring_header + tostring_result + tostring_tail;
  112. }
  113. std::string google_firestore_v1_Document_FieldsEntry::ToString(int indent) const {
  114. std::string tostring_header = PrintHeader(indent, "FieldsEntry", this);
  115. std::string tostring_result;
  116. tostring_result += PrintPrimitiveField("key: ", key, indent + 1, false);
  117. tostring_result += PrintMessageField("value ", value, indent + 1, false);
  118. std::string tostring_tail = PrintTail(indent);
  119. return tostring_header + tostring_result + tostring_tail;
  120. }
  121. std::string google_firestore_v1_Value::ToString(int indent) const {
  122. std::string tostring_header = PrintHeader(indent, "Value", this);
  123. std::string tostring_result;
  124. switch (which_value_type) {
  125. case google_firestore_v1_Value_boolean_value_tag:
  126. tostring_result += PrintPrimitiveField("boolean_value: ",
  127. boolean_value, indent + 1, true);
  128. break;
  129. case google_firestore_v1_Value_integer_value_tag:
  130. tostring_result += PrintPrimitiveField("integer_value: ",
  131. integer_value, indent + 1, true);
  132. break;
  133. case google_firestore_v1_Value_double_value_tag:
  134. tostring_result += PrintPrimitiveField("double_value: ",
  135. double_value, indent + 1, true);
  136. break;
  137. case google_firestore_v1_Value_reference_value_tag:
  138. tostring_result += PrintPrimitiveField("reference_value: ",
  139. reference_value, indent + 1, true);
  140. break;
  141. case google_firestore_v1_Value_map_value_tag:
  142. tostring_result += PrintMessageField("map_value ",
  143. map_value, indent + 1, true);
  144. break;
  145. case google_firestore_v1_Value_geo_point_value_tag:
  146. tostring_result += PrintMessageField("geo_point_value ",
  147. geo_point_value, indent + 1, true);
  148. break;
  149. case google_firestore_v1_Value_array_value_tag:
  150. tostring_result += PrintMessageField("array_value ",
  151. array_value, indent + 1, true);
  152. break;
  153. case google_firestore_v1_Value_timestamp_value_tag:
  154. tostring_result += PrintMessageField("timestamp_value ",
  155. timestamp_value, indent + 1, true);
  156. break;
  157. case google_firestore_v1_Value_null_value_tag:
  158. tostring_result += PrintEnumField("null_value: ",
  159. null_value, indent + 1, true);
  160. break;
  161. case google_firestore_v1_Value_string_value_tag:
  162. tostring_result += PrintPrimitiveField("string_value: ",
  163. string_value, indent + 1, true);
  164. break;
  165. case google_firestore_v1_Value_bytes_value_tag:
  166. tostring_result += PrintPrimitiveField("bytes_value: ",
  167. bytes_value, indent + 1, true);
  168. break;
  169. }
  170. bool is_root = indent == 0;
  171. if (!tostring_result.empty() || is_root) {
  172. std::string tostring_tail = PrintTail(indent);
  173. return tostring_header + tostring_result + tostring_tail;
  174. } else {
  175. return "";
  176. }
  177. }
  178. std::string google_firestore_v1_ArrayValue::ToString(int indent) const {
  179. std::string tostring_header = PrintHeader(indent, "ArrayValue", this);
  180. std::string tostring_result;
  181. for (pb_size_t i = 0; i != values_count; ++i) {
  182. tostring_result += PrintMessageField("values ",
  183. values[i], indent + 1, true);
  184. }
  185. bool is_root = indent == 0;
  186. if (!tostring_result.empty() || is_root) {
  187. std::string tostring_tail = PrintTail(indent);
  188. return tostring_header + tostring_result + tostring_tail;
  189. } else {
  190. return "";
  191. }
  192. }
  193. std::string google_firestore_v1_MapValue::ToString(int indent) const {
  194. std::string tostring_header = PrintHeader(indent, "MapValue", this);
  195. std::string tostring_result;
  196. for (pb_size_t i = 0; i != fields_count; ++i) {
  197. tostring_result += PrintMessageField("fields ",
  198. fields[i], indent + 1, true);
  199. }
  200. bool is_root = indent == 0;
  201. if (!tostring_result.empty() || is_root) {
  202. std::string tostring_tail = PrintTail(indent);
  203. return tostring_header + tostring_result + tostring_tail;
  204. } else {
  205. return "";
  206. }
  207. }
  208. std::string google_firestore_v1_MapValue_FieldsEntry::ToString(int indent) const {
  209. std::string tostring_header = PrintHeader(indent, "FieldsEntry", this);
  210. std::string tostring_result;
  211. tostring_result += PrintPrimitiveField("key: ", key, indent + 1, false);
  212. tostring_result += PrintMessageField("value ", value, indent + 1, false);
  213. std::string tostring_tail = PrintTail(indent);
  214. return tostring_header + tostring_result + tostring_tail;
  215. }
  216. } // namespace firestore
  217. } // namespace firebase
  218. /* @@protoc_insertion_point(eof) */