Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
code_point_view.cpp
Go to the documentation of this file.
1
// Copyright 2024 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#
include
"core/fxcrt/code_point_view.h"
6
7
#
include
"core/fxcrt/utf16.h"
8
9
#
if
!
defined
(
WCHAR_T_IS_16_BIT
)
10
#
error
"Building on wrong platform"
.
11
#
endif
12
13
namespace
pdfium
{
14
15
CodePointView
::
CodePointView
(
WideStringView
backing
) :
backing_
(
backing
) {}
16
17
CodePointView
::~
CodePointView
() =
default
;
18
19
CodePointView
::
Iterator
::
Iterator
(
WideStringView
str_view
)
20
:
current_
(
str_view
),
code_point_
(
Decode
()) {}
21
22
CodePointView
::
Iterator
::~
Iterator
() =
default
;
23
24
char32_t
CodePointView
::
Iterator
::
Decode
() {
25
if
(
current_
.
IsEmpty
()) {
26
return
kSentinel
;
27
}
28
char32_t
code_point
=
current_
.
Front
();
29
next_
=
current_
.
Substr
(1);
30
if
(
IsHighSurrogate
(
code_point
)) {
31
if
(!
next_
.
IsEmpty
() &&
IsLowSurrogate
(
next_
.
Front
())) {
32
code_point
=
SurrogatePair
(
code_point
,
next_
.
Front
()).
ToCodePoint
();
33
next_
=
next_
.
Substr
(1);
34
}
35
}
36
return
code_point
;
37
}
38
39
}
// namespace pdfium
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
code_point_view.cpp
Generated on
for Qt by
1.14.0