C/C++ API Reference
Loading...
Searching...
No Matches
pw::protobuf::FieldKey Class Reference

Overview

Represents a protobuf field key, storing a field number and wire type (WireType).

Public Member Functions

constexpr FieldKey (uint32_t field_number, WireType wire_type)
 
constexpr FieldKey (uint32_t key)
 
constexpr operator uint32_t ()
 
constexpr uint32_t field_number () const
 
constexpr WireType wire_type () const
 

Static Public Member Functions

static constexpr bool IsValidKey (uint64_t key)
 

Constructor & Destructor Documentation

◆ FieldKey() [1/2]

constexpr pw::protobuf::FieldKey::FieldKey ( uint32_t  field_number,
WireType  wire_type 
)
inlineconstexpr

Creates a field key with the given field number and wire type.

Parameters
[in]field_numberThe field number for the field.
[in]wire_typeThe wire type (WireType) of the field.
Precondition
The field number must be valid (ValidFieldNumber(field_number)).

◆ FieldKey() [2/2]

constexpr pw::protobuf::FieldKey::FieldKey ( uint32_t  key)
inlineconstexpr

Parses a field key from its encoded representation.

Parameters
[in]keyThe raw integer representation of the key.
Precondition
The key must be valid (IsValidKey(key)).

Member Function Documentation

◆ IsValidKey()

static constexpr bool pw::protobuf::FieldKey::IsValidKey ( uint64_t  key)
inlinestaticconstexpr

Checks if the given encoded protobuf key is valid.

Must be called before instantiating a FieldKey object from an integer key.

Parameters
[in]keyThe raw encoded key value.
Returns
true if the key contains a valid field number and wire type.

The documentation for this class was generated from the following file: