GFTagExpression¶
API Reference / Standard / 类索引
- 路径:
addons/gf/standard/foundation/tags/gf_tag_expression.gd - 模块:
Standard - 继承:
Resource - API:
public - 类别:资源定义 (
resource_definition) - 首次版本:
3.18.0
可嵌套标签查询表达式资源。 在 GFTagQuery 的 all/any/none 单层查询之上提供组合表达式,适合描述 “任意一组条件成立”“全部子条件成立”或“没有子条件成立”等通用标签规则。 它只组合查询结果,不维护全局标签表,也不规定标签业务语义。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 枚举 | Operator |
enum Operator |
| 属性 | operator |
var operator: Operator = Operator.QUERY |
| 属性 | query |
var query: GFTagQuery = null |
| 属性 | expressions |
var expressions: Array[GFTagExpression] = [] |
| 方法 | is_empty |
func is_empty() -> bool: |
| 方法 | matches |
func matches(source: Variant) -> bool: |
| 方法 | get_match_report |
func get_match_report(source: Variant) -> Dictionary: |
| 方法 | configure_query |
func configure_query(tag_query: GFTagQuery) -> GFTagExpression: |
| 方法 | configure_all |
func configure_all(child_expressions: Array[GFTagExpression]) -> GFTagExpression: |
| 方法 | configure_any |
func configure_any(child_expressions: Array[GFTagExpression]) -> GFTagExpression: |
| 方法 | configure_none |
func configure_none(child_expressions: Array[GFTagExpression]) -> GFTagExpression: |
| 方法 | duplicate_expression |
func duplicate_expression() -> GFTagExpression: |
| 方法 | to_dictionary |
func to_dictionary() -> Dictionary: |
| 方法 | from_dictionary |
static func from_dictionary(data: Dictionary) -> GFTagExpression: |
| 方法 | from_query |
static func from_query(tag_query: GFTagQuery) -> GFTagExpression: |
枚举¶
Operator¶
- API:
public
enum Operator { ## 使用 query 作为叶子查询。 QUERY, ## 全部子表达式都满足。 ALL, ## 任意子表达式满足。 ANY, ## 没有子表达式满足。 NONE, }
表达式运算类型。
属性¶
operator¶
- API:
public
当前表达式运算类型。
query¶
- API:
public
叶子标签查询。operator 为 QUERY 时使用;为空时视为无条件通过。
expressions¶
- API:
public
子表达式列表。operator 为 ALL、ANY 或 NONE 时使用。
结构:
expressions: Array[GFTagExpression],按数组顺序参与组合判断。
方法¶
is_empty¶
- API:
public
检查表达式是否为空。
返回:无叶子查询且无子表达式时返回 true。
matches¶
- API:
public
匹配标签源。
参数:
| 名称 | 说明 |
|---|---|
source |
标签源。 |
返回:表达式满足时返回 true。
结构:
source: Variant accepted by GFTagSourceAdapter through GFTagQuery.
get_match_report¶
- API:
public
获取匹配报告。
参数:
| 名称 | 说明 |
|---|---|
source |
标签源。 |
返回:匹配报告。
结构:
source: Variant accepted by GFTagSourceAdapter through GFTagQuery.return: Dictionary,包含 ok、operator、query_report、child_reports、matched_indices、failed_indices、reason 等字段。
configure_query¶
- API:
public
配置为叶子查询表达式。
参数:
| 名称 | 说明 |
|---|---|
tag_query |
标签查询资源。 |
返回:当前表达式。
configure_all¶
- API:
public
配置为全部子表达式都满足。
参数:
| 名称 | 说明 |
|---|---|
child_expressions |
子表达式列表。 |
返回:当前表达式。
结构:
child_expressions: Array[GFTagExpression],null 项会在匹配时按失败处理。
configure_any¶
- API:
public
配置为任意子表达式满足。
参数:
| 名称 | 说明 |
|---|---|
child_expressions |
子表达式列表。 |
返回:当前表达式。
结构:
child_expressions: Array[GFTagExpression],null 项会在匹配时按失败处理。
configure_none¶
- API:
public
配置为没有子表达式满足。
参数:
| 名称 | 说明 |
|---|---|
child_expressions |
子表达式列表。 |
返回:当前表达式。
结构:
child_expressions: Array[GFTagExpression],null 项会在匹配时按失败处理。
duplicate_expression¶
- API:
public
创建同内容拷贝。
返回:新表达式。
to_dictionary¶
- API:
public
导出为字典。
返回:表达式字典。
结构:
return: Dictionary serialized tag expression.
from_dictionary¶
- API:
public
从字典创建表达式。
参数:
| 名称 | 说明 |
|---|---|
data |
表达式字典。 |
返回:新表达式。
结构:
data: Dictionary serialized tag expression.
from_query¶
- API:
public
以查询资源创建叶子表达式。
参数:
| 名称 | 说明 |
|---|---|
tag_query |
标签查询资源。 |
返回:新表达式。