Loading...
Searching...
No Matches
string_internal.hpp
Go to the documentation of this file.
// Copyright 2023 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_SCREEN_STRING_INTERNAL_HPP
#define FTXUI_SCREEN_STRING_INTERNAL_HPP
#include <cstdint>
#include <string>
#include <vector>
namespace ftxui {
bool EatCodePoint(const std::string& input,
size_t start,
size_t* end,
uint32_t* ucs);
bool EatCodePoint(const std::wstring& input,
size_t start,
size_t* end,
uint32_t* ucs);
bool IsCombining(uint32_t ucs);
bool IsFullWidth(uint32_t ucs);
bool IsControl(uint32_t ucs);
size_t GlyphPrevious(const std::string& input, size_t start);
size_t GlyphNext(const std::string& input, size_t start);
// Return the index in the |input| string of the glyph at |glyph_offset|,
// starting at |start|
size_t GlyphIterate(const std::string& input,
int glyph_offset,
size_t start = 0);
// Returns the number of glyphs in |input|.
int GlyphCount(const std::string& input);
// Properties from:
// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
enum class WordBreakProperty : int8_t {
ALetter,
CR,
Double_Quote,
Extend,
ExtendNumLet,
Format,
Hebrew_Letter,
Katakana,
LF,
MidLetter,
MidNum,
MidNumLet,
Newline,
Numeric,
Regional_Indicator,
Single_Quote,
WSegSpace,
ZWJ,
};
WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint);
std::vector<WordBreakProperty> Utf8ToWordBreakProperty(
const std::string& input);
bool IsWordBreakingCharacter(const std::string& input, size_t glyph_index);
} // namespace ftxui
#endif /* end of include guard: FTXUI_SCREEN_STRING_INTERNAL_HPP */
ftxui
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
Definition string_internal.hpp:42
ftxui::WordBreakProperty::Double_Quote
@ Double_Quote
Definition string_internal.hpp:43
ftxui::WordBreakProperty::Hebrew_Letter
@ Hebrew_Letter
Definition string_internal.hpp:47
ftxui::WordBreakProperty::Extend
@ Extend
Definition string_internal.hpp:44
ftxui::WordBreakProperty::WSegSpace
@ WSegSpace
Definition string_internal.hpp:57
ftxui::WordBreakProperty::MidNumLet
@ MidNumLet
Definition string_internal.hpp:52
ftxui::WordBreakProperty::Format
@ Format
Definition string_internal.hpp:46
ftxui::WordBreakProperty::LF
@ LF
Definition string_internal.hpp:49
ftxui::WordBreakProperty::Newline
@ Newline
Definition string_internal.hpp:53
ftxui::WordBreakProperty::Regional_Indicator
@ Regional_Indicator
Definition string_internal.hpp:55
ftxui::WordBreakProperty::Numeric
@ Numeric
Definition string_internal.hpp:54
ftxui::WordBreakProperty::MidNum
@ MidNum
Definition string_internal.hpp:51
ftxui::WordBreakProperty::ALetter
@ ALetter
Definition string_internal.hpp:41
ftxui::WordBreakProperty::MidLetter
@ MidLetter
Definition string_internal.hpp:50
ftxui::WordBreakProperty::Single_Quote
@ Single_Quote
Definition string_internal.hpp:56
ftxui::WordBreakProperty::ZWJ
@ ZWJ
Definition string_internal.hpp:58
ftxui::WordBreakProperty::ExtendNumLet
@ ExtendNumLet
Definition string_internal.hpp:45
ftxui::WordBreakProperty::Katakana
@ Katakana
Definition string_internal.hpp:48
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