aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/util/pb_utils.h
blob: 71a76ff4c2da063abea72e2ceee665fb8fd6347e (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);                                    \ 
    }