resource.nanopb.cc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 "resource.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_api_ResourceDescriptor_fields[7] = {
  32. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_api_ResourceDescriptor, type, type, 0),
  33. PB_FIELD( 2, BYTES , REPEATED, POINTER , OTHER, google_api_ResourceDescriptor, pattern, type, 0),
  34. PB_FIELD( 3, BYTES , SINGULAR, POINTER , OTHER, google_api_ResourceDescriptor, name_field, pattern, 0),
  35. PB_FIELD( 4, UENUM , SINGULAR, STATIC , OTHER, google_api_ResourceDescriptor, history, name_field, 0),
  36. PB_FIELD( 5, BYTES , SINGULAR, POINTER , OTHER, google_api_ResourceDescriptor, plural, history, 0),
  37. PB_FIELD( 6, BYTES , SINGULAR, POINTER , OTHER, google_api_ResourceDescriptor, singular, plural, 0),
  38. PB_LAST_FIELD
  39. };
  40. const pb_field_t google_api_ResourceReference_fields[3] = {
  41. PB_FIELD( 1, BYTES , SINGULAR, POINTER , FIRST, google_api_ResourceReference, type, type, 0),
  42. PB_FIELD( 2, BYTES , SINGULAR, POINTER , OTHER, google_api_ResourceReference, child_type, type, 0),
  43. PB_LAST_FIELD
  44. };
  45. /* Check that field information fits in pb_field_t */
  46. #if !defined(PB_FIELD_32BIT)
  47. /* If you get an error here, it means that you need to define PB_FIELD_32BIT
  48. * compile-time option. You can do that in pb.h or on compiler command line.
  49. *
  50. * The reason you need to do this is that some of your messages contain tag
  51. * numbers or field sizes that are larger than what can fit in 8 or 16 bit
  52. * field descriptors.
  53. */
  54. PB_STATIC_ASSERT((pb_membersize(google_api_resource_reference_struct, resource_reference) < 65536 && pb_membersize(google_api_resource_struct, resource) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_api_ResourceDescriptor_google_api_ResourceReference)
  55. #endif
  56. #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
  57. #error Field descriptor for google_api_resource_reference_struct.resource_reference is too large. Define PB_FIELD_16BIT to fix this.
  58. #endif
  59. const char* EnumToString(
  60. google_api_ResourceDescriptor_History value) {
  61. switch (value) {
  62. case google_api_ResourceDescriptor_History_HISTORY_UNSPECIFIED:
  63. return "HISTORY_UNSPECIFIED";
  64. case google_api_ResourceDescriptor_History_ORIGINALLY_SINGLE_PATTERN:
  65. return "ORIGINALLY_SINGLE_PATTERN";
  66. case google_api_ResourceDescriptor_History_FUTURE_MULTI_PATTERN:
  67. return "FUTURE_MULTI_PATTERN";
  68. }
  69. return "<unknown enum value>";
  70. }
  71. std::string google_api_ResourceDescriptor::ToString(int indent) const {
  72. std::string tostring_header = PrintHeader(indent, "ResourceDescriptor", this);
  73. std::string tostring_result;
  74. tostring_result += PrintPrimitiveField("type: ", type, indent + 1, false);
  75. for (pb_size_t i = 0; i != pattern_count; ++i) {
  76. tostring_result += PrintPrimitiveField("pattern: ",
  77. pattern[i], indent + 1, true);
  78. }
  79. tostring_result += PrintPrimitiveField("name_field: ",
  80. name_field, indent + 1, false);
  81. tostring_result += PrintEnumField("history: ", history, indent + 1, false);
  82. tostring_result += PrintPrimitiveField("plural: ",
  83. plural, indent + 1, false);
  84. tostring_result += PrintPrimitiveField("singular: ",
  85. singular, indent + 1, false);
  86. bool is_root = indent == 0;
  87. if (!tostring_result.empty() || is_root) {
  88. std::string tostring_tail = PrintTail(indent);
  89. return tostring_header + tostring_result + tostring_tail;
  90. } else {
  91. return "";
  92. }
  93. }
  94. std::string google_api_ResourceReference::ToString(int indent) const {
  95. std::string tostring_header = PrintHeader(indent, "ResourceReference", this);
  96. std::string tostring_result;
  97. tostring_result += PrintPrimitiveField("type: ", type, indent + 1, false);
  98. tostring_result += PrintPrimitiveField("child_type: ",
  99. child_type, indent + 1, false);
  100. bool is_root = indent == 0;
  101. if (!tostring_result.empty() || is_root) {
  102. std::string tostring_tail = PrintTail(indent);
  103. return tostring_header + tostring_result + tostring_tail;
  104. } else {
  105. return "";
  106. }
  107. }
  108. } // namespace firestore
  109. } // namespace firebase
  110. /* @@protoc_insertion_point(eof) */