mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
chore(core): update core to C++17
- use utfcodec.hpp's convert<>() instead of codecvt Fixes: #8800
This commit is contained in:
parent
a8776afac2
commit
02413c0251
5 changed files with 6 additions and 8 deletions
|
|
@ -9,7 +9,7 @@ project('keyman_core', 'cpp', 'c',
|
|||
version: run_command(find_program('getversion.bat', 'getversion.sh'), check:true).stdout().strip(),
|
||||
license: 'MIT',
|
||||
default_options : ['buildtype=release',
|
||||
'cpp_std=c++14',
|
||||
'cpp_std=c++17',
|
||||
'b_vscrt=static_from_buildtype',
|
||||
'warning_level=2',
|
||||
'debug=true'],
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#include <sstream>
|
||||
#include <memory>
|
||||
#include <iomanip>
|
||||
#include <codecvt>
|
||||
|
||||
#include "keyman_core.h"
|
||||
#include "jsonpp.hpp"
|
||||
|
|
@ -22,6 +21,7 @@
|
|||
#include "state.hpp"
|
||||
#include "vkey_to_contextreset.hpp"
|
||||
#include "kmx_file.h"
|
||||
#include "utfcodec.hpp"
|
||||
|
||||
using namespace km::core;
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ km_core_cu * km_core_state_context_debug(
|
|||
|
||||
km_core_context_items_dispose(context_items);
|
||||
|
||||
std::u16string s = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(buffer.str());
|
||||
std::u16string s = convert<char, char16_t>(buffer.str());
|
||||
|
||||
km_core_cu* result = new km_core_cu[s.size() + 1];
|
||||
s.copy(result, s.size());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include "kmx_processevent.h"
|
||||
#include "utfcodec.hpp"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <codecvt>
|
||||
|
||||
#if 0
|
||||
// TODO-LDML If we need to avoid exceptions in JSON
|
||||
|
|
@ -200,7 +199,7 @@ LdmlTestSource::parse_source_string(std::string const &s) {
|
|||
std::u16string
|
||||
LdmlTestSource::parse_u8_source_string(std::string const &u8s) {
|
||||
// convert from utf-8 to utf-16 first
|
||||
std::u16string s = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(u8s);
|
||||
std::u16string s = convert<char, char16_t>(u8s);
|
||||
std::u16string t;
|
||||
for (auto p = s.begin(); p != s.end(); p++) {
|
||||
if (*p == '\\') {
|
||||
|
|
@ -219,7 +218,7 @@ LdmlTestSource::parse_u8_source_string(std::string const &u8s) {
|
|||
size_t n;
|
||||
std::u16string s1 = s.substr(p - s.begin(), 8);
|
||||
// TODO-LDML: convert back first?
|
||||
std::string s1b = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(s1);
|
||||
std::string s1b = convert<char16_t, char>(s1);
|
||||
v = std::stoul(s1b, &n, 16);
|
||||
// Allow deadkey_number (U+0001) characters and onward
|
||||
assert(v >= 0x0001 && v <= 0x10FFFF);
|
||||
|
|
|
|||
2
docs/build/old/core-desktop-notes.md
vendored
2
docs/build/old/core-desktop-notes.md
vendored
|
|
@ -6,7 +6,7 @@ WARNING: these are old configuration notes. See [index.md](../index.md) for curr
|
|||
- Python 3
|
||||
- Meson build system 0.45+ (0.56+ for WASM)
|
||||
- ninja 1.8+
|
||||
- C++14 or later compiler (VC++ 2019 or later for Windows).
|
||||
- C++17 or later compiler (VC++ 2019 or later for Windows).
|
||||
- lib std::fs
|
||||
- kmc (for tests) -- must be added to path
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue