* @brief Returns the QStringConverter encoding for natively-supported entries. */
| 887 | * @brief Returns the QStringConverter encoding for natively-supported entries. |
| 888 | */ |
| 889 | static std::optional<QStringConverter::Encoding> nativeEncoding(SerialStudio::TextEncoding enc) |
| 890 | { |
| 891 | switch (enc) { |
| 892 | case SerialStudio::EncUtf8: |
| 893 | return QStringConverter::Utf8; |
| 894 | case SerialStudio::EncUtf16LE: |
| 895 | return QStringConverter::Utf16LE; |
| 896 | case SerialStudio::EncUtf16BE: |
| 897 | return QStringConverter::Utf16BE; |
| 898 | case SerialStudio::EncLatin1: |
| 899 | return QStringConverter::Latin1; |
| 900 | case SerialStudio::EncSystem: |
| 901 | return QStringConverter::System; |
| 902 | default: |
| 903 | return std::nullopt; |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | /** |
| 908 | * @brief Returns the `QTextCodec` for multi-byte East-Asian encodings. |
no outgoing calls
no test coverage detected