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 (bytes mode only).
 
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
 Equality: the two bitmaps accept exactly the same byte set.
 

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.

Bit manipulation uses unsigned operands only (MISRA forbids signed bitwise).

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.

◆ invert_ascii()

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

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

Bytes >= 0x80 are untouched: the compiler expands non-ASCII codepoints to UTF-8 sequences.

◆ 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.

◆ operator==()

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

Equality: the two bitmaps accept exactly the same byte set.

Returns
Whether every one of the 256 bits agrees.

◆ 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.

◆ 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).

◆ 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.

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