MCPcopy Create free account
hub / github.com/covscript/covscript / local2wide

Function local2wide

sources/compiler/lexer.cpp:40–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39 template <typename T>
40 std::u32string local2wide(const T &local)
41 {
42 std::u32string wide;
43 uint32_t head = 0;
44 bool read_next = true;
45 for (auto it = local.begin(); it != local.end();) {
46 if (read_next) {
47 head = *(it++);
48 if (head & u8_blck_begin)
49 read_next = false;
50 else
51 wide.push_back(set_zero(head));
52 }
53 else {
54 std::uint8_t tail = *(it++);
55 wide.push_back(set_zero(head << 8 | tail));
56 read_next = true;
57 }
58 }
59 if (!read_next)
60 throw cs::runtime_error("Codecvt: Bad encoding.");
61 return std::move(wide);
62 }
63} // namespace codecvt_gbk
64
65namespace cs {

Callers 1

local2wideMethod · 0.85

Calls 5

set_zeroFunction · 0.85
runtime_errorClass · 0.85
moveFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected