Representation of a VarInt - in ProtoBuf should be 64bit but we only use 32bit.
More...
#include <proto.h>
Representation of a VarInt - in ProtoBuf should be 64bit but we only use 32bit.
Definition at line 73 of file proto.h.
◆ ProtoVarInt() [1/2]
| esphome::api::ProtoVarInt::ProtoVarInt |
( |
| ) |
|
|
inline |
◆ ProtoVarInt() [2/2]
| esphome::api::ProtoVarInt::ProtoVarInt |
( |
uint64_t | value | ) |
|
|
inlineexplicit |
◆ as_bool()
| bool esphome::api::ProtoVarInt::as_bool |
( |
| ) |
const |
|
inlineconstexpr |
◆ as_int32()
| int32_t esphome::api::ProtoVarInt::as_int32 |
( |
| ) |
const |
|
inlineconstexpr |
◆ as_int64()
| int64_t esphome::api::ProtoVarInt::as_int64 |
( |
| ) |
const |
|
inlineconstexpr |
◆ as_sint32()
| int32_t esphome::api::ProtoVarInt::as_sint32 |
( |
| ) |
const |
|
inlineconstexpr |
◆ as_sint64()
| int64_t esphome::api::ProtoVarInt::as_sint64 |
( |
| ) |
const |
|
inlineconstexpr |
◆ as_uint16()
| uint16_t esphome::api::ProtoVarInt::as_uint16 |
( |
| ) |
const |
|
inlineconstexpr |
◆ as_uint32()
| uint32_t esphome::api::ProtoVarInt::as_uint32 |
( |
| ) |
const |
|
inlineconstexpr |
◆ as_uint64()
| uint64_t esphome::api::ProtoVarInt::as_uint64 |
( |
| ) |
const |
|
inlineconstexpr |
◆ encode()
| void esphome::api::ProtoVarInt::encode |
( |
std::vector< uint8_t > & | out | ) |
|
|
inline |
◆ encode_to_buffer_unchecked()
| void esphome::api::ProtoVarInt::encode_to_buffer_unchecked |
( |
uint8_t * | buffer, |
|
|
size_t | len ) |
|
inline |
Encode the varint value to a pre-allocated buffer without bounds checking.
- Parameters
-
| buffer | The pre-allocated buffer to write the encoded varint to |
| len | The size of the buffer in bytes |
- Note
- The caller is responsible for ensuring the buffer is large enough to hold the encoded value. Use ProtoSize::varint() to calculate the exact size needed before calling this method.
-
No bounds checking is performed for performance reasons.
Definition at line 145 of file proto.h.
◆ parse()
| static optional< ProtoVarInt > esphome::api::ProtoVarInt::parse |
( |
const uint8_t * | buffer, |
|
|
uint32_t | len, |
|
|
uint32_t * | consumed ) |
|
inlinestatic |
◆ value_
| uint64_t esphome::api::ProtoVarInt::value_ |
|
protected |
The documentation for this class was generated from the following file: