cpp_features.proto 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. edition_defaults = { edition: EDITION_PROTO2, value: "true" },
  23. edition_defaults = { edition: EDITION_PROTO3, value: "false" }
  24. ];
  25. enum StringType {
  26. STRING_TYPE_UNKNOWN = 0;
  27. VIEW = 1;
  28. CORD = 2;
  29. STRING = 3;
  30. }
  31. optional StringType string_type = 2 [
  32. retention = RETENTION_RUNTIME,
  33. targets = TARGET_TYPE_FIELD,
  34. targets = TARGET_TYPE_FILE,
  35. edition_defaults = { edition: EDITION_PROTO2, value: "STRING" },
  36. edition_defaults = { edition: EDITION_2024, value: "VIEW" }
  37. ];
  38. }