FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
string.hpp
Go to the documentation of this file.
1// Copyright 2020 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_HPP
5#define FTXUI_SCREEN_STRING_HPP
6
7#include <string> // for string, wstring, to_string
8#include <string_view> // for string_view
9#include <vector> // for vector
10
11namespace ftxui {
12std::string to_string(std::wstring_view s);
13std::wstring to_wstring(std::string_view s);
14
15template <typename T>
16std::wstring to_wstring(T s) {
17 return to_wstring(std::string_view(std::to_string(s)));
18}
19template <>
20inline std::wstring to_wstring(const char* s) {
21 return to_wstring(std::string_view(s));
22}
23
24int string_width(std::string_view);
25
26// Split the string into a its glyphs. An empty one is inserted ater fullwidth
27// ones.
28std::vector<std::string> Utf8ToGlyphs(std::string_view input);
29
30// Map every cells drawn by |input| to their corresponding Glyphs. Half-size
31// Glyphs takes one cell, full-size Glyphs take two cells.
32std::vector<int> CellToGlyphIndex(std::string_view input);
33
34} // namespace ftxui
35
36#endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
std::vector< std::string > Utf8ToGlyphs(std::string_view input)
Definition string.cpp:1358
std::string to_string(std::wstring_view s)
Convert a std::wstring into a UTF8 std::string.
Definition string.cpp:1565
std::vector< int > CellToGlyphIndex(std::string_view input)
Definition string.cpp:1465
int string_width(std::string_view)
Definition string.cpp:1331
std::wstring to_wstring(std::string_view s)
Convert a UTF8 std::string into a std::wstring.
Definition string.cpp:1637