aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/util/is_equal.h
blob: 13c0aae63d95b01a59578bec08ddce79d8c01cab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <util/generic/fwd.h>

namespace google {
    namespace protobuf {
        class Message;
        class FieldDescriptor;
    }
}

namespace NProtoBuf {
    using ::google::protobuf::FieldDescriptor;
    using ::google::protobuf::Message;
}

namespace NProtoBuf {
    // Reflection-based equality check for arbitrary protobuf messages

    // Strict comparison: optional field without value is NOT equal to
    // a field with explicitly set default value.
    bool IsEqual(const Message& m1, const Message& m2);
    bool IsEqual(const Message& m1, const Message& m2, TString* differentPath);

    bool IsEqualField(const Message& m1, const Message& m2, const FieldDescriptor& field);

    // Non-strict version: optional field without explicit value is compared
    // using its default value.
    bool IsEqualDefault(const Message& m1, const Message& m2);

    bool IsEqualFieldDefault(const Message& m1, const Message& m2, const FieldDescriptor& field);

}