LibQuicR
quicr::messages::ParameterList< Type > Class Template Reference

#include <parameters.h>

Public Member Functions

 ParameterList ()=default
 Creates an empty list. More...
 
 ParameterList (const ParameterList &other)=default
 
 ParameterList (ParameterList &&other)=default
 
ParameterList & operator= (const ParameterList &other)=default
 
ParameterList & operator= (ParameterList &&other)=default
 
template<typename T >
requires HasByteStreamOperators< T > std::is_convertible_v< T, std::uint8_t > std::is_same_v< T, Location > requires (T v)
 
ParameterList & Add (Type type, const T &value)
 
template<ParameterValueType T>
ParameterList & AddOptional (Type type, const std::optional< T > &value)
 
auto begin () const noexcept
 
auto end () const noexcept
 
bool Contains (Type type) const
 
std::optional< BytesSpan > Find (Type type) const
 
void Remove (Type type)
 
template<ParameterValueType T>
std::optional< T > Get (Type type) const
 
Filter GetFilter (FilterType type) const
 
auto operator<=> (const ParameterList &other) const =default
 

Public Attributes

std::map< std::uint64_t, Bytes > parameters
 Encoded values keyed by absolute numeric parameter type. More...
 

Detailed Description

template<typename Type = ParameterType>
class quicr::messages::ParameterList< Type >

Sorted parameter collection with type-directed wire encoding.

The map representation permits only one stored value per numeric key; adding the same type appends to that value rather than creating a second map entry. Consequently, duplicate authorization-token parameters are not represented independently by this class.

Template Parameters
Typeuint64-compatible parameter-key enum or integer type.

Constructor & Destructor Documentation

◆ ParameterList() [1/3]

template<typename Type = ParameterType>
quicr::messages::ParameterList< Type >::ParameterList ( )
default

Creates an empty list.

◆ ParameterList() [2/3]

template<typename Type = ParameterType>
quicr::messages::ParameterList< Type >::ParameterList ( const ParameterList< Type > &  other)
default

Copies a list.

Parameters
otherList to copy.

◆ ParameterList() [3/3]

template<typename Type = ParameterType>
quicr::messages::ParameterList< Type >::ParameterList ( ParameterList< Type > &&  other)
default

Moves a list.

Parameters
otherList to move.

Member Function Documentation

◆ Add()

template<typename Type = ParameterType>
ParameterList& quicr::messages::ParameterList< Type >::Add ( Type  type,
const T &  value 
)
inline

◆ AddOptional()

template<typename Type = ParameterType>
template<ParameterValueType T>
ParameterList& quicr::messages::ParameterList< Type >::AddOptional ( Type  type,
const std::optional< T > &  value 
)
inline

Adds an optional value when present.

Template Parameters
TParameter value type.
Parameters
typeParameter key.
valueOptional value.
Returns
This list.

◆ begin()

template<typename Type = ParameterType>
auto quicr::messages::ParameterList< Type >::begin ( ) const
inlinenoexcept
Returns
Const iterator to the first numeric-key/value entry.

◆ Contains()

template<typename Type = ParameterType>
bool quicr::messages::ParameterList< Type >::Contains ( Type  type) const
inline
Parameters
typeParameter key to find.
Returns
Whether type has a stored map entry.

◆ end()

template<typename Type = ParameterType>
auto quicr::messages::ParameterList< Type >::end ( ) const
inlinenoexcept
Returns
Const iterator past the last entry.

◆ Find()

template<typename Type = ParameterType>
std::optional<BytesSpan> quicr::messages::ParameterList< Type >::Find ( Type  type) const
inline

Finds encoded value bytes without copying.

Parameters
typeParameter key.
Returns
View into this list's storage, or std::nullopt when absent. The view is invalidated by mutation or destruction of this list.

◆ Get()

template<typename Type = ParameterType>
template<ParameterValueType T>
std::optional<T> quicr::messages::ParameterList< Type >::Get ( Type  type) const
inline

Decodes a typed value.

Template Parameters
TRequested value type.
Parameters
typeParameter key controlling decoding.
Returns
Decoded value, or std::nullopt when absent.
Exceptions
ProtocolViolationExceptionfor empty values, unknown keys, or incompatible requested types.
UintVarInvalidArgExceptionfor malformed varints.

◆ GetFilter()

template<typename Type = ParameterType>
Filter quicr::messages::ParameterList< Type >::GetFilter ( FilterType  type) const
inline

Decodes a filter parameter.

Parameters
typeFilter discriminator.
Returns
Decoded filter, or monostate when absent, unsupported, or this is not a ParameterType list.
Note
Subgroup, object, priority, and property filter decoding is currently unsupported.

◆ operator<=>()

template<typename Type = ParameterType>
auto quicr::messages::ParameterList< Type >::operator<=> ( const ParameterList< Type > &  other) const
default

Lexicographically compares the underlying sorted maps.

Parameters
otherList to compare.
Returns
Lexicographic comparison of the maps.

◆ operator=() [1/2]

template<typename Type = ParameterType>
ParameterList& quicr::messages::ParameterList< Type >::operator= ( const ParameterList< Type > &  other)
default

Copy-assigns a list.

Parameters
otherList to copy.
Returns
This list.

◆ operator=() [2/2]

template<typename Type = ParameterType>
ParameterList& quicr::messages::ParameterList< Type >::operator= ( ParameterList< Type > &&  other)
default

Move-assigns a list.

Parameters
otherList to move.
Returns
This list.

◆ Remove()

template<typename Type = ParameterType>
void quicr::messages::ParameterList< Type >::Remove ( Type  type)
inline
Parameters
typeParameter key to remove if present.

◆ requires()

template<typename Type = ParameterType>
template<typename T >
requires HasByteStreamOperators<T> std::is_convertible_v<T, std::uint8_t> std::is_same_v<T, Location> quicr::messages::ParameterList< Type >::requires ( T  v)
inline

Encodes and appends a value under a parameter key.

Template Parameters
TValue type accepted by the selected encoding.
Parameters
typeParameter key that determines the wire encoding.
valueValue to append to the key's stored bytes.
Returns
This list.
Exceptions
ProtocolViolationExceptionif the key is unknown or the value type is incompatible.

Member Data Documentation

◆ parameters

template<typename Type = ParameterType>
std::map<std::uint64_t, Bytes> quicr::messages::ParameterList< Type >::parameters

Encoded values keyed by absolute numeric parameter type.


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