Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
a3fcb9a3
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看板
提交
a3fcb9a3
编写于
4月 16, 2019
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[meta] Add HB_AUTO_RETURN_EXPR, HB_VOID_RETURN_EXPR, hb_priority, hb_has(), hb_get()
The first three based on range-v3.
上级
ff68be31
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
66 addition
and
21 deletion
+66
-21
src/hb-algs.hh
src/hb-algs.hh
+46
-0
src/hb-iter.hh
src/hb-iter.hh
+4
-3
src/hb-meta.hh
src/hb-meta.hh
+15
-17
src/hb.hh
src/hb.hh
+1
-1
未找到文件。
src/hb-algs.hh
浏览文件 @
a3fcb9a3
...
...
@@ -70,6 +70,52 @@ struct
operator
()
(
const
T
&
v
)
const
{
return
bool
(
v
);
}
}
HB_FUNCOBJ
(
hb_bool
);
struct
{
private:
template
<
typename
Pred
,
typename
Val
>
auto
impl
(
Pred
&&
p
,
Val
&&
v
,
hb_priority
<
2
>
)
const
HB_AUTO_RETURN_EXPR
(
p
->
has
(
v
))
template
<
typename
Pred
,
typename
Val
>
auto
impl
(
Pred
&&
p
,
Val
&&
v
,
hb_priority
<
1
>
)
const
HB_AUTO_RETURN_EXPR
(
p
.
has
(
v
))
template
<
typename
Pred
,
typename
Val
>
auto
impl
(
Pred
&&
p
,
Val
&&
v
,
hb_priority
<
0
>
)
const
HB_AUTO_RETURN_EXPR
(
p
(
v
))
public:
template
<
typename
Pred
,
typename
Val
>
auto
operator
()
(
Pred
&&
p
,
Val
&&
v
)
const
HB_AUTO_RETURN_EXPR
(
(
bool
)
impl
(
hb_forward
<
Pred
>
(
p
),
hb_forward
<
Val
>
(
v
),
hb_prioritize
)
)
}
HB_FUNCOBJ
(
hb_has
);
struct
{
private:
template
<
typename
Proj
,
typename
Val
>
auto
impl
(
Proj
&&
f
,
Val
&&
v
,
hb_priority
<
2
>
)
const
HB_AUTO_RETURN_EXPR
(
f
->
get
(
hb_forward
<
Val
>
(
v
)))
template
<
typename
Proj
,
typename
Val
>
auto
impl
(
Proj
&&
f
,
Val
&&
v
,
hb_priority
<
1
>
)
const
HB_AUTO_RETURN_EXPR
(
f
.
get
(
hb_forward
<
Val
>
(
v
)))
template
<
typename
Proj
,
typename
Val
>
auto
impl
(
Proj
&&
f
,
Val
&&
v
,
hb_priority
<
2
>
)
const
HB_AUTO_RETURN_EXPR
(
f
(
hb_forward
<
Val
>
(
v
)))
public:
template
<
typename
Proj
,
typename
Val
>
auto
operator
()
(
Proj
&&
f
,
Val
&&
v
)
const
HB_AUTO_RETURN_EXPR
(
impl
(
hb_forward
<
Proj
>
(
f
),
hb_forward
<
Val
>
(
v
),
hb_prioritize
)
)
}
HB_FUNCOBJ
(
hb_get
);
template
<
typename
T1
,
typename
T2
>
struct
hb_pair_t
{
...
...
src/hb-iter.hh
浏览文件 @
a3fcb9a3
...
...
@@ -30,6 +30,7 @@
#define HB_ITER_HH
#include "hb.hh"
#include "hb-algs.hh"
#include "hb-meta.hh"
...
...
@@ -272,8 +273,8 @@ struct hb_map_iter_t :
typedef
decltype
(
hb_declval
(
Proj
)
(
hb_declval
(
typename
Iter
::
item_t
)))
__item_t__
;
static
constexpr
bool
is_random_access_iterator
=
Iter
::
is_random_access_iterator
;
__item_t__
__item__
()
const
{
return
f
(
*
it
);
}
__item_t__
__item_at__
(
unsigned
i
)
const
{
return
f
(
it
[
i
]);
}
__item_t__
__item__
()
const
{
return
hb_get
(
f
,
*
it
);
}
__item_t__
__item_at__
(
unsigned
i
)
const
{
return
hb_get
(
f
,
it
[
i
]);
}
bool
__more__
()
const
{
return
bool
(
it
);
}
unsigned
__len__
()
const
{
return
it
.
len
();
}
void
__next__
()
{
++
it
;
}
...
...
@@ -315,7 +316,7 @@ struct hb_filter_iter_t :
typename
Iter
::
item_t
>
{
hb_filter_iter_t
(
const
Iter
&
it_
,
Pred
p
,
Proj
f
)
:
it
(
it_
),
p
(
p
),
f
(
f
)
{
while
(
it
&&
!
p
(
f
(
*
it
)))
++
it
;
}
{
while
(
it
&&
!
hb_has
(
p
,
hb_get
(
f
,
*
it
)))
++
it
;
}
typedef
typename
Iter
::
item_t
__item_t__
;
static
constexpr
bool
is_sorted_iterator
=
Iter
::
is_sorted_iterator
;
...
...
src/hb-meta.hh
浏览文件 @
a3fcb9a3
...
...
@@ -92,10 +92,8 @@ struct hb_void_t { typedef void value; };
/* Void meta-function ala std::void_t
* https://en.cppreference.com/w/cpp/types/void_t */
template
<
typename
...
Ts
>
struct
_hb_make_void
{
typedef
void
type
;
};
template
<
typename
...
Ts
>
using
hb_void_tt
=
typename
_hb_make_void
<
Ts
...
>::
type
;
template
<
typename
...
Ts
>
struct
_hb_void_tt
{
typedef
void
type
;
};
template
<
typename
...
Ts
>
using
hb_void_tt
=
typename
_hb_void_tt
<
Ts
...
>::
type
;
/* Bool! For when we need to evaluate type-dependent expressions
* in a template argument. */
...
...
@@ -103,23 +101,14 @@ template <bool b> struct hb_bool_tt { enum { value = b }; };
typedef
hb_bool_tt
<
true
>
hb_true_t
;
typedef
hb_bool_tt
<
false
>
hb_false_t
;
template
<
bool
B
,
typename
T
=
void
>
struct
hb_enable_if
{};
template
<
typename
T
>
struct
hb_enable_if
<
true
,
T
>
{
typedef
T
type
;
};
template
<
bool
B
,
typename
T
=
void
>
struct
hb_enable_if
{};
template
<
typename
T
>
struct
hb_enable_if
<
true
,
T
>
{
typedef
T
type
;
};
#define hb_enable_if(Cond) typename hb_enable_if<(Cond)>::type* = nullptr
template
<
typename
T
,
typename
T2
>
struct
hb_is_same
:
hb_false_t
{};
template
<
typename
T
>
struct
hb_is_same
<
T
,
T
>
:
hb_true_t
{};
template
<
typename
T
,
typename
T2
>
struct
hb_is_same
:
hb_false_t
{};
template
<
typename
T
>
struct
hb_is_same
<
T
,
T
>
:
hb_true_t
{};
#define hb_is_same(T, T2) hb_is_same<T, T2>::value
/*
* Meta-functions.
*/
template
<
typename
T
>
struct
hb_is_signed
;
/* https://github.com/harfbuzz/harfbuzz/issues/1535 */
template
<
>
struct
hb_is_signed
<
int8_t
>
{
enum
{
value
=
true
};
};
...
...
@@ -151,5 +140,14 @@ template <> struct hb_is_integer<signed long long> { enum { value = true }; };
template
<
>
struct
hb_is_integer
<
unsigned
long
long
>
{
enum
{
value
=
true
};
};
#define hb_is_integer(T) hb_is_integer<T>::value
/* Function overloading SFINAE and priority. */
#define HB_AUTO_RETURN_EXPR(E) -> decltype ((E)) { return (E); }
#define HB_VOID_RETURN_EXPR(E) -> hb_void_tt<decltype ((E))> { (E); }
template
<
unsigned
Pri
>
struct
hb_priority
:
hb_priority
<
Pri
-
1
>
{};
template
<
>
struct
hb_priority
<
0
>
{};
#define hb_prioritize hb_priority<16> ()
#endif
/* HB_META_HH */
src/hb.hh
浏览文件 @
a3fcb9a3
...
...
@@ -651,7 +651,7 @@ struct BEInt<Type, 4>
#include "hb-atomic.hh" // Requires: hb-meta
#include "hb-null.hh" // Requires: hb-meta
#include "hb-algs.hh" // Requires: hb-meta hb-null
#include "hb-iter.hh" // Requires: hb-meta
#include "hb-iter.hh" // Requires: hb-
algs hb-
meta
#include "hb-debug.hh" // Requires: hb-algs hb-atomic
#include "hb-array.hh" // Requires: hb-algs hb-iter hb-null
#include "hb-vector.hh" // Requires: hb-array hb-null
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录