Crunch
A Message Definition Language for Getting Things Right
Loading...
Searching...
No Matches
Crunch::fields::String< MaxSize, Validators > Class Template Reference

Fixed-size string field backed by std::array. More...

#include <crunch_string.hpp>

Public Types

using ValueType = std::string_view
 

Public Member Functions

constexpr String (std::string_view sv)
 
constexpr std::string_view get () const noexcept
 
constexpr std::optional< Errorset (std::string_view sv) noexcept
 
constexpr void clear () noexcept
 
constexpr bool operator== (const String &other) const noexcept
 
constexpr auto Validate (FieldId id=0) const noexcept -> std::optional< Error >
 

Static Public Member Functions

static constexpr auto Validate (std::string_view v, FieldId id=0) noexcept -> std::optional< Error >
 

Public Attributes

std::array< char, MaxSize > buffer_ {}
 
std::size_t current_len_ {0}
 

Static Public Attributes

static constexpr std::size_t max_size = MaxSize
 

Detailed Description

template<std::size_t MaxSize, typename... Validators>
requires ((Validator<Validators, std::string_view> && ...) && (sizeof...(Validators) > 0))
class Crunch::fields::String< MaxSize, Validators >

Fixed-size string field backed by std::array.

Template Parameters
MaxSizeMaximum capacity of the string (compile-time).
ValidatorsZero or more validators (e.g., Length, OneOf).

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