aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/util/field_mask_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/util/field_mask_util.h')
-rw-r--r--src/google/protobuf/util/field_mask_util.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/google/protobuf/util/field_mask_util.h b/src/google/protobuf/util/field_mask_util.h
index 644161b9..e79b65e9 100644
--- a/src/google/protobuf/util/field_mask_util.h
+++ b/src/google/protobuf/util/field_mask_util.h
@@ -107,10 +107,16 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil {
static bool IsPathInFieldMask(StringPiece path, const FieldMask& mask);
class MergeOptions;
- // Merges fields specified in a FieldMask into another message.
+ // Merges fields specified in a FieldMask into another message. See the
+ // comments in MergeOptions regarding compatibility with
+ // google/protobuf/field_mask.proto
static void MergeMessageTo(const Message& source, const FieldMask& mask,
const MergeOptions& options, Message* destination);
+ // Removes from 'message' any field that is not represented in the given
+ // FieldMask. If the FieldMask is empty, does nothing.
+ static void TrimMessage(const FieldMask& mask, Message* message);
+
private:
friend class SnakeCaseCamelCaseTest;
// Converts a field name from snake_case to camelCase:
@@ -148,6 +154,10 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil {
FieldMask* out);
};
+// Note that for compatibility with the defined behaviour for FieldMask in
+// google/protobuf/field_mask.proto, set replace_message_fields and
+// replace_repeated_fields to 'true'. The default options are not compatible
+// with google/protobuf/field_mask.proto.
class LIBPROTOBUF_EXPORT FieldMaskUtil::MergeOptions {
public:
MergeOptions()