Utilities to process the field masks. Respects Google's AIP-161: https://google.aip.dev/161.
- An empty mask is treated as a mask with all fields.
- Map masks (i.e.
reviews
and reviews.smith
for map<string, string> reviews
).
- Wildcard masks for repeated and map fields (i.e.
authors
, authors.*
, authors.*.name
).
- Backticks (`) are separation charaters for problematic keys and may not appear in paths.
Definition at line 35 of file field_mask.hpp.
|
| FieldMask ()=default |
| Construct an empty field-mask.
|
|
| FieldMask (FieldMask &&)=default |
|
| FieldMask (const FieldMask &)=default |
|
FieldMask & | operator= (FieldMask &other)=default |
|
FieldMask & | operator= (FieldMask &&other)=default |
|
| FieldMask (const google::protobuf::FieldMask &field_mask) |
| Constructs the field-mask from a raw gRPC field-mask.
|
|
| FieldMask (std::string_view string, Encoding encoding) |
| Constructs the field-mask from its string representation.
|
|
std::string | ToString () const |
| Constructs a human-readable string representation of the field-mask.
|
|
std::string | ToWebSafeBase64 () const |
| Constructs a string representation of the field-mask suitable to transfer over the Internet.
|
|
void | AddPath (std::string_view path) |
| Adds a dot-separated path to the field mask. Backtick (`) is treated as a separation character according to AIP-161 and may not appear in the path.
|
|
void | CheckValidity (const google::protobuf::Descriptor *descriptor) const |
| Check if the field mask is valid for this message.
|
|
bool | IsPathFullyIn (std::string_view path) const |
| Does this field-mask fully contain the given path.
|
|
bool | IsPathPartiallyIn (std::string_view path) const |
| Does this field-mask contain the given path or any of its child paths.
|
|
void | Trim (google::protobuf::Message &message) const |
| Remove all fields not present in the field-mask from the message. The mask must be valid for this to work. Use IsValid to check.
|
|
void | TrimNoValidate (google::protobuf::Message &message) const |
| Same as Trim but does not perform pre-validation of the mask. You should not catch any errors generated by this method. Use this only if you are absolutely sure the mask is valid.
|
|
bool | IsLeaf () const |
| Checks if there are any nested masks inside this mask.
|
|
auto | GetFieldNames () const |
| Gets the names of all masked fields inside this mask. Returns an std::ranges::transform_view containing std::string_view.
|
|
std::vector< std::string_view > | GetFieldNamesList () const |
| Gets the names of all masked fields inside this mask. Returns an std::vector.
|
|
bool | HasFieldName (std::string_view field) const |
| Checks if the specified field is in the mask.
|
|
utils::OptionalRef< const FieldMask > | GetMaskForField (std::string_view field) const |
| Gets the nested mask or returns nullopt if the field is not in the mask.
|
|