Rune Caster 1.0.0
Modern C++ Text Processing Framework
Loading...
Searching...
No Matches
punctuation_filter.cpp
Go to the documentation of this file.
3
4namespace rune_caster {
5namespace spell {
6namespace filter {
7
9 if (input.empty()) return RuneSequence();
10
11 RuneSequence result;
12 result.reserve(input.size());
13
14 for (const auto& rune : input) {
15 bool is_punct = unicode::is_punctuation(rune.codepoint());
16 if (remove_mode_) {
17 if (!is_punct) result.push_back(rune);
18 } else {
19 if (is_punct) result.push_back(rune);
20 }
21 }
22 return result;
23}
24
25} // namespace filter
26} // namespace spell
27} // namespace rune_caster
bool empty() const noexcept
void reserve(size_type new_cap)
void push_back(const Rune &rune)
size_type size() const noexcept
RuneSequence operator()(const RuneSequence &input) const override
Apply the spell transformation.
constexpr bool is_punctuation(char32_t cp) noexcept
Definition unicode.hpp:86
RuneString RuneSequence
Backward compatibility alias for RuneString.