FTXUI 7.0.3
C++ functional terminal UI.
Loading...
Searching...
No Matches
string_internal.hpp
Go to the documentation of this file.
1// Copyright 2023 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#ifndef FTXUI_SCREEN_STRING_INTERNAL_HPP
5#define FTXUI_SCREEN_STRING_INTERNAL_HPP
6
7#include <cstdint>
8#include <string>
9#include <vector>
10
11#include "ftxui/util/export.hpp"
12
13namespace ftxui {
14
15// 'component' ライブラリのためにエクスポートされた内部関数。
16FTXUI_EXPORT(SCREEN)
17bool EatCodePoint(std::string_view input,
18 size_t start,
19 size_t* end,
20 uint32_t* ucs);
21FTXUI_EXPORT(SCREEN)
22bool EatCodePoint(std::wstring_view input,
23 size_t start,
24 size_t* end,
25 uint32_t* ucs);
26
27FTXUI_EXPORT(SCREEN) bool IsCombining(uint32_t ucs);
28FTXUI_EXPORT(SCREEN) bool IsFullWidth(uint32_t ucs);
29FTXUI_EXPORT(SCREEN) bool IsControl(uint32_t ucs);
30
31FTXUI_EXPORT(SCREEN) size_t GlyphPrevious(std::string_view input, size_t start);
32FTXUI_EXPORT(SCREEN) size_t GlyphNext(std::string_view input, size_t start);
33
34// |input| 文字列内の |glyph_offset| にあるグリフのインデックスを、|start| から開始して返します。
35FTXUI_EXPORT(SCREEN)
36size_t GlyphIterate(std::string_view input, int glyph_offset, size_t start = 0);
37
38// |input| 内のグリフの数を返します。
39FTXUI_EXPORT(SCREEN) int GlyphCount(std::string_view input);
40
41// プロパティの出典:
42// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
43enum class WordBreakProperty : int8_t {
44 ALetter,
45 CR,
47 Extend,
49 Format,
52 LF,
54 MidNum,
56 Newline,
57 Numeric,
61 ZWJ,
62};
63FTXUI_EXPORT(SCREEN)
65FTXUI_EXPORT(SCREEN)
66std::vector<WordBreakProperty> Utf8ToWordBreakProperty(std::string_view input);
67
68FTXUI_EXPORT(SCREEN)
69bool IsWordBreakingCharacter(std::string_view input, size_t glyph_index);
70} // namespace ftxui
71
72#endif /* インクルードガードの終了: FTXUI_SCREEN_STRING_INTERNAL.HPP */
#define FTXUI_EXPORT(component)
Definition export.hpp:25
FTXUI ftxui::名前空間
Definition animation.hpp:11
bool IsControl(uint32_t ucs)
Definition string.cpp:252
WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint)
Definition string.cpp:266
size_t GlyphPrevious(std::string_view input, size_t start)
Definition string.cpp:384
bool IsCombining(uint32_t ucs)
Definition string.cpp:240
bool IsWordBreakingCharacter(std::string_view input, size_t glyph_index)
bool EatCodePoint(std::string_view input, size_t start, size_t *end, uint32_t *ucs)
Definition string.cpp:135
int GlyphCount(std::string_view input)
Definition string.cpp:489
std::vector< WordBreakProperty > Utf8ToWordBreakProperty(std::string_view input)
Definition string.cpp:516
size_t GlyphIterate(std::string_view input, int glyph_offset, size_t start)
Definition string.cpp:434
bool IsFullWidth(uint32_t ucs)
Definition string.cpp:244
size_t GlyphNext(std::string_view input, size_t start)
Definition string.cpp:409