cpp_features_pb.py 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. # Copyright (c) 2025-2026 Buf Technologies, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # Generated from google/protobuf/cpp_features.proto. DO NOT EDIT.
  15. # Generated by protoc-gen-py v0.1.1 with parameter "no_fmt_off".
  16. # ruff: noqa: PGH004
  17. # ruff: noqa
  18. from __future__ import annotations
  19. from typing import Final, Literal, TYPE_CHECKING, TypeAlias
  20. from protobuf import Enum, Extension, Message
  21. from protobuf._codegen import file_desc
  22. from . import descriptor_pb
  23. from .descriptor_pb import FeatureSet
  24. if TYPE_CHECKING:
  25. from protobuf import DescFile
  26. _CppFeaturesFields: TypeAlias = Literal[
  27. "legacy_closed_enum", "string_type", "enum_name_uses_string_view", "repeated_type"
  28. ]
  29. class CppFeatures(Message[_CppFeaturesFields]):
  30. """
  31. ```proto
  32. message pb.CppFeatures
  33. ```
  34. Attributes:
  35. legacy_closed_enum:
  36. Whether or not to treat an enum field as closed. This option is only
  37. applicable to enum fields, and will be removed in the future. It is
  38. consistent with the legacy behavior of using proto3 enum types for proto2
  39. fields.
  40. ```proto
  41. optional bool legacy_closed_enum = 1;
  42. ```
  43. string_type:
  44. ```proto
  45. optional pb.CppFeatures.StringType string_type = 2;
  46. ```
  47. enum_name_uses_string_view:
  48. ```proto
  49. optional bool enum_name_uses_string_view = 3;
  50. ```
  51. repeated_type:
  52. ```proto
  53. optional pb.CppFeatures.RepeatedType repeated_type = 4;
  54. ```
  55. """
  56. __slots__ = (
  57. "legacy_closed_enum",
  58. "string_type",
  59. "enum_name_uses_string_view",
  60. "repeated_type",
  61. )
  62. if TYPE_CHECKING:
  63. def __init__(
  64. self,
  65. *,
  66. legacy_closed_enum: bool | None = None,
  67. string_type: CppFeatures.StringType | None = None,
  68. enum_name_uses_string_view: bool | None = None,
  69. repeated_type: CppFeatures.RepeatedType | None = None,
  70. ) -> None:
  71. pass
  72. legacy_closed_enum: bool
  73. string_type: CppFeatures.StringType
  74. enum_name_uses_string_view: bool
  75. repeated_type: CppFeatures.RepeatedType
  76. class StringType(Enum):
  77. """
  78. ```proto
  79. enum pb.CppFeatures.StringType
  80. ```
  81. Attributes:
  82. UNKNOWN:
  83. ```proto
  84. STRING_TYPE_UNKNOWN = 0
  85. ```
  86. VIEW:
  87. ```proto
  88. VIEW = 1
  89. ```
  90. CORD:
  91. ```proto
  92. CORD = 2
  93. ```
  94. STRING:
  95. ```proto
  96. STRING = 3
  97. ```
  98. """
  99. UNKNOWN = 0
  100. VIEW = 1
  101. CORD = 2
  102. STRING = 3
  103. class RepeatedType(Enum):
  104. """
  105. ```proto
  106. enum pb.CppFeatures.RepeatedType
  107. ```
  108. Attributes:
  109. UNKNOWN:
  110. ```proto
  111. REPEATED_TYPE_UNKNOWN = 0
  112. ```
  113. LEGACY:
  114. The repeated field will be backed by proto2::Repeated(Ptr)Field, and
  115. accessors will return a reference/pointer to this type.
  116. ```proto
  117. LEGACY = 1
  118. ```
  119. PROXY:
  120. The repeated field has an opaque backing type, and accessors will return
  121. a RepeatedFieldProxy.
  122. ```proto
  123. PROXY = 2
  124. ```
  125. """
  126. UNKNOWN = 0
  127. LEGACY = 1
  128. PROXY = 2
  129. ext_cpp: Final[Extension[FeatureSet, CppFeatures]] = Extension()
  130. """
  131. ```proto
  132. extend google.protobuf.FeatureSet { optional pb.CppFeatures cpp = 1000 [json_name = "[pb.cpp]"] }
  133. ```
  134. """
  135. _DESC = file_desc(
  136. b'\n"google/protobuf/cpp_features.proto\x12\x02pb\x1a google/protobuf/descriptor.proto"\xd6\x05\n\x0bCppFeatures\x12\x8d\x02\n\x12legacy_closed_enum\x18\x01 \x01(\x08R\x10legacyClosedEnumB\xde\x01\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\t\x18\x84\x07\x12\x04true\xa2\x01\n\x18\xe7\x07\x12\x05false\xb2\x01\xb8\x01\x08\xe8\x07\x10\xe8\x07\x1a\xaf\x01The legacy closed enum behavior in C++ is deprecated and is scheduled to be removed in edition 2025. See http://protobuf.dev/programming-guides/enum/#cpp for more information\x12f\n\x0bstring_type\x18\x02 \x01(\x0e2\x1a.pb.CppFeatures.StringTypeR\nstringTypeB)\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\x0b\x18\x84\x07\x12\x06STRING\xa2\x01\t\x18\xe9\x07\x12\x04VIEW\xb2\x01\x03\x08\xe8\x07\x12d\n\x1aenum_name_uses_string_view\x18\x03 \x01(\x08R\x16enumNameUsesStringViewB(\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\n\x18\x84\x07\x12\x05false\xa2\x01\t\x18\xe9\x07\x12\x04true\xb2\x01\x03\x08\xe9\x07\x12`\n\rrepeated_type\x18\x04 \x01(\x0e2\x1c.pb.CppFeatures.RepeatedTypeR\x0crepeatedTypeB\x1d\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\x0b\x18\x84\x07\x12\x06LEGACY\xb2\x01\x03\x08\x8fN"E\n\nStringType\x12\x17\n\x13STRING_TYPE_UNKNOWN\x10\x00\x12\x08\n\x04VIEW\x10\x01\x12\x08\n\x04CORD\x10\x02\x12\n\n\x06STRING\x10\x03"@\n\x0cRepeatedType\x12\x19\n\x15REPEATED_TYPE_UNKNOWN\x10\x00\x12\n\n\x06LEGACY\x10\x01\x12\t\n\x05PROXY\x10\x02:?\n\x03cpp\x18\xe8\x07 \x01(\x0b2\x0f.pb.CppFeatures\x12\x1b.google.protobuf.FeatureSetR\x03cpp',
  137. [descriptor_pb.desc()],
  138. {
  139. "CppFeatures": CppFeatures,
  140. "CppFeatures.StringType": CppFeatures.StringType,
  141. "CppFeatures.RepeatedType": CppFeatures.RepeatedType,
  142. "cpp": ext_cpp,
  143. },
  144. )
  145. def desc() -> DescFile:
  146. """Returns the descriptor for the file `google/protobuf/cpp_features.proto`."""
  147. return _DESC