Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
5ec11ce1
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
1 年多 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5ec11ce1
编写于
12月 27, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[iter] Clarify readonly vs lvalue iterators
lvalue iterators must declare __item_type__ as a reference.
上级
2cbf5bf3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
13 deletion
+16
-13
src/hb-array.hh
src/hb-array.hh
+3
-3
src/hb-iter.hh
src/hb-iter.hh
+6
-5
src/hb-set.hh
src/hb-set.hh
+3
-3
src/test-iter.cc
src/test-iter.cc
+4
-2
未找到文件。
src/hb-array.hh
浏览文件 @
5ec11ce1
...
...
@@ -38,8 +38,8 @@ struct hb_sorted_array_t;
template
<
typename
Type
>
struct
hb_array_t
:
hb_iter_t
<
hb_array_t
<
Type
>
,
Type
>
,
hb_iter_mixin_t
<
hb_array_t
<
Type
>
,
Type
>
hb_iter_t
<
hb_array_t
<
Type
>
,
Type
&
>
,
hb_iter_mixin_t
<
hb_array_t
<
Type
>
,
Type
&
>
{
/*
* Constructors.
...
...
@@ -52,7 +52,7 @@ struct hb_array_t :
/*
* Iterator implementation.
*/
typedef
Type
__item_type__
;
typedef
Type
&
__item_type__
;
Type
&
__item_at__
(
unsigned
i
)
const
{
if
(
unlikely
(
i
>=
length
))
return
CrapOrNull
(
Type
);
...
...
src/hb-iter.hh
浏览文件 @
5ec11ce1
...
...
@@ -60,9 +60,10 @@ struct hb_iter_t
iter_t
iter
()
const
{
return
*
thiz
();
}
explicit_operator
bool
()
const
{
return
thiz
()
->
__more__
();
}
unsigned
len
()
const
{
return
thiz
()
->
__len__
();
}
item_t
*
operator
->
()
const
{
return
hb_addressof
(
*
thiz
());
}
item_t
&
operator
*
()
const
{
return
thiz
()
->
__item__
();
}
item_t
&
operator
[]
(
unsigned
i
)
const
{
return
thiz
()
->
__item_at__
(
i
);
}
/* TODO enable_if item_t is reference type only. */
typename
hb_remove_reference
(
item_t
)
*
operator
->
()
const
{
return
hb_addressof
(
*
thiz
());
}
item_t
operator
*
()
const
{
return
thiz
()
->
__item__
();
}
item_t
operator
[]
(
unsigned
i
)
const
{
return
thiz
()
->
__item_at__
(
i
);
}
iter_t
&
operator
+=
(
unsigned
count
)
{
thiz
()
->
__forward__
(
count
);
return
*
thiz
();
}
iter_t
&
operator
++
()
{
thiz
()
->
__next__
();
return
*
thiz
();
}
iter_t
&
operator
-=
(
unsigned
count
)
{
thiz
()
->
__rewind__
(
count
);
return
*
thiz
();
}
...
...
@@ -120,8 +121,8 @@ struct hb_iter_mixin_t
public:
/* Access: Implement __item__(), or __item_at__() if random-access. */
item_t
&
__item__
()
const
{
return
(
*
thiz
())[
0
];
}
item_t
&
__item_at__
(
unsigned
i
)
const
{
return
*
(
*
thiz
()
+
i
);
}
item_t
__item__
()
const
{
return
(
*
thiz
())[
0
];
}
item_t
__item_at__
(
unsigned
i
)
const
{
return
*
(
*
thiz
()
+
i
);
}
/* Termination: Implement __more__(), or __len__() if random-access. */
bool
__more__
()
const
{
return
thiz
()
->
len
();
}
...
...
src/hb-set.hh
浏览文件 @
5ec11ce1
...
...
@@ -672,14 +672,14 @@ struct hb_set_t
* Iterator implementation.
*/
struct
iter_t
:
hb_sorted_iter_t
<
iter_t
,
const
hb_codepoint_t
>
,
hb_iter_mixin_t
<
iter_t
,
const
hb_codepoint_t
>
hb_sorted_iter_t
<
iter_t
,
hb_codepoint_t
>
,
hb_iter_mixin_t
<
iter_t
,
hb_codepoint_t
>
{
iter_t
(
const
hb_set_t
&
s_
=
Null
(
hb_set_t
))
:
s
(
&
s_
),
v
(
INVALID
),
l
(
s
->
get_population
()
+
1
)
{
__next__
();
}
typedef
hb_codepoint_t
__item_type__
;
const
hb_codepoint_t
&
__item__
()
const
{
return
v
;
}
hb_codepoint_t
__item__
()
const
{
return
v
;
}
bool
__more__
()
const
{
return
v
!=
INVALID
;
}
void
__next__
()
{
s
->
next
(
&
v
);
if
(
l
)
l
--
;
}
void
__prev__
()
{
s
->
previous
(
&
v
);
}
...
...
src/test-iter.cc
浏览文件 @
5ec11ce1
...
...
@@ -33,11 +33,13 @@
template
<
typename
T
>
struct
array_iter_t
:
hb_iter_t
<
array_iter_t
<
T
>
,
T
>
,
hb_iter_mixin_t
<
array_iter_t
<
T
>
,
T
>
struct
array_iter_t
:
hb_iter_t
<
array_iter_t
<
T
>
,
T
&>
,
hb_iter_mixin_t
<
array_iter_t
<
T
>
,
T
&>
{
array_iter_t
(
hb_array_t
<
T
>
arr_
)
:
arr
(
arr_
)
{}
typedef
T
__item_type__
;
typedef
T
&
__item_type__
;
T
&
__item_at__
(
unsigned
i
)
const
{
return
arr
[
i
];
}
void
__forward__
(
unsigned
n
)
{
arr
+=
n
;
}
void
__rewind__
(
unsigned
n
)
{
arr
-=
n
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录