Skip to main content

The SubMatch Class Reference

Object representing the match results of a capture range. More...

Declaration

class reg::SubMatch { ... }

Included Headers

#include <src/regex.h>

Friends Index

classMatch

Public Constructors Index

SubMatch (std::string_view str)

Creates a match for a single capture range given a non-owning pointer to the string. More...

Public Member Functions Index

size_tposition () const

Returns the position in the string at which the match starts. More...

size_tlength () const

Returns the length of the matching part. More...

std::stringstr () const

Returns the matching part as a string. More...

Private Member Functions Index

voidsetStart (size_t pos)
voidsetEnd (size_t pos)
voidsetMatch (size_t pos, size_t len)

Private Member Attributes Index

size_tm_pos = std::string::npos
size_tm_len = std::string::npos
std::string_viewm_str

Description

Object representing the match results of a capture range.

Definition at line 118 of file regex.h.

Friends

Match

friend class Match

Definition at line 134 of file regex.h.

134 friend class Match;

Reference Match.

Referenced by Match.

Public Constructors

SubMatch()

reg::SubMatch::SubMatch (std::string_view str)
inline

Creates a match for a single capture range given a non-owning pointer to the string.

Definition at line 122 of file regex.h.

122 SubMatch(std::string_view str) : m_str(str) {}

References m_str and str.

Public Member Functions

length()

size_t reg::SubMatch::length ()
inline

Returns the length of the matching part.

Definition at line 128 of file regex.h.

128 size_t length() const { return m_len; }

Reference m_len.

position()

size_t reg::SubMatch::position ()
inline

Returns the position in the string at which the match starts.

Definition at line 125 of file regex.h.

125 size_t position() const { return m_pos; }

Reference m_pos.

str()

std::string reg::SubMatch::str ()
inline

Returns the matching part as a string.

Definition at line 131 of file regex.h.

131 std::string str() const { return std::string{m_str.substr(m_pos,m_len)}; }

References m_len, m_pos and m_str.

Referenced by SubMatch.

Private Member Functions

setEnd()

void reg::SubMatch::setEnd (size_t pos)
inline

Definition at line 136 of file regex.h.

136 void setEnd(size_t pos) { m_len=pos-m_pos; }

References m_len and m_pos.

setMatch()

void reg::SubMatch::setMatch (size_t pos, size_t len)
inline

Definition at line 137 of file regex.h.

137 void setMatch(size_t pos,size_t len) { m_pos=pos; m_len=len; }

References m_len and m_pos.

Referenced by reg::Match::prefix and reg::Match::suffix.

setStart()

void reg::SubMatch::setStart (size_t pos)
inline

Definition at line 135 of file regex.h.

135 void setStart(size_t pos) { m_pos=pos; }

Reference m_pos.

Private Member Attributes

m_len

size_t reg::SubMatch::m_len = std::string::npos

Definition at line 139 of file regex.h.

139 size_t m_len = std::string::npos;

Referenced by length, setEnd, setMatch and str.

m_pos

size_t reg::SubMatch::m_pos = std::string::npos

Definition at line 138 of file regex.h.

138 size_t m_pos = std::string::npos;

Referenced by position, setEnd, setMatch, setStart and str.

m_str

std::string_view reg::SubMatch::m_str

Definition at line 140 of file regex.h.

140 std::string_view m_str;

Referenced by str and SubMatch.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.