cpp_features.proto 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2023 Google Inc. All rights reserved.
  3. //
  4. // Use of this source code is governed by a BSD-style
  5. // license that can be found in the LICENSE file or at
  6. // https://developers.google.com/open-source/licenses/bsd
  7. syntax = "proto2";
  8. package pb;
  9. import "google/protobuf/descriptor.proto";
  10. extend google.protobuf.FeatureSet {
  11. optional CppFeatures cpp = 1000;
  12. }
  13. message CppFeatures {
  14. // Whether or not to treat an enum field as closed. This option is only
  15. // applicable to enum fields, and will be removed in the future. It is
  16. // consistent with the legacy behavior of using proto3 enum types for proto2
  17. // fields.
  18. optional bool legacy_closed_enum = 1 [
  19. retention = RETENTION_RUNTIME,
  20. targets = TARGET_TYPE_FIELD,
  21. targets = TARGET_TYPE_FILE,
  22. feature_support = {
  23. edition_introduced: EDITION_2023,
  24. edition_deprecated: EDITION_2023,
  25. deprecation_warning: "The legacy closed enum behavior in C++ is "
  26. "deprecated and is scheduled to be removed in "
  27. "edition 2025. See http://protobuf.dev/programming-guides/enum/#cpp for "
  28. "more information",
  29. },
  30. edition_defaults = { edition: EDITION_LEGACY, value: "true" },
  31. edition_defaults = { edition: EDITION_PROTO3, value: "false" }
  32. ];
  33. enum StringType {
  34. STRING_TYPE_UNKNOWN = 0;
  35. VIEW = 1;
  36. CORD = 2;
  37. STRING = 3;
  38. }
  39. optional StringType string_type = 2 [
  40. retention = RETENTION_RUNTIME,
  41. targets = TARGET_TYPE_FIELD,
  42. targets = TARGET_TYPE_FILE,
  43. feature_support = {
  44. edition_introduced: EDITION_2023,
  45. },
  46. edition_defaults = { edition: EDITION_LEGACY, value: "STRING" },
  47. edition_defaults = { edition: EDITION_2024, value: "VIEW" }
  48. ];
  49. optional bool enum_name_uses_string_view = 3 [
  50. retention = RETENTION_SOURCE,
  51. targets = TARGET_TYPE_ENUM,
  52. targets = TARGET_TYPE_FILE,
  53. feature_support = {
  54. edition_introduced: EDITION_2024,
  55. },
  56. edition_defaults = { edition: EDITION_LEGACY, value: "false" },
  57. edition_defaults = { edition: EDITION_2024, value: "true" }
  58. ];
  59. }