REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::detail::char_class Struct Reference

A set of byte values (0–255) as a 256-bit bitmap. More...

#include <charclass.hpp>

Public Member Functions

constexpr void set (std::uint8_t byte)
 Adds byte byte to the set.
 
constexpr void set_range (std::uint8_t low, std::uint8_t high)
 Adds the inclusive byte range [low, high] to the set.
 
constexpr void merge (const char_class &other)
 Unions other into this set.
 
constexpr void invert_ascii ()
 Complements the ASCII half (bytes 0–127) only.
 
constexpr void invert ()
 Full 256-bit complement (binary mode: raw bytes, no UTF-8).
 
constexpr bool test (std::uint8_t byte) const
 Tests membership of byte byte.
 
constexpr bool empty () const
 Reports whether the set has no members.
 
constexpr bool operator== (const char_class &) const =default
 

Public Attributes

std::array< std::uint64_t, 4 > bits {}
 Bitmap; bit byte is byte byte's membership.
 

Detailed Description

A set of byte values (0–255) as a 256-bit bitmap.

Membership, insertion and complement are all O(1) or O(256) and constexpr. All bit manipulation uses unsigned operands (MISRA forbids signed bitwise).

Definition at line 29 of file charclass.hpp.

Member Function Documentation

◆ empty()

constexpr bool real::detail::char_class::empty ( ) const
inlineconstexpr

Reports whether the set has no members.

Returns
true if the set is empty.

Definition at line 117 of file charclass.hpp.

◆ invert()

constexpr void real::detail::char_class::invert ( )
inlineconstexpr

Full 256-bit complement (binary mode: raw bytes, no UTF-8).

Definition at line 95 of file charclass.hpp.

◆ invert_ascii()

constexpr void real::detail::char_class::invert_ascii ( )
inlineconstexpr

Complements the ASCII half (bytes 0–127) only.

Bytes >= 0x80 are left untouched; the compiler handles non-ASCII codepoints as explicit UTF-8 multi-byte alternatives instead.

Definition at line 86 of file charclass.hpp.

◆ merge()

constexpr void real::detail::char_class::merge ( const char_class other)
inlineconstexpr

Unions other into this set.

Parameters
[in]otherThe set whose members are added to this one.

Definition at line 73 of file charclass.hpp.

◆ operator==()

constexpr bool real::detail::char_class::operator== ( const char_class ) const
constexprdefault

◆ set()

constexpr void real::detail::char_class::set ( std::uint8_t  byte)
inlineconstexpr

Adds byte byte to the set.

Parameters
[in]byteThe byte to insert.

Definition at line 37 of file charclass.hpp.

◆ set_range()

constexpr void real::detail::char_class::set_range ( std::uint8_t  low,
std::uint8_t  high 
)
inlineconstexpr

Adds the inclusive byte range [low, high] to the set.

Parameters
[in]lowFirst byte of the range.
[in]highLast byte of the range (inclusive).

Definition at line 48 of file charclass.hpp.

◆ test()

constexpr bool real::detail::char_class::test ( std::uint8_t  byte) const
inlineconstexpr

Tests membership of byte byte.

Parameters
[in]byteThe byte to test.
Returns
true if byte is in the set.

Definition at line 107 of file charclass.hpp.

Member Data Documentation

◆ bits

std::array<std::uint64_t, 4> real::detail::char_class::bits {}

Bitmap; bit byte is byte byte's membership.

Definition at line 31 of file charclass.hpp.


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