Rune Caster 1.0.0
Modern C++ Text Processing Framework
Loading...
Searching...
No Matches
rune_caster::spell::SpellComposition< FirstSpell, SecondSpell > Class Template Reference

Composition of two spells into a single spell pipeline. More...

#include <spell_composition.hpp>

Inheritance diagram for rune_caster::spell::SpellComposition< FirstSpell, SecondSpell >:
Collaboration diagram for rune_caster::spell::SpellComposition< FirstSpell, SecondSpell >:

Public Types

using input_type = typename FirstSpell::input_type
using output_type = typename SecondSpell::output_type
Public Types inherited from rune_caster::spell_base< RuneSequence >
using input_type
using output_type

Public Member Functions

constexpr SpellComposition (FirstSpell first, SecondSpell second)
 Construct a spell composition.
output_type operator() (const input_type &input) const override
 Apply the composed spells.
std::string description () const override
 Get the spell's description.
std::string name () const override
 Get the spell's name.
const FirstSpell & first_spell () const noexcept
 Get the first spell in the composition.
const SecondSpell & second_spell () const noexcept
 Get the second spell in the composition.
Public Member Functions inherited from rune_caster::spell_base< RuneSequence >
virtual ~spell_base ()=default
virtual output_type operator() (const input_type &input) const=0
 Apply the spell transformation.

Additional Inherited Members

Static Public Member Functions inherited from rune_caster::spell_base< RuneSequence >
static constexpr bool can_process () noexcept
 Check if this spell can be applied to the given input type (C++20 concepts)
static constexpr bool produces () noexcept
 Check if this spell produces the expected output type (C++20 concepts)
static constexpr const char * input_type_name () noexcept
 Get input type name as compile-time string (C++20)
static constexpr const char * output_type_name () noexcept
 Get output type name as compile-time string (C++20)

Detailed Description

template<typename FirstSpell, typename SecondSpell>
class rune_caster::spell::SpellComposition< FirstSpell, SecondSpell >

Composition of two spells into a single spell pipeline.

This class allows chaining two spells together, where the output of the first spell becomes the input of the second spell. Uses C++20 concepts for type safety.

Template Parameters
FirstSpellThe first spell in the composition
SecondSpellThe second spell in the composition

Definition at line 23 of file spell_composition.hpp.

Member Typedef Documentation

◆ input_type

template<typename FirstSpell, typename SecondSpell>
using rune_caster::spell::composition::SpellComposition< FirstSpell, SecondSpell >::input_type = typename FirstSpell::input_type

Definition at line 34 of file spell_composition.hpp.

◆ output_type

template<typename FirstSpell, typename SecondSpell>
using rune_caster::spell::composition::SpellComposition< FirstSpell, SecondSpell >::output_type = typename SecondSpell::output_type

Definition at line 35 of file spell_composition.hpp.

Constructor & Destructor Documentation

◆ SpellComposition()

template<typename FirstSpell, typename SecondSpell>
rune_caster::spell::composition::SpellComposition< FirstSpell, SecondSpell >::SpellComposition ( FirstSpell first,
SecondSpell second )
inlineconstexpr

Construct a spell composition.

Parameters
firstThe first spell to apply
secondThe second spell to apply

Definition at line 42 of file spell_composition.hpp.

Member Function Documentation

◆ description()

template<typename FirstSpell, typename SecondSpell>
std::string rune_caster::spell::composition::SpellComposition< FirstSpell, SecondSpell >::description ( ) const
inlineoverridevirtual

Get the spell's description.

Returns
A human-readable description of what the spell does

Implements rune_caster::spell_base< RuneSequence >.

Definition at line 61 of file spell_composition.hpp.

◆ first_spell()

template<typename FirstSpell, typename SecondSpell>
const FirstSpell & rune_caster::spell::composition::SpellComposition< FirstSpell, SecondSpell >::first_spell ( ) const
inlinenoexcept

Get the first spell in the composition.

Definition at line 72 of file spell_composition.hpp.

◆ name()

template<typename FirstSpell, typename SecondSpell>
std::string rune_caster::spell::composition::SpellComposition< FirstSpell, SecondSpell >::name ( ) const
inlineoverridevirtual

Get the spell's name.

Returns
A string identifying the spell

Implements rune_caster::spell_base< RuneSequence >.

Definition at line 65 of file spell_composition.hpp.

◆ operator()()

template<typename FirstSpell, typename SecondSpell>
output_type rune_caster::spell::composition::SpellComposition< FirstSpell, SecondSpell >::operator() ( const input_type & input) const
inlineoverride

Apply the composed spells.

Parameters
inputThe input to transform
Returns
The result of applying both spells in sequence

Definition at line 56 of file spell_composition.hpp.

◆ second_spell()

template<typename FirstSpell, typename SecondSpell>
const SecondSpell & rune_caster::spell::composition::SpellComposition< FirstSpell, SecondSpell >::second_spell ( ) const
inlinenoexcept

Get the second spell in the composition.

Definition at line 77 of file spell_composition.hpp.


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