aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/encode/spack/varint.h
blob: 7ac522dd6c7605b498bf4b359ff7250d0018717e (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
#pragma once

#include <util/system/types.h>

class IInputStream;
class IOutputStream;

namespace NMonitoring {
    ui32 WriteVarUInt32(IOutputStream* output, ui32 value);

    ui32 ReadVarUInt32(IInputStream* input);
    size_t ReadVarUInt32(const ui8* buf, size_t len, ui32* result);

    enum class EReadResult {
        OK,
        ERR_OVERFLOW,
        ERR_UNEXPECTED_EOF,
    };

    [[nodiscard]]
    EReadResult TryReadVarUInt32(IInputStream* input, ui32* value);

}