PCRE2 C++ Wrapper 1.3.0
pcre2cpp
Loading...
Searching...
No Matches
pcre2cpp::basic_match_result< utf > Class Template Reference

Basic container to result data of match function. More...

#include <match_result.hpp>

Inheritance diagram for pcre2cpp::basic_match_result< utf >:
[legend]
Collaboration diagram for pcre2cpp::basic_match_result< utf >:
[legend]

Classes

struct  _value_result_data
 Result data container. More...

Public Member Functions

_PCRE2CPP_CONSTEXPR17 basic_match_result () noexcept=default
 default constructor
_PCRE2CPP_CONSTEXPR17 basic_match_result (const match_error_codes error_code) noexcept
 constructor with error code
_PCRE2CPP_CONSTEXPR17 basic_match_result (const size_t search_offset, const _named_sub_values_table_ptr &named_sub_values, const _code_ptr &regex_compiled_code) noexcept
 constructor with no value but also without error
_PCRE2CPP_CONSTEXPR17 basic_match_result (const size_t search_offset, const _match_value &result, const std::vector< std::optional< sub_match_value > > &sub_results, const _named_sub_values_table_ptr &named_sub_values, const _code_ptr &regex_compiled_code) noexcept
 constructor with good result
_PCRE2CPP_CONSTEXPR17 basic_match_result (const basic_match_result &other) noexcept=default
 default copy constructor
_PCRE2CPP_CONSTEXPR17 basic_match_result (basic_match_result &&other) noexcept=default
 default move constructor
_PCRE2CPP_CONSTEXPR20 ~basic_match_result () noexcept=default
 default destructor
_PCRE2CPP_CONSTEXPR17 basic_match_resultoperator= (const basic_match_result &other) noexcept=default
 default copy assign operator
_PCRE2CPP_CONSTEXPR17 basic_match_resultoperator= (basic_match_result &&other) noexcept=default
 default move assign operator
_PCRE2CPP_CONSTEXPR17 bool has_error () const noexcept
 returns true if result holds error
_PCRE2CPP_CONSTEXPR17 match_error_codes get_error_code () const noexcept
 return error code
_PCRE2CPP_CONSTEXPR17 _string_type get_error_message () const noexcept
 returns error message
_PCRE2CPP_CONSTEXPR17 void throw_error () const
 throws error if result holds error with error message based on error code
_PCRE2CPP_CONSTEXPR17 bool has_result () const noexcept
 returns true when result holds some result not error
_PCRE2CPP_CONSTEXPR17 bool has_value () const noexcept
 returns true when result has value
_PCRE2CPP_CONSTEXPR17 bool has_sub_value (const size_t idx) const noexcept
 returns true when result has sub value on given index
_PCRE2CPP_CONSTEXPR17 bool has_sub_value (const _string_view_type name) const noexcept
 returns true when result has sub value with given name
_PCRE2CPP_CONSTEXPR17 size_t get_search_offset () const noexcept
 returns search offset
_PCRE2CPP_CONSTEXPR17 _match_value get_result () const noexcept
 returns match result container
_PCRE2CPP_CONSTEXPR17 size_t get_result_global_offset () const noexcept
 returns offset of value from the beginning of searched string
_PCRE2CPP_CONSTEXPR17 size_t get_result_relative_offset () const noexcept
 return offset relative to search offset
_PCRE2CPP_CONSTEXPR17 size_t get_result_size () const noexcept
 returns size of match value
_PCRE2CPP_CONSTEXPR17 _string_type get_result_value () const noexcept
 returns match string value
_PCRE2CPP_CONSTEXPR20 std::vector< std::optional< sub_match_value > > get_sub_results () const noexcept
 returns all sub results
_PCRE2CPP_CONSTEXPR17 size_t get_sub_results_count () const noexcept
 returns sub results count
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > get_sub_results_global_offsets () const noexcept
 returns sub results offsets from the beginning of search string
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > get_sub_results_relative_offsets () const noexcept
 returns sub results offsets relative to search offset
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > get_sub_results_in_result_offsets () const noexcept
 returns sub results offsets relative to result offset
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > get_sub_results_sizes () const noexcept
 returns sub results value sizes
_PCRE2CPP_CONSTEXPR17 std::vector< _string_typeget_sub_results_values () const noexcept
 returns sub results string values
_PCRE2CPP_CONSTEXPR17 sub_match_value get_sub_result (const size_t idx) const _PCRE2CPP_NOEXCEPT
 returns sub result container
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_global_offset (const size_t idx) const _PCRE2CPP_NOEXCEPT
 returns sub result offset from the beginning of searched string
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_relative_offset (const size_t idx) const _PCRE2CPP_NOEXCEPT
 returns sub result offset relative to search offset
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_in_result_offset (const size_t idx) const _PCRE2CPP_NOEXCEPT
 returns sub result offset relative to result offset
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_size (const size_t idx) const _PCRE2CPP_NOEXCEPT
 returns sub result value size
_PCRE2CPP_CONSTEXPR17 _string_type get_sub_result_value (const size_t idx) const _PCRE2CPP_NOEXCEPT
 returns sub result string value
_PCRE2CPP_CONSTEXPR17 sub_match_value get_sub_result (const _string_view_type name) const _PCRE2CPP_NOEXCEPT
 returns sub result container
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_global_offset (const _string_view_type name) const _PCRE2CPP_NOEXCEPT
 returns sub result offset from the beginning of searched string
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_relative_offset (const _string_view_type name) const _PCRE2CPP_NOEXCEPT
 returns sub result offset relative to search offset
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_in_result_offset (const _string_view_type name) const _PCRE2CPP_NOEXCEPT
 returns sub result offset relative to result offset
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_size (const _string_view_type name) const _PCRE2CPP_NOEXCEPT
 returns sub result value size
_PCRE2CPP_CONSTEXPR17 _string_type get_sub_result_value (const _string_view_type name) const _PCRE2CPP_NOEXCEPT
 returns sub result string value

Static Public Attributes

static _PCRE2CPP_CONSTEXPR17 size_t bad_offset = std::numeric_limits<size_t>::max()
 error offset (returned when value doesn't exist or when error has occurred)

Private Types

using _pcre2_data_t = utils::pcre2_data<utf>
using _code_type = typename _pcre2_data_t::code_type
using _code_ptr = std::shared_ptr<_code_type>
using _string_type = typename _pcre2_data_t::string_type
using _string_view_type = typename _pcre2_data_t::string_view_type
using _match_value = basic_match_value<utf>
using _match_result_exception = basic_match_result_exception<utf>
using _named_sub_values_table = typename _pcre2_data_t::named_sub_values_table
using _named_sub_values_table_ptr = std::shared_ptr<_named_sub_values_table>

Private Member Functions

_PCRE2CPP_CONSTEXPR17 bool _has_named_sub_result (const _string_view_type name) const noexcept
 returns true if sub result group with given name exists in named groups table
_PCRE2CPP_CONSTEXPR17 bool _has_sub_value (const size_t idx) const noexcept
 returns true if sub result has value and idx wasn't out of bounds
_PCRE2CPP_CONSTEXPR17 size_t _get_named_sub_result_idx (const _string_view_type name) const _PCRE2CPP_NOEXCEPT
 returns group index of group with given name
_PCRE2CPP_CONSTEXPR17 const sub_match_value_get_sub_value (const size_t idx) const _PCRE2CPP_NOEXCEPT
 returns sub value data of group with provided index

Static Private Member Functions

static _PCRE2CPP_CONSTEXPR17 _string_view_type _get_out_of_bounds_string () noexcept
 returns out of bounds error in correct utf format
static _PCRE2CPP_CONSTEXPR17 _string_type _get_subexpression_not_found (const _string_view_type name) noexcept
 returns subexpression not found error in correct utf format

Private Attributes

std::variant< match_error_codes, _value_result_data_data = _value_result_data()
 Result data.

Detailed Description

template<utf_type utf>
class pcre2cpp::basic_match_result< utf >

Basic container to result data of match function.

Template Parameters
utfUTF type

Member Typedef Documentation

◆ _code_ptr

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_code_ptr = std::shared_ptr<_code_type>
private

◆ _code_type

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_code_type = typename _pcre2_data_t::code_type
private

◆ _match_result_exception

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_match_result_exception = basic_match_result_exception<utf>
private

◆ _match_value

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_match_value = basic_match_value<utf>
private

◆ _named_sub_values_table

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_named_sub_values_table = typename _pcre2_data_t::named_sub_values_table
private

◆ _named_sub_values_table_ptr

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_named_sub_values_table_ptr = std::shared_ptr<_named_sub_values_table>
private

◆ _pcre2_data_t

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_pcre2_data_t = utils::pcre2_data<utf>
private

◆ _string_type

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_string_type = typename _pcre2_data_t::string_type
private

◆ _string_view_type

template<utf_type utf>
using pcre2cpp::basic_match_result< utf >::_string_view_type = typename _pcre2_data_t::string_view_type
private

Constructor & Destructor Documentation

◆ basic_match_result() [1/6]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 pcre2cpp::basic_match_result< utf >::basic_match_result ( )
defaultnoexcept

default constructor

◆ basic_match_result() [2/6]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 pcre2cpp::basic_match_result< utf >::basic_match_result ( const match_error_codes error_code)
inlineexplicitnoexcept

constructor with error code

◆ basic_match_result() [3/6]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 pcre2cpp::basic_match_result< utf >::basic_match_result ( const size_t search_offset,
const _named_sub_values_table_ptr & named_sub_values,
const _code_ptr & regex_compiled_code )
inlinenoexcept

constructor with no value but also without error

◆ basic_match_result() [4/6]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 pcre2cpp::basic_match_result< utf >::basic_match_result ( const size_t search_offset,
const _match_value & result,
const std::vector< std::optional< sub_match_value > > & sub_results,
const _named_sub_values_table_ptr & named_sub_values,
const _code_ptr & regex_compiled_code )
inlinenoexcept

constructor with good result

◆ basic_match_result() [5/6]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 pcre2cpp::basic_match_result< utf >::basic_match_result ( const basic_match_result< utf > & other)
defaultnoexcept

default copy constructor

◆ basic_match_result() [6/6]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 pcre2cpp::basic_match_result< utf >::basic_match_result ( basic_match_result< utf > && other)
defaultnoexcept

default move constructor

◆ ~basic_match_result()

default destructor

Member Function Documentation

◆ _get_named_sub_result_idx()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::_get_named_sub_result_idx ( const _string_view_type name) const
inlineprivate

returns group index of group with given name

◆ _get_out_of_bounds_string()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 _string_view_type pcre2cpp::basic_match_result< utf >::_get_out_of_bounds_string ( )
inlinestaticprivatenoexcept

returns out of bounds error in correct utf format

◆ _get_sub_value()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 const sub_match_value & pcre2cpp::basic_match_result< utf >::_get_sub_value ( const size_t idx) const
inlineprivate

returns sub value data of group with provided index

◆ _get_subexpression_not_found()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 _string_type pcre2cpp::basic_match_result< utf >::_get_subexpression_not_found ( const _string_view_type name)
inlinestaticprivatenoexcept

returns subexpression not found error in correct utf format

◆ _has_named_sub_result()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_match_result< utf >::_has_named_sub_result ( const _string_view_type name) const
inlineprivatenoexcept

returns true if sub result group with given name exists in named groups table

◆ _has_sub_value()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_match_result< utf >::_has_sub_value ( const size_t idx) const
inlineprivatenoexcept

returns true if sub result has value and idx wasn't out of bounds

◆ get_error_code()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 match_error_codes pcre2cpp::basic_match_result< utf >::get_error_code ( ) const
inlinenoexcept

return error code

◆ get_error_message()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 _string_type pcre2cpp::basic_match_result< utf >::get_error_message ( ) const
inlinenoexcept

returns error message

◆ get_result()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 _match_value pcre2cpp::basic_match_result< utf >::get_result ( ) const
inlinenoexcept

returns match result container

◆ get_result_global_offset()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_result_global_offset ( ) const
inlinenoexcept

returns offset of value from the beginning of searched string

◆ get_result_relative_offset()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_result_relative_offset ( ) const
inlinenoexcept

return offset relative to search offset

◆ get_result_size()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_result_size ( ) const
inlinenoexcept

returns size of match value

◆ get_result_value()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 _string_type pcre2cpp::basic_match_result< utf >::get_result_value ( ) const
inlinenoexcept

returns match string value

◆ get_search_offset()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_search_offset ( ) const
inlinenoexcept

returns search offset

◆ get_sub_result() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 sub_match_value pcre2cpp::basic_match_result< utf >::get_sub_result ( const _string_view_type name) const
inline

returns sub result container

◆ get_sub_result() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 sub_match_value pcre2cpp::basic_match_result< utf >::get_sub_result ( const size_t idx) const
inline

returns sub result container

◆ get_sub_result_global_offset() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_result_global_offset ( const _string_view_type name) const
inline

returns sub result offset from the beginning of searched string

◆ get_sub_result_global_offset() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_result_global_offset ( const size_t idx) const
inline

returns sub result offset from the beginning of searched string

◆ get_sub_result_in_result_offset() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_result_in_result_offset ( const _string_view_type name) const
inline

returns sub result offset relative to result offset

◆ get_sub_result_in_result_offset() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_result_in_result_offset ( const size_t idx) const
inline

returns sub result offset relative to result offset

◆ get_sub_result_relative_offset() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_result_relative_offset ( const _string_view_type name) const
inline

returns sub result offset relative to search offset

◆ get_sub_result_relative_offset() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_result_relative_offset ( const size_t idx) const
inline

returns sub result offset relative to search offset

◆ get_sub_result_size() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_result_size ( const _string_view_type name) const
inline

returns sub result value size

◆ get_sub_result_size() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_result_size ( const size_t idx) const
inline

returns sub result value size

◆ get_sub_result_value() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 _string_type pcre2cpp::basic_match_result< utf >::get_sub_result_value ( const _string_view_type name) const
inline

returns sub result string value

◆ get_sub_result_value() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 _string_type pcre2cpp::basic_match_result< utf >::get_sub_result_value ( const size_t idx) const
inline

returns sub result string value

◆ get_sub_results()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR20 std::vector< std::optional< sub_match_value > > pcre2cpp::basic_match_result< utf >::get_sub_results ( ) const
inlinenoexcept

returns all sub results

◆ get_sub_results_count()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::get_sub_results_count ( ) const
inlinenoexcept

returns sub results count

◆ get_sub_results_global_offsets()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > pcre2cpp::basic_match_result< utf >::get_sub_results_global_offsets ( ) const
inlinenoexcept

returns sub results offsets from the beginning of search string

◆ get_sub_results_in_result_offsets()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > pcre2cpp::basic_match_result< utf >::get_sub_results_in_result_offsets ( ) const
inlinenoexcept

returns sub results offsets relative to result offset

◆ get_sub_results_relative_offsets()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > pcre2cpp::basic_match_result< utf >::get_sub_results_relative_offsets ( ) const
inlinenoexcept

returns sub results offsets relative to search offset

◆ get_sub_results_sizes()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > pcre2cpp::basic_match_result< utf >::get_sub_results_sizes ( ) const
inlinenoexcept

returns sub results value sizes

◆ get_sub_results_values()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 std::vector< _string_type > pcre2cpp::basic_match_result< utf >::get_sub_results_values ( ) const
inlinenoexcept

returns sub results string values

◆ has_error()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_match_result< utf >::has_error ( ) const
inlinenoexcept

returns true if result holds error

◆ has_result()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_match_result< utf >::has_result ( ) const
inlinenoexcept

returns true when result holds some result not error

◆ has_sub_value() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_match_result< utf >::has_sub_value ( const _string_view_type name) const
inlinenoexcept

returns true when result has sub value with given name

◆ has_sub_value() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_match_result< utf >::has_sub_value ( const size_t idx) const
inlinenoexcept

returns true when result has sub value on given index

◆ has_value()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_match_result< utf >::has_value ( ) const
inlinenoexcept

returns true when result has value

◆ operator=() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 basic_match_result & pcre2cpp::basic_match_result< utf >::operator= ( basic_match_result< utf > && other)
defaultnoexcept

default move assign operator

◆ operator=() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 basic_match_result & pcre2cpp::basic_match_result< utf >::operator= ( const basic_match_result< utf > & other)
defaultnoexcept

default copy assign operator

◆ throw_error()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 void pcre2cpp::basic_match_result< utf >::throw_error ( ) const
inline

throws error if result holds error with error message based on error code

Member Data Documentation

◆ _data

template<utf_type utf>
std::variant<match_error_codes, _value_result_data> pcre2cpp::basic_match_result< utf >::_data = _value_result_data()
private

Result data.

◆ bad_offset

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 size_t pcre2cpp::basic_match_result< utf >::bad_offset = std::numeric_limits<size_t>::max()
static

error offset (returned when value doesn't exist or when error has occurred)