1 // Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT.
2
3 #ifndef PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_ANDROID_PRIVACY_PROTO_H_
4 #define PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_ANDROID_PRIVACY_PROTO_H_
5
6 #include <stddef.h>
7 #include <stdint.h>
8
9 #include "perfetto/protozero/field_writer.h"
10 #include "perfetto/protozero/message.h"
11 #include "perfetto/protozero/packed_repeated_fields.h"
12 #include "perfetto/protozero/proto_decoder.h"
13 #include "perfetto/protozero/proto_utils.h"
14
15 namespace perfetto {
16 namespace protos {
17 namespace pbzero {
18 enum Destination : int32_t;
19 } // Namespace pbzero.
20 } // Namespace protos.
21 } // Namespace perfetto.
22
23 namespace perfetto {
24 namespace protos {
25 namespace pbzero {
26
27 enum Destination : int32_t {
28 DEST_LOCAL = 0,
29 DEST_EXPLICIT = 100,
30 DEST_AUTOMATIC = 200,
31 DEST_UNSET = 255,
32 };
33
34 constexpr Destination Destination_MIN = Destination::DEST_LOCAL;
35 constexpr Destination Destination_MAX = Destination::DEST_UNSET;
36
37
38 PERFETTO_PROTOZERO_CONSTEXPR14_OR_INLINE
Destination_Name(::perfetto::protos::pbzero::Destination value)39 const char* Destination_Name(::perfetto::protos::pbzero::Destination value) {
40 switch (value) {
41 case ::perfetto::protos::pbzero::Destination::DEST_LOCAL:
42 return "DEST_LOCAL";
43
44 case ::perfetto::protos::pbzero::Destination::DEST_EXPLICIT:
45 return "DEST_EXPLICIT";
46
47 case ::perfetto::protos::pbzero::Destination::DEST_AUTOMATIC:
48 return "DEST_AUTOMATIC";
49
50 case ::perfetto::protos::pbzero::Destination::DEST_UNSET:
51 return "DEST_UNSET";
52 }
53 return "PBZERO_UNKNOWN_ENUM_VALUE";
54 }
55
56 class PrivacyFlags_Decoder : public ::protozero::TypedProtoDecoder</*MAX_FIELD_ID=*/2, /*HAS_NONPACKED_REPEATED_FIELDS=*/true> {
57 public:
PrivacyFlags_Decoder(const uint8_t * data,size_t len)58 PrivacyFlags_Decoder(const uint8_t* data, size_t len) : TypedProtoDecoder(data, len) {}
PrivacyFlags_Decoder(const std::string & raw)59 explicit PrivacyFlags_Decoder(const std::string& raw) : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), raw.size()) {}
PrivacyFlags_Decoder(const::protozero::ConstBytes & raw)60 explicit PrivacyFlags_Decoder(const ::protozero::ConstBytes& raw) : TypedProtoDecoder(raw.data, raw.size) {}
has_dest()61 bool has_dest() const { return at<1>().valid(); }
dest()62 int32_t dest() const { return at<1>().as_int32(); }
has_patterns()63 bool has_patterns() const { return at<2>().valid(); }
patterns()64 ::protozero::RepeatedFieldIterator<::protozero::ConstChars> patterns() const { return GetRepeated<::protozero::ConstChars>(2); }
65 };
66
67 class PrivacyFlags : public ::protozero::Message {
68 public:
69 using Decoder = PrivacyFlags_Decoder;
70 enum : int32_t {
71 kDestFieldNumber = 1,
72 kPatternsFieldNumber = 2,
73 };
GetName()74 static constexpr const char* GetName() { return ".perfetto.protos.PrivacyFlags"; }
75
76
77 using FieldMetadata_Dest =
78 ::protozero::proto_utils::FieldMetadata<
79 1,
80 ::protozero::proto_utils::RepetitionType::kNotRepeated,
81 ::protozero::proto_utils::ProtoSchemaType::kEnum,
82 Destination,
83 PrivacyFlags>;
84
85 static constexpr FieldMetadata_Dest kDest{};
set_dest(Destination value)86 void set_dest(Destination value) {
87 static constexpr uint32_t field_id = FieldMetadata_Dest::kFieldId;
88 // Call the appropriate protozero::Message::Append(field_id, ...)
89 // method based on the type of the field.
90 ::protozero::internal::FieldWriter<
91 ::protozero::proto_utils::ProtoSchemaType::kEnum>
92 ::Append(*this, field_id, value);
93 }
94
95 using FieldMetadata_Patterns =
96 ::protozero::proto_utils::FieldMetadata<
97 2,
98 ::protozero::proto_utils::RepetitionType::kRepeatedNotPacked,
99 ::protozero::proto_utils::ProtoSchemaType::kString,
100 std::string,
101 PrivacyFlags>;
102
103 static constexpr FieldMetadata_Patterns kPatterns{};
add_patterns(const char * data,size_t size)104 void add_patterns(const char* data, size_t size) {
105 AppendBytes(FieldMetadata_Patterns::kFieldId, data, size);
106 }
add_patterns(::protozero::ConstChars chars)107 void add_patterns(::protozero::ConstChars chars) {
108 AppendBytes(FieldMetadata_Patterns::kFieldId, chars.data, chars.size);
109 }
add_patterns(std::string value)110 void add_patterns(std::string value) {
111 static constexpr uint32_t field_id = FieldMetadata_Patterns::kFieldId;
112 // Call the appropriate protozero::Message::Append(field_id, ...)
113 // method based on the type of the field.
114 ::protozero::internal::FieldWriter<
115 ::protozero::proto_utils::ProtoSchemaType::kString>
116 ::Append(*this, field_id, value);
117 }
118 };
119
120 } // Namespace.
121 } // Namespace.
122 } // Namespace.
123 #endif // Include guard.
124