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.h
Go to the documentation of this file.
1
// Copyright 2023 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
#
ifndef
CORE_FXCRT_CODE_POINT_VIEW_H_
6
#
define
CORE_FXCRT_CODE_POINT_VIEW_H_
7
8
#
include
"build/build_config.h"
9
#
include
"core/fxcrt/check_op.h"
10
#
include
"core/fxcrt/string_view_template.h"
11
#
include
"core/fxcrt/utf16.h"
12
13
namespace
pdfium
{
14
15
#
if
defined
(
WCHAR_T_IS_16_BIT
)
16
// A view over a UTF-16 `WideStringView` suitable for iterating by code point
17
// using a range-based `for` loop.
18
class
CodePointView
final
{
19
public
:
20
class
Iterator
{
21
public
:
22
~
Iterator
();
23
24
bool
operator
==(
const
Iterator
&
other
)
const
{
25
return
current_
==
other
.
current_
;
26
}
27
28
bool
operator
!=(
const
Iterator
&
other
)
const
{
29
return
current_
!=
other
.
current_
;
30
}
31
32
Iterator
&
operator
++() {
33
current_
=
next_
;
34
code_point_
=
Decode
();
35
return
*
this
;
36
}
37
38
char32_t
operator
*()
const
{
39
DCHECK_NE
(
kSentinel
,
code_point_
);
40
return
code_point_
;
41
}
42
43
private
:
44
friend
class
CodePointView
;
45
46
static
constexpr
char32_t
kSentinel
= -1;
47
48
explicit
Iterator
(
WideStringView
str_view
);
49
50
char32_t
Decode
();
51
52
WideStringView
current_
;
53
WideStringView
next_
;
54
char32_t
code_point_
;
55
};
56
57
explicit
CodePointView
(
WideStringView
backing
);
58
~
CodePointView
();
59
60
Iterator
begin
()
const
{
return
Iterator
(
backing_
); }
61
Iterator
end
()
const
{
return
Iterator
(
WideStringView
()); }
62
63
private
:
64
WideStringView
backing_
;
65
};
66
#
else
67
using
CodePointView
=
WideStringView
;
68
#
endif
// defined(WCHAR_T_IS_16_BIT)
69
70
}
// namespace pdfium
71
72
#
endif
// CORE_FXCRT_CODE_POINT_VIEW_H_
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
pdfium::CodePointView
WideStringView CodePointView
Definition
code_point_view.h:67
WideStringView
fxcrt::WideStringView WideStringView
Definition
string_view_template.h:326
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
code_point_view.h
Generated on
for Qt by
1.14.0