Rune Caster 1.0.0
Modern C++ Text Processing Framework
Loading...
Searching...
No Matches
spell_core.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "rune_sequence.hpp"
4#include "unicode.hpp"
5#include "spell_base.hpp"
6
7namespace rune_caster {
8namespace spell {
9namespace core {
10
18private:
19 bool collapse_multiple_;
20 bool trim_edges_;
21
22public:
25
31 explicit WhitespaceNormalizer(bool collapse_multiple = true, bool trim_edges = true);
32
33 RuneSequence operator()(const RuneSequence& input) const override;
34 std::string description() const override;
35 std::string name() const override { return "WhitespaceNormalizer"; }
36};
37
44private:
46
47public:
50
56
57 RuneSequence operator()(const RuneSequence& input) const override;
58 std::string description() const override;
59 std::string name() const override { return "UnicodeNormalizer"; }
60};
61
69public:
70 enum class CaseType {
74 };
75
76private:
77 CaseType case_type_;
78
79public:
82
88
89 RuneSequence operator()(const RuneSequence& input) const override;
90 std::string description() const override;
91 std::string name() const override { return "CaseConverter"; }
92
97 CaseType case_type() const noexcept { return case_type_; }
98};
99
103class TrimEdges : public sequence_spell {
104public:
107
108 RuneSequence operator()(const RuneSequence& input) const override;
109 std::string description() const override { return "Trim leading/trailing whitespace"; }
110 std::string name() const override { return "TrimEdges"; }
111};
112
113} // namespace core
114} // namespace spell
115} // namespace rune_caster
@ Title
Convert to titlecase (first letter of each word)
std::string name() const override
Get the spell's name.
std::string description() const override
Get the spell's description.
CaseType case_type() const noexcept
Get the case type of this converter.
CaseConverter(CaseType case_type)
Construct a CaseConverter.
RuneSequence operator()(const RuneSequence &input) const override
Apply the spell transformation.
Trim leading and trailing whitespace.
std::string description() const override
Get the spell's description.
RuneSequence operator()(const RuneSequence &input) const override
Apply the spell transformation.
Definition trim_edges.cpp:7
std::string name() const override
Get the spell's name.
std::string description() const override
Get the spell's description.
std::string name() const override
Get the spell's name.
RuneSequence operator()(const RuneSequence &input) const override
Apply the spell transformation.
UnicodeNormalizer(unicode::NormalizationForm form=unicode::NormalizationForm::NFC)
Construct a UnicodeNormalizer.
WhitespaceNormalizer(bool collapse_multiple=true, bool trim_edges=true)
Construct a WhitespaceNormalizer.
std::string name() const override
Get the spell's name.
std::string description() const override
Get the spell's description.
RuneSequence operator()(const RuneSequence &input) const override
Apply the spell transformation.
RuneString RuneSequence
Backward compatibility alias for RuneString.
spell_base< RuneSequence > sequence_spell
Most common spell type: RuneSequence -> RuneSequence.