C++: expose special key codes constants

This commit is contained in:
Olivier Goffart 2023-07-31 15:11:57 +02:00 committed by GitHub
parent ad84114bae
commit 0a8f9c585a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 164 additions and 10 deletions

View file

@ -33,19 +33,15 @@ struct SharedString
/// Creates a new SharedString from the null-terminated string pointer \a s. The underlying
/// string data is copied. It is assumed that the string is UTF-8 encoded.
SharedString(const char *s) : SharedString(std::string_view(s)) { }
#if defined(__cpp_char8_t) || __cplusplus >= 202002L
/// Creates a new SharedString from the null-terminated string pointer \a s. The underlying
/// string data is copied.
SharedString(const char8_t *s) : SharedString(reinterpret_cast<const char *>(s)) { }
#endif
#ifdef __cpp_lib_char8_t
/// Creates a new SharedString from the string view \a s. The underlying string data is copied.
SharedString(std::u8string_view s)
{
cbindgen_private::slint_shared_string_from_bytes(
this, reinterpret_cast<const char *>(s.data()), s.size());
}
#endif
/// Creates a new SharedString from \a other.
SharedString(const SharedString &other)
{