Rune Caster 1.0.0
Modern C++ Text Processing Framework
Loading...
Searching...
No Matches
Rune Caster API Documentation

🌟 κ°œμš”

**Rune Caster**λŠ” STLμ—μ„œ μ˜κ°μ„ 받은 Modern C++ ν…μŠ€νŠΈ 처리 ν”„λ ˆμž„μ›Œν¬μž…λ‹ˆλ‹€. 직관적이고 κ³ μ„±λŠ₯의 λ‹€κ΅­μ–΄ ν…μŠ€νŠΈ 처리 및 μ–Έμ–΄ κ°„ λ³€ν™˜ κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€.

πŸš€ μ£Όμš” νŠΉμ§•

  • πŸ”€ Rune μ‹œμŠ€ν…œ: μœ λ‹ˆμ½”λ“œ λ¬Έμžμ™€ λ¬Έμžμ—΄μ„ λ‹€λ£¨λŠ” STL μŠ€νƒ€μΌ μ»¨ν…Œμ΄λ„ˆ
  • ⚑ Zero-cost Abstractions: λŸ°νƒ€μž„ μ˜€λ²„ν—€λ“œ μ—†λŠ” κ³ μ„±λŠ₯ 처리
  • 🌍 λ‹€κ΅­μ–΄ 지원: ν•œκ΅­μ–΄, μ˜μ–΄, 일본어 λ“± 34개 μ–Έμ–΄ Unicode ν…μŠ€νŠΈ 처리
  • 🎯 STL ν˜Έν™˜: μ΅μˆ™ν•œ μ»¨ν…Œμ΄λ„ˆ-μ•Œκ³ λ¦¬μ¦˜-μ΄ν„°λ ˆμ΄ν„° νŒ¨ν„΄
  • πŸ”§ C++20: Modern C++ κΈ°λŠ₯을 적극 ν™œμš©ν•œ νƒ€μž… μ•ˆμ „ν•œ API

πŸ“š 핡심 μ»΄ν¬λ„ŒνŠΈ

1. Rune 클래슀

κ°œλ³„ Unicode 문자λ₯Ό ν‘œν˜„ν•˜λŠ” κΈ°λ³Έ λ‹¨μœ„μž…λ‹ˆλ‹€.

// λ‹€μ–‘ν•œ λ°©λ²•μœΌλ‘œ Rune 생성
auto korean = U'κ°€'_rune; // μ‚¬μš©μž μ •μ˜ λ¦¬ν„°λŸ΄
auto english = Rune::from_utf8("A"); // UTF-8μ—μ„œ 생성
auto japanese = Rune(U'あ'); // 직접 생성
// 언어별 속성 확인 (constexpr 지원)
static_assert(korean.is_hangul());
static_assert(english.is_ascii());
static_assert(japanese.is_hiragana());

2. RuneString 클래슀

Unicode λ¬Έμžμ—΄μ„ λ‹€λ£¨λŠ” STL ν˜Έν™˜ μ»¨ν…Œμ΄λ„ˆμž…λ‹ˆλ‹€.

// λ‹€μ–‘ν•œ λ°©λ²•μœΌλ‘œ RuneString 생성
auto text = RuneString::from_utf8("μ•ˆλ…•ν•˜μ„Έμš” Hello こんにけは");
auto korean_part = text.substr(0, 5);
auto has_greeting = text.contains(U'μ•ˆ'_rune);
// STL μŠ€νƒ€μΌ μΈν„°νŽ˜μ΄μŠ€
for (const auto& rune : text) {
std::cout << "μ–Έμ–΄: " << static_cast<int>(rune.language()) << std::endl;
}

3. Spell μ‹œμŠ€ν…œ

ν…μŠ€νŠΈ λ³€ν™˜ μ•Œκ³ λ¦¬μ¦˜μ„ μ œκ³΅ν•©λ‹ˆλ‹€.

// Factory ν•¨μˆ˜λ₯Ό ν†΅ν•œ Spell 생성
auto normalized = text
| spell::normalize_whitespace() // 곡백 μ •κ·œν™”
| spell::lowercase() // μ†Œλ¬Έμž λ³€ν™˜
| spell::unicode_nfc(); // Unicode μ •κ·œν™”
// Spell μ‘°ν•©
auto complex_spell = spell::compose(
spell::normalize_whitespace(true, true),
spell::lowercase()
);
Simple and unified spell system for text transformation.

4. Caster νŒŒμ΄ν”„λΌμΈ

ν•¨μˆ˜ν˜• μŠ€νƒ€μΌμ˜ ν…μŠ€νŠΈ 처리 νŒŒμ΄ν”„λΌμΈμ„ μ œκ³΅ν•©λ‹ˆλ‹€.

using namespace rune_caster;
// Caster μŠ€νƒ€μΌ νŒŒμ΄ν”„λΌμΈ
auto result = make_caster(input_text)
.result();
// Pipe operator μŠ€νƒ€μΌ (더 간단함)
auto result2 = input_text
auto unicode_nfc()
Apply Unicode NFC normalization.
Definition spell.hpp:82
auto normalize_whitespace(bool collapse_multiple=true, bool trim_edges=true)
Normalize whitespace (collapse multiple spaces, optionally trim)
Definition spell.hpp:75
auto lowercase()
Convert text to lowercase.
Definition spell.hpp:47
constexpr auto make_caster(T &&data) noexcept -> caster< std::decay_t< T > >
Factory function to create a caster (C++20 template argument deduction)
Definition caster.hpp:124

πŸ› οΈ λΉ λ₯Έ μ‹œμž‘

1. κΈ°λ³Έ μ„€μ •

2. κ°„λ‹¨ν•œ 예제

int main() {
// λ‹€κ΅­μ–΄ ν…μŠ€νŠΈ 생성
auto text = RuneSequence::from_utf8(" Hello, μ•ˆλ…•ν•˜μ„Έμš”! こんにけは ");
// ν…μŠ€νŠΈ μ •μ œ (ν˜„μž¬ API μ‚¬μš©)
auto cleaned = text
| spell::normalize_whitespace() // 곡백 μ •κ·œν™”
| spell::lowercase(); // μ†Œλ¬Έμž λ³€ν™˜
// λ˜λŠ” Caster μ‚¬μš©
auto result = make_caster(text)
.cast(spell::trim())
.result();
// κ²°κ³Ό 좜λ ₯
std::cout << "원본: " << text.to_utf8() << std::endl;
std::cout << "μ •μ œ: " << cleaned.to_utf8() << std::endl;
std::cout << "μ£Όμš” μ–Έμ–΄: " << static_cast<int>(text.primary_language()) << std::endl;
return 0;
}
static RuneString from_utf8(std::string_view utf8_text)
Create a RuneString from UTF-8 text.
auto trim()
Trim leading and trailing whitespace.
Definition spell.hpp:68

🎯 κ³ κΈ‰ κΈ°λŠ₯

constexpr 지원

컴파일 νƒ€μž„μ— 문자 속성을 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.

constexpr auto korean_char = U'κ°€'_rune;
static_assert(korean_char.is_hangul());
static_assert(korean_char.language() == language::Code::Korean);
@ Korean
ν•œκ΅­μ–΄ (ko-KR) - Korean
Definition language.hpp:45

C++20 Concepts

νƒ€μž… μ•ˆμ „μ„±μ„ 보μž₯ν•©λ‹ˆλ‹€.

template<spell_for<RuneString> Spell>
auto process_text(const RuneString& text, Spell&& spell) {
return spell(text);
}
A sequence container for Rune objects (API Design Document: RuneString)
Unified spell object for text transformation.

Ranges 지원

STL ranges와 μ™„λ²½ν•˜κ²Œ ν˜Έν™˜λ©λ‹ˆλ‹€.

auto vowels = text
| std::views::filter([](const Rune& r) { return r.is_vowel(); })
| std::ranges::to<std::vector>();
Represents a single textual unit with Unicode and linguistic properties.
Definition rune.hpp:23
constexpr bool is_vowel() const noexcept
Check if this rune represents a vowel.
Definition rune.hpp:315

πŸ“– 상세 λ¬Έμ„œ

각 ν΄λž˜μŠ€μ™€ ν•¨μˆ˜μ˜ μƒμ„Έν•œ μ‚¬μš©λ²•μ€ λ‹€μŒ μ„Ήμ…˜μ„ μ°Έμ‘°ν•˜μ„Έμš”:

πŸ”§ λΉŒλ“œ μš”κ΅¬μ‚¬ν•­

  • C++ ν‘œμ€€: C++20 이상
  • 컴파일러: GCC 10+, Clang 10+, MSVC 19.29+
  • CMake: 3.20 이상

πŸ“ λΌμ΄μ„ μŠ€

MIT License


**Rune Caster**둜 ν˜„λŒ€μ μ΄κ³  μ•ˆμ „ν•œ λ‹€κ΅­μ–΄ ν…μŠ€νŠΈ 처리λ₯Ό μ‹œμž‘ν•΄λ³΄μ„Έμš”! πŸš€