Rune Caster 1.0.0
Modern C++ Text Processing Framework
Loading...
Searching...
No Matches
spell_extensible.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "spell_base.hpp"
4#include <string>
5
6namespace rune_caster {
7
27template<typename Input = RuneSequence, typename Output = Input>
28class spell_extensible : public spell_base<Input, Output> {
29public:
30 using input_type = Input;
31 using output_type = Output;
32
33 // Construct with spell meta-information.
34 explicit spell_extensible(std::string name, std::string desc)
35 : name_(std::move(name)), desc_(std::move(desc)) {}
36
37 // Public API expected by spell_base ------------------------------
38 output_type operator()(const input_type& input) const override {
39 return process(input);
40 }
41 std::string name() const override { return name_; }
42 std::string description() const override { return desc_; }
43
44protected:
45 // Derived classes MUST override this with actual logic
46 virtual output_type process(const input_type& input) const = 0;
47
48private:
49 std::string name_;
50 std::string desc_;
51};
52
53} // namespace rune_caster
Base interface for all spell algorithms with C++20 enhancements.
output_type operator()(const input_type &input) const override
virtual output_type process(const input_type &input) const =0
std::string name() const override
Get the spell's name.
spell_extensible(std::string name, std::string desc)
std::string description() const override
Get the spell's description.