FTXUI 6.1.9
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
11namespace ftxui {
12
13bool EatCodePoint(std::string_view input,
14 size_t start,
15 size_t* end,
16 uint32_t* ucs);
17bool EatCodePoint(std::wstring_view input,
18 size_t start,
19 size_t* end,
20 uint32_t* ucs);
21
22bool IsCombining(uint32_t ucs);
23bool IsFullWidth(uint32_t ucs);
24bool IsControl(uint32_t ucs);
25
26size_t GlyphPrevious(std::string_view input, size_t start);
27size_t GlyphNext(std::string_view input, size_t start);
28
29// Return the index in the |input| string of the glyph at |glyph_offset|,
30// starting at |start|
31size_t GlyphIterate(std::string_view input, int glyph_offset, size_t start = 0);
32
33// Returns the number of glyphs in |input|.
34int GlyphCount(std::string_view input);
35
36// Properties from:
37// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
38enum class WordBreakProperty : int8_t {
39 ALetter,
40 CR,
42 Extend,
44 Format,
47 LF,
49 MidNum,
51 Newline,
52 Numeric,
56 ZWJ,
57};
59std::vector<WordBreakProperty> Utf8ToWordBreakProperty(std::string_view input);
60
61bool IsWordBreakingCharacter(std::string_view input, size_t glyph_index);
62} // namespace ftxui
63
64#endif /* end of include guard: FTXUI_SCREEN_STRING_INTERNAL_HPP */
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
bool IsControl(uint32_t ucs)
Definition string.cpp:1294
WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint)
Definition string.cpp:1308
size_t GlyphPrevious(std::string_view input, size_t start)
Definition string.cpp:1400
bool IsCombining(uint32_t ucs)
Definition string.cpp:1282
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:1174
int GlyphCount(std::string_view input)
Definition string.cpp:1506
std::vector< WordBreakProperty > Utf8ToWordBreakProperty(std::string_view input)
Definition string.cpp:1534
size_t GlyphIterate(std::string_view input, int glyph_offset, size_t start)
Definition string.cpp:1451
bool IsFullWidth(uint32_t ucs)
Definition string.cpp:1286
size_t GlyphNext(std::string_view input, size_t start)
Definition string.cpp:1425