mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-29 14:53:18 +00:00
ime_dialog: Initial implementation (#1267)
* Add C string types * Prepare existing enums * Added missing enums * Types update * State base * Compile Ime Dialog UI * UI implementation * Scoped lock * Functional implementation * Link against iconv on macOS * Fix building on windows * Better UI * clang-format * Some fixes and cleanup * Enable reserved checks * clang-format * Fix default text encoding max size * clang-format (again) * Some review changes * Use std::vector for dynamic strings * Use CString * Accept dialog on enter press * clang-format * Use ImGUI for encoding/decoding
This commit is contained in:
parent
0f91661660
commit
66f1bb937f
7 changed files with 847 additions and 143 deletions
|
@ -81,34 +81,42 @@ public:
|
|||
return std::basic_string_view<T>{data};
|
||||
}
|
||||
|
||||
char* begin() {
|
||||
T* begin() {
|
||||
if (this == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
const char* begin() const {
|
||||
const T* begin() const {
|
||||
if (this == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
char* end() {
|
||||
T* end() {
|
||||
if (this == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return data + N;
|
||||
}
|
||||
|
||||
const char* end() const {
|
||||
const T* end() const {
|
||||
if (this == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return data + N;
|
||||
}
|
||||
|
||||
constexpr std::size_t capacity() const {
|
||||
return N;
|
||||
}
|
||||
|
||||
std::size_t size() const {
|
||||
return std::char_traits<T>::length(data);
|
||||
}
|
||||
|
||||
T& operator[](size_t idx) {
|
||||
return data[idx];
|
||||
}
|
||||
|
@ -152,6 +160,12 @@ public:
|
|||
static_assert(sizeof(CString<13>) == sizeof(char[13])); // Ensure size still matches a simple array
|
||||
static_assert(std::weakly_incrementable<CString<13>::Iterator>);
|
||||
|
||||
template <size_t N>
|
||||
using CWString = CString<N, wchar_t>;
|
||||
|
||||
template <size_t N>
|
||||
using CU16String = CString<N, char16_t>;
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
} // namespace Common
|
Loading…
Add table
Add a link
Reference in a new issue