Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
7788ac14
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
7788ac14
编写于
12月 26, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[iter] Remove redundant methods
上级
3dea9aff
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
27 deletion
+17
-27
src/hb-iter.hh
src/hb-iter.hh
+17
-27
未找到文件。
src/hb-iter.hh
浏览文件 @
7788ac14
...
...
@@ -57,31 +57,21 @@ struct hb_iter_t
public:
/* Operators. */
operator
iter_t
()
{
return
iter
();
}
explicit_operator
bool
()
const
{
return
more
();
}
item_t
&
operator
*
()
const
{
return
item
();
}
item_t
*
operator
->
()
const
{
return
hb_addressof
(
item
());
}
item_t
&
operator
[]
(
unsigned
i
)
const
{
return
item_at
(
i
);
}
iter_t
&
operator
+=
(
unsigned
count
)
{
forward
(
count
);
return
*
thiz
();
}
iter_t
&
operator
++
()
{
next
();
return
*
thiz
();
}
iter_t
&
operator
-=
(
unsigned
count
)
{
rewind
(
count
);
return
*
thiz
();
}
iter_t
&
operator
--
()
{
prev
();
return
*
thiz
();
}
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
);
}
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
();
}
iter_t
&
operator
--
()
{
thiz
()
->
__prev__
();
return
*
thiz
();
}
iter_t
operator
+
(
unsigned
count
)
const
{
iter_t
c
(
*
thiz
());
c
+=
count
;
return
c
;
}
friend
iter_t
operator
+
(
unsigned
count
,
const
iter_t
&
it
)
{
return
it
+
count
;
}
iter_t
operator
++
(
int
)
{
iter_t
c
(
*
thiz
());
++*
thiz
();
return
c
;
}
iter_t
operator
-
(
unsigned
count
)
const
{
iter_t
c
(
*
thiz
());
c
-=
count
;
return
c
;
}
iter_t
operator
--
(
int
)
{
iter_t
c
(
*
thiz
());
--*
thiz
();
return
c
;
}
/* Methods. */
iter_t
iter
()
const
{
return
*
thiz
();
}
item_t
&
item
()
const
{
return
thiz
()
->
__item__
();
}
item_t
&
item_at
(
unsigned
i
)
const
{
return
thiz
()
->
__item_at__
(
i
);
}
bool
more
()
const
{
return
thiz
()
->
__more__
();
}
unsigned
len
()
const
{
return
thiz
()
->
__len__
();
}
void
next
()
{
thiz
()
->
__next__
();
}
void
forward
(
unsigned
n
)
{
thiz
()
->
__forward__
(
n
);
}
void
prev
()
{
thiz
()
->
__prev__
();
}
void
rewind
(
unsigned
n
)
{
thiz
()
->
__rewind__
(
n
);
}
constexpr
bool
is_random_access
()
const
{
return
thiz
()
->
__random_access__
();
}
protected:
...
...
@@ -112,23 +102,23 @@ struct hb_iter_mixin_t
public:
/* Access: Implement __item__(), or __item_at__() if random-access. */
item_t
&
__item__
()
const
{
return
thiz
()
->
item_at
(
0
)
;
}
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__
();
}
bool
__more__
()
const
{
return
thiz
()
->
len
();
}
unsigned
__len__
()
const
{
iter_t
c
(
*
thiz
());
unsigned
l
=
0
;
while
(
c
)
{
c
++
;
l
++
;
};
return
l
;
}
/* Advancing: Implement __next__(), or __forward__() if random-access. */
void
__next__
()
{
thiz
()
->
forward
(
1
)
;
}
void
__forward__
(
unsigned
n
)
{
while
(
n
--
)
thiz
()
->
next
();
}
void
__next__
()
{
*
thiz
()
+=
1
;
}
void
__forward__
(
unsigned
n
)
{
while
(
n
--
)
++*
thiz
();
}
/* Rewinding: Implement __prev__() or __rewind__() if bidirectional. */
void
__prev__
()
{
thiz
()
->
rewind
(
1
)
;
}
void
__rewind__
(
unsigned
n
)
{
while
(
n
--
)
thiz
()
->
prev
();
}
void
__prev__
()
{
*
thiz
()
-=
1
;
}
void
__rewind__
(
unsigned
n
)
{
while
(
n
--
)
--*
thiz
();
}
/* Random access:
Return true if item_at(), len(), forward() are fast
. */
/* Random access:
Implement if __item_at__(), __len__(), __forward__() are
. */
constexpr
bool
__random_access__
()
const
{
return
false
;
}
protected:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录