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
11 namespace ftxui {
12
13 bool EatCodePoint(const std::string& input,
14 size_t start,
15 size_t* end,
16 uint32_t* ucs);
17 bool EatCodePoint(const std::wstring& input,
18 size_t start,
19 size_t* end,
20 uint32_t* ucs);
21
22 bool IsCombining(uint32_t ucs);
23 bool IsFullWidth(uint32_t ucs);
24 bool IsControl(uint32_t ucs);
25
26 size_t GlyphPrevious(const std::string& input, size_t start);
27 size_t GlyphNext(const std::string& input, size_t start);
28
29// Return the index in the |input| string of the glyph at |glyph_offset|,
30// starting at |start|
31 size_t GlyphIterate(const std::string& input,
32 int glyph_offset,
33 size_t start = 0);
34
35// Returns the number of glyphs in |input|.
36 int GlyphCount(const std::string& input);
37
38// Properties from:
39// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
40 enum class WordBreakProperty : int8_t {
41 ALetter,
42 CR,
43 Double_Quote,
44 Extend,
45 ExtendNumLet,
46 Format,
47 Hebrew_Letter,
48 Katakana,
49 LF,
50 MidLetter,
51 MidNum,
52 MidNumLet,
53 Newline,
54 Numeric,
55 Regional_Indicator,
56 Single_Quote,
57 WSegSpace,
58 ZWJ,
59};
60 WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint);
61std::vector<WordBreakProperty> Utf8ToWordBreakProperty(
62 const std::string& input);
63
64 bool IsWordBreakingCharacter(const std::string& input, size_t glyph_index);
65} // namespace ftxui
66
67#endif /* end of include guard: FTXUI_SCREEN_STRING_INTERNAL_HPP */
ftxui
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
ftxui::GlyphNext
size_t GlyphNext(const std::string &input, size_t start)
Definition string.cpp:1424
ftxui::IsControl
bool IsControl(uint32_t ucs)
Definition string.cpp:1293
ftxui::CodepointToWordBreakProperty
WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint)
Definition string.cpp:1307
ftxui::IsCombining
bool IsCombining(uint32_t ucs)
Definition string.cpp:1282
ftxui::WordBreakProperty
WordBreakProperty
Definition string_internal.hpp:40
ftxui::WordBreakProperty::CR
@ CR
ftxui::WordBreakProperty::Double_Quote
@ Double_Quote
ftxui::WordBreakProperty::Hebrew_Letter
@ Hebrew_Letter
ftxui::WordBreakProperty::Extend
@ Extend
ftxui::WordBreakProperty::WSegSpace
@ WSegSpace
ftxui::WordBreakProperty::MidNumLet
@ MidNumLet
ftxui::WordBreakProperty::Format
@ Format
ftxui::WordBreakProperty::LF
@ LF
ftxui::WordBreakProperty::Newline
@ Newline
ftxui::WordBreakProperty::Regional_Indicator
@ Regional_Indicator
ftxui::WordBreakProperty::Numeric
@ Numeric
ftxui::WordBreakProperty::MidNum
@ MidNum
ftxui::WordBreakProperty::ALetter
@ ALetter
ftxui::WordBreakProperty::MidLetter
@ MidLetter
ftxui::WordBreakProperty::Single_Quote
@ Single_Quote
ftxui::WordBreakProperty::ZWJ
@ ZWJ
ftxui::WordBreakProperty::ExtendNumLet
@ ExtendNumLet
ftxui::WordBreakProperty::Katakana
@ Katakana
ftxui::IsWordBreakingCharacter
bool IsWordBreakingCharacter(const std::string &input, size_t glyph_index)
ftxui::EatCodePoint
bool EatCodePoint(const std::string &input, size_t start, size_t *end, uint32_t *ucs)
Definition string.cpp:1174
ftxui::GlyphCount
int GlyphCount(const std::string &input)
Definition string.cpp:1505
ftxui::IsFullWidth
bool IsFullWidth(uint32_t ucs)
Definition string.cpp:1286
ftxui::Utf8ToWordBreakProperty
std::vector< WordBreakProperty > Utf8ToWordBreakProperty(const std::string &input)
Definition string.cpp:1533
ftxui::GlyphIterate
size_t GlyphIterate(const std::string &input, int glyph_offset, size_t start)
Definition string.cpp:1450
ftxui::GlyphPrevious
size_t GlyphPrevious(const std::string &input, size_t start)
Definition string.cpp:1399