REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::compat::re2::RE2::Options Class Reference

RE2-compatible construction options. Mirrors real RE2's RE2::Options field-for-field (names, defaults); see the file-level doc comment for which fields this layer honors. More...

#include <re2.hpp>

Public Types

enum  Encoding : std::uint8_t { EncodingUTF8 , EncodingLatin1 }
 Pattern/text encoding — real::compat::re2 supports EncodingUTF8 only. More...
 

Public Member Functions

 Options ()=default
 Default options: UTF-8, leftmost-first, case-sensitive, every RE2 default kept.
 
std::int64_t max_mem () const noexcept
 Approximate memory budget RE2 uses for its compiled program/DFA cache. Stored for API shape; REAL has its own, unrelated internal budget knobs and does not consult this.
 
void set_max_mem (std::int64_t value) noexcept
 Sets max_mem.
 
Encoding encoding () const noexcept
 The pattern/text encoding.
 
void set_encoding (Encoding value) noexcept
 Sets encoding. EncodingLatin1 makes the owning RE2 reject at construction.
 
bool posix_syntax () const noexcept
 Whether the pattern is restricted to POSIX egrep syntax. Always rejected here (no REAL-side equivalent grammar mode) if set to true.
 
void set_posix_syntax (bool value) noexcept
 Sets posix_syntax.
 
bool longest_match () const noexcept
 Whether to search for the longest match instead of the first. Honored for PartialMatch (via real::regex::search_longest()); see the file-level doc comment.
 
void set_longest_match (bool value) noexcept
 Sets longest_match.
 
bool log_errors () const noexcept
 Whether to log syntax/execution errors. Stored for API shape; this layer reports errors through RE2::error() regardless, never a logging side-channel.
 
void set_log_errors (bool value) noexcept
 Sets log_errors.
 
bool literal () const noexcept
 Whether the pattern is matched as a literal string rather than parsed as a regex. Honored by escaping the pattern (QuoteMeta) before compiling.
 
void set_literal (bool value) noexcept
 Sets literal.
 
bool never_nl () const noexcept
 Whether the pattern must never match \n, even where the pattern text says it should. Always rejected here (no REAL-side equivalent) if set to true.
 
void set_never_nl (bool value) noexcept
 Sets never_nl.
 
bool dot_nl () const noexcept
 Whether . also matches \n. Honored via flags::dotall.
 
void set_dot_nl (bool value) noexcept
 Sets dot_nl.
 
bool never_capture () const noexcept
 Whether every (...) parses as non-capturing. Always rejected here (this layer always captures every group; honoring true silently would change NumberOfCapturingGroups() and which Arg extractions succeed) if set to true.
 
void set_never_capture (bool value) noexcept
 Sets never_capture.
 
bool case_sensitive () const noexcept
 Whether matching is case-sensitive by default (overridable per-pattern with (?i), same interaction RE2 itself documents). Honored via flags::icase when false.
 
void set_case_sensitive (bool value) noexcept
 Sets case_sensitive.
 
bool perl_classes () const noexcept
 Only consulted by real RE2 under posix_syntax, which this layer rejects — inert here for the same reason it is inert in real RE2 outside posix_syntax mode.
 
void set_perl_classes (bool value) noexcept
 Sets perl_classes (inert; see the getter).
 
bool word_boundary () const noexcept
 Only consulted by real RE2 under posix_syntax, which this layer rejects — inert here for the same reason it is inert in real RE2 outside posix_syntax mode.
 
void set_word_boundary (bool value) noexcept
 Sets word_boundary (inert; see the getter).
 
bool one_line () const noexcept
 Only consulted by real RE2 under posix_syntax, which this layer rejects — inert here for the same reason it is inert in real RE2 outside posix_syntax mode.
 
void set_one_line (bool value) noexcept
 Sets one_line (inert; see the getter).
 

Private Attributes

std::int64_t max_mem_ {8 << 20}
 RE2's own default budget; unused by REAL.
 
Encoding encoding_ {EncodingUTF8}
 The pattern/text encoding.
 
bool posix_syntax_ {false}
 POSIX egrep syntax restriction.
 
bool longest_match_ {false}
 Leftmost-longest vs leftmost-first.
 
bool log_errors_ {true}
 Log syntax/execution errors (inert here).
 
bool literal_ {false}
 Match the pattern as a literal string.
 
bool never_nl_ {false}
 Never match \n.
 
bool dot_nl_ {false}
 . also matches \n.
 
bool never_capture_ {false}
 Parse every (...) as non-capturing.
 
bool case_sensitive_ {true}
 Case-sensitive by default.
 
bool perl_classes_ {false}
 POSIX-mode-only; inert here.
 
bool word_boundary_ {false}
 POSIX-mode-only; inert here.
 
bool one_line_ {false}
 POSIX-mode-only; inert here.
 

Detailed Description

RE2-compatible construction options. Mirrors real RE2's RE2::Options field-for-field (names, defaults); see the file-level doc comment for which fields this layer honors.

Member Enumeration Documentation

◆ Encoding

Pattern/text encoding — real::compat::re2 supports EncodingUTF8 only.

Enumerator
EncodingUTF8 

UTF-8 (the default, and the only encoding this layer honors).

EncodingLatin1 

Latin-1 — accepted for API shape, rejected at RE2 construction.

Member Function Documentation

◆ case_sensitive()

bool real::compat::re2::RE2::Options::case_sensitive ( ) const
inlinenoexcept

Whether matching is case-sensitive by default (overridable per-pattern with (?i), same interaction RE2 itself documents). Honored via flags::icase when false.

Returns
Whether matching is case-sensitive.

◆ dot_nl()

bool real::compat::re2::RE2::Options::dot_nl ( ) const
inlinenoexcept

Whether . also matches \n. Honored via flags::dotall.

Returns
Whether . matches a newline.

◆ encoding()

Encoding real::compat::re2::RE2::Options::encoding ( ) const
inlinenoexcept

The pattern/text encoding.

Returns
The configured encoding.

◆ literal()

bool real::compat::re2::RE2::Options::literal ( ) const
inlinenoexcept

Whether the pattern is matched as a literal string rather than parsed as a regex. Honored by escaping the pattern (QuoteMeta) before compiling.

Returns
Whether the pattern is treated as a literal string.

◆ log_errors()

bool real::compat::re2::RE2::Options::log_errors ( ) const
inlinenoexcept

Whether to log syntax/execution errors. Stored for API shape; this layer reports errors through RE2::error() regardless, never a logging side-channel.

Returns
Whether construction failures are logged.

◆ longest_match()

bool real::compat::re2::RE2::Options::longest_match ( ) const
inlinenoexcept

Whether to search for the longest match instead of the first. Honored for PartialMatch (via real::regex::search_longest()); see the file-level doc comment.

Returns
Whether leftmost-longest semantics are selected.

◆ max_mem()

std::int64_t real::compat::re2::RE2::Options::max_mem ( ) const
inlinenoexcept

Approximate memory budget RE2 uses for its compiled program/DFA cache. Stored for API shape; REAL has its own, unrelated internal budget knobs and does not consult this.

Returns
The stored budget, in bytes.

◆ never_capture()

bool real::compat::re2::RE2::Options::never_capture ( ) const
inlinenoexcept

Whether every (...) parses as non-capturing. Always rejected here (this layer always captures every group; honoring true silently would change NumberOfCapturingGroups() and which Arg extractions succeed) if set to true.

Returns
Whether capturing groups are demoted to non-capturing.

◆ never_nl()

bool real::compat::re2::RE2::Options::never_nl ( ) const
inlinenoexcept

Whether the pattern must never match \n, even where the pattern text says it should. Always rejected here (no REAL-side equivalent) if set to true.

Returns
Whether . and negated classes are barred from matching a newline.

◆ one_line()

bool real::compat::re2::RE2::Options::one_line ( ) const
inlinenoexcept

Only consulted by real RE2 under posix_syntax, which this layer rejects — inert here for the same reason it is inert in real RE2 outside posix_syntax mode.

Returns
Whether ^/$ match only at the text edges.

◆ perl_classes()

bool real::compat::re2::RE2::Options::perl_classes ( ) const
inlinenoexcept

Only consulted by real RE2 under posix_syntax, which this layer rejects — inert here for the same reason it is inert in real RE2 outside posix_syntax mode.

Returns
Whether Perl classes (\\d, \\s, \\w) are enabled.

◆ posix_syntax()

bool real::compat::re2::RE2::Options::posix_syntax ( ) const
inlinenoexcept

Whether the pattern is restricted to POSIX egrep syntax. Always rejected here (no REAL-side equivalent grammar mode) if set to true.

Returns
Whether POSIX-ERE syntax is selected.

◆ set_case_sensitive()

void real::compat::re2::RE2::Options::set_case_sensitive ( bool  value)
inlinenoexcept

Sets case_sensitive.

Parameters
[in]valueThe new setting.

◆ set_dot_nl()

void real::compat::re2::RE2::Options::set_dot_nl ( bool  value)
inlinenoexcept

Sets dot_nl.

Parameters
[in]valueThe new setting.

◆ set_encoding()

void real::compat::re2::RE2::Options::set_encoding ( Encoding  value)
inlinenoexcept

Sets encoding. EncodingLatin1 makes the owning RE2 reject at construction.

Parameters
[in]valueThe new encoding.

◆ set_literal()

void real::compat::re2::RE2::Options::set_literal ( bool  value)
inlinenoexcept

Sets literal.

Parameters
[in]valueThe new setting.

◆ set_log_errors()

void real::compat::re2::RE2::Options::set_log_errors ( bool  value)
inlinenoexcept

Sets log_errors.

Parameters
[in]valueThe new setting.

◆ set_longest_match()

void real::compat::re2::RE2::Options::set_longest_match ( bool  value)
inlinenoexcept

Sets longest_match.

Parameters
[in]valueThe new setting.

◆ set_max_mem()

void real::compat::re2::RE2::Options::set_max_mem ( std::int64_t  value)
inlinenoexcept

Sets max_mem.

Parameters
[in]valueThe new budget, in bytes.

◆ set_never_capture()

void real::compat::re2::RE2::Options::set_never_capture ( bool  value)
inlinenoexcept

Sets never_capture.

Parameters
[in]valuetrue makes the owning RE2 reject at construction.

◆ set_never_nl()

void real::compat::re2::RE2::Options::set_never_nl ( bool  value)
inlinenoexcept

Sets never_nl.

Parameters
[in]valuetrue makes the owning RE2 reject at construction.

◆ set_one_line()

void real::compat::re2::RE2::Options::set_one_line ( bool  value)
inlinenoexcept

Sets one_line (inert; see the getter).

Parameters
[in]valueStored, not consulted.

◆ set_perl_classes()

void real::compat::re2::RE2::Options::set_perl_classes ( bool  value)
inlinenoexcept

Sets perl_classes (inert; see the getter).

Parameters
[in]valueStored, not consulted.

◆ set_posix_syntax()

void real::compat::re2::RE2::Options::set_posix_syntax ( bool  value)
inlinenoexcept

Sets posix_syntax.

Parameters
[in]valuetrue makes the owning RE2 reject at construction.

◆ set_word_boundary()

void real::compat::re2::RE2::Options::set_word_boundary ( bool  value)
inlinenoexcept

Sets word_boundary (inert; see the getter).

Parameters
[in]valueStored, not consulted.

◆ word_boundary()

bool real::compat::re2::RE2::Options::word_boundary ( ) const
inlinenoexcept

Only consulted by real RE2 under posix_syntax, which this layer rejects — inert here for the same reason it is inert in real RE2 outside posix_syntax mode.

Returns
Whether \\b and \\B are enabled.

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