FTXUI 6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
string.hpp
浏览该文件的文档.
1// 版权所有 2020 Arthur Sonzogni。保留所有权利。
2// 此源代码受 MIT 许可的约束,MIT 许可可在
3// LICENSE 文件中找到。
4#ifndef FTXUI_SCREEN_STRING_HPP
5#define FTXUI_SCREEN_STRING_HPP
6
7#include <string> // 用于 string, wstring, to_string
8#include <vector> // 用于 vector
9
10namespace ftxui {
11std::string to_string(const std::wstring& s);
12std::wstring to_wstring(const std::string& s);
13
14template <typename T>
15std::wstring to_wstring(T s) {
16 return to_wstring(std::to_string(s));
17}
18
19int string_width(const std::string&);
20
21// 将字符串拆分为字形。全角字形后会插入一个空字形。
22std::vector<std::string> Utf8ToGlyphs(const std::string& input);
23
24// 将 |input| 绘制的每个单元格映射到其对应的字形。半角
25// 字形占用一个单元格,全角字形占用两个单元格。
26std::vector<int> CellToGlyphIndex(const std::string& input);
27
28} // namespace ftxui
29
30#endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
std::vector< std::string > Utf8ToGlyphs(const std::string &input)
int string_width(const std::string &)
std::wstring to_wstring(const std::string &s)
将 UTF8 std::string 转换为 std::wstring。
std::string to_string(const std::wstring &s)
将 std::wstring 转换为 UTF8 std::string。
std::vector< int > CellToGlyphIndex(const std::string &input)