diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-10-18 12:22:18 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-10-18 12:22:18 -0700 |
commit | 1a7a7fca804afa1cf67f8be5e71092898ba40334 (patch) | |
tree | 04b3da27c71c607510f34a12cf7856a1b94181ae /src/google/protobuf/util/field_mask_util.h | |
parent | c4f59dcc5c13debc572154c8f636b8a9361aacde (diff) |
Merge from google internal
Diffstat (limited to 'src/google/protobuf/util/field_mask_util.h')
-rw-r--r-- | src/google/protobuf/util/field_mask_util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/google/protobuf/util/field_mask_util.h b/src/google/protobuf/util/field_mask_util.h index 71c68fec..01642c6f 100644 --- a/src/google/protobuf/util/field_mask_util.h +++ b/src/google/protobuf/util/field_mask_util.h @@ -113,6 +113,13 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil { static void Intersect(const FieldMask& mask1, const FieldMask& mask2, FieldMask* out); + // Subtracts mask2 from mask1 base of type T. + template <typename T> + static void Subtract(const FieldMask& mask1, const FieldMask& mask2, + FieldMask* out) { + InternalSubtract(T::descriptor(), mask1, mask2, out); + } + // Returns true if path is covered by the given FieldMask. Note that path // "foo.bar" covers all paths like "foo.bar.baz", "foo.bar.quz.x", etc. static bool IsPathInFieldMask(StringPiece path, const FieldMask& mask); @@ -167,6 +174,10 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil { static void InternalGetFieldMaskForAllFields(const Descriptor* descriptor, FieldMask* out); + + static void InternalSubtract(const Descriptor* descriptor, + const FieldMask& mask1, const FieldMask& mask2, + FieldMask* out); }; // Note that for compatibility with the defined behaviour for FieldMask in |