Rune Caster 1.0.0
Modern C++ Text Processing Framework
Loading...
Searching...
No Matches
rune_caster::caster< T > Class Template Reference

A powerful chaining pipeline for applying spells to data. More...

#include <caster.hpp>

Public Types

using value_type = T

Public Member Functions

template<typename U>
constexpr caster (U &&data) noexcept(std::is_nothrow_constructible_v< T, U >)
 Construct caster with data (C++20 perfect forwarding)
template<spell_for< T > Spell>
constexpr auto cast (Spell &&spell) const &-> caster< typename Spell::output_type >
 Apply a spell and return a new caster with the result (C++20 concepts)
template<spell_for< T > Spell>
constexpr auto cast (Spell &&spell) &&-> caster< typename Spell::output_type >
 Apply a spell and return a new caster (rvalue reference optimization)
constexpr const T & result () const &noexcept
 Get the final result (const lvalue reference)
constexpr T && result () &&noexcept
 Get the final result (rvalue reference - move semantics)
constexpr T result () const &&
 Get the final result (const rvalue reference)
constexpr const T & operator* () const &noexcept
 Access the underlying data directly.
constexpr T && operator* () &&noexcept
constexpr operator bool () const noexcept
 Check if the caster contains valid data (C++20 concepts)

Static Public Member Functions

static constexpr const char * type_name () noexcept
 Get type information at compile time.

Detailed Description

template<typename T>
class rune_caster::caster< T >

A powerful chaining pipeline for applying spells to data.

This class enables fluent interface for applying multiple spells in sequence: auto result = make_caster(data).cast(spell1).cast(spell2).result();

Uses C++20 features for perfect forwarding and type deduction.

Template Parameters
TThe type of data being processed
Examples
Basic.

Definition at line 22 of file caster.hpp.

Member Typedef Documentation

◆ value_type

template<typename T>
using rune_caster::caster< T >::value_type = T

Definition at line 27 of file caster.hpp.

Constructor & Destructor Documentation

◆ caster()

template<typename T>
template<typename U>
rune_caster::caster< T >::caster ( U && data)
inlineexplicitconstexprnoexcept

Construct caster with data (C++20 perfect forwarding)

Definition at line 33 of file caster.hpp.

Member Function Documentation

◆ cast() [1/2]

template<typename T>
template<spell_for< T > Spell>
auto rune_caster::caster< T >::cast ( Spell && spell) && -> caster<typename Spell::output_type>
inlineconstexpr

Apply a spell and return a new caster (rvalue reference optimization)

Definition at line 56 of file caster.hpp.

◆ cast() [2/2]

template<typename T>
template<spell_for< T > Spell>
auto rune_caster::caster< T >::cast ( Spell && spell) const & -> caster<typename Spell::output_type>
inlineconstexpr

Apply a spell and return a new caster with the result (C++20 concepts)

Uses C++20 concepts for compile-time validation and auto return type deduction. The return type is automatically deduced from the spell's output type.

Template Parameters
SpellThe spell type to apply
Parameters
spellThe spell instance to apply
Returns
A new caster with the transformed data

Definition at line 48 of file caster.hpp.

◆ operator bool()

template<typename T>
rune_caster::caster< T >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Check if the caster contains valid data (C++20 concepts)

Definition at line 95 of file caster.hpp.

◆ operator*() [1/2]

template<typename T>
T && rune_caster::caster< T >::operator* ( ) &&
inlineconstexprnoexcept

Definition at line 88 of file caster.hpp.

◆ operator*() [2/2]

template<typename T>
const T & rune_caster::caster< T >::operator* ( ) const &
inlineconstexprnoexcept

Access the underlying data directly.

Definition at line 84 of file caster.hpp.

◆ result() [1/3]

template<typename T>
T && rune_caster::caster< T >::result ( ) &&
inlineconstexprnoexcept

Get the final result (rvalue reference - move semantics)

Definition at line 70 of file caster.hpp.

◆ result() [2/3]

template<typename T>
T rune_caster::caster< T >::result ( ) const &&
inlineconstexpr

Get the final result (const rvalue reference)

Definition at line 77 of file caster.hpp.

◆ result() [3/3]

template<typename T>
const T & rune_caster::caster< T >::result ( ) const &
inlineconstexprnoexcept

Get the final result (const lvalue reference)

Definition at line 63 of file caster.hpp.

◆ type_name()

template<typename T>
constexpr const char * rune_caster::caster< T >::type_name ( )
inlinestaticconstexprnoexcept

Get type information at compile time.

Definition at line 108 of file caster.hpp.


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