FTXUI/include/ftxui/screen/string.hpp

36 lines
1.1 KiB
C++
Raw Normal View History

2023-08-19 19:56:36 +08:00
// Copyright 2020 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_HPP
#define FTXUI_SCREEN_STRING_HPP
2022-01-07 18:03:54 +08:00
#include <stddef.h> // for size_t
#include <cstdint> // for uint8_t
2022-01-07 18:03:54 +08:00
#include <string> // for string, wstring, to_string
#include <vector> // for vector
2018-09-18 14:48:40 +08:00
2020-08-09 20:53:56 +08:00
namespace ftxui {
2018-09-18 14:48:40 +08:00
std::string to_string(const std::wstring& s);
std::wstring to_wstring(const std::string& s);
template <typename T>
std::wstring to_wstring(T s) {
return to_wstring(std::to_string(s));
}
int string_width(const std::string&);
2023-05-02 19:32:37 +08:00
// Split the string into a its glyphs. An empty one is inserted ater fullwidth
// ones.
std::vector<std::string> Utf8ToGlyphs(const std::string& input);
// Map every cells drawn by |input| to their corresponding Glyphs. Half-size
// Glyphs takes one cell, full-size Glyphs take two cells.
std::vector<int> CellToGlyphIndex(const std::string& input);
2020-08-09 20:53:56 +08:00
} // namespace ftxui
#include "ftxui/screen/deprecated.hpp"
#endif /* end of include guard: FTXUI_SCREEN_STRING_HPP */