aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/util/pb_utils.h
blob: 9e9a110b48bde4669ccebb699047714943727dac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#pragma once

#define UPDATE_PB_FIELD_MAX(PBMESS, FIELD, VAL) \
    if ((VAL) > (PBMESS).Get##FIELD()) {        \
        (PBMESS).Set##FIELD(VAL);               \
    }

#define UPDATE_OPT_PB_FIELD_MAX(PBMESS, FIELD, VAL)                  \
    if (!(PBMESS).Has##FIELD() || ((VAL) > (PBMESS).Get##FIELD())) { \
        (PBMESS).Set##FIELD(VAL);                                    \
    }