xrtTypedDictInit

初始化、创建、结束或销毁一个拥有类型值的空字典。

bool xrtTypedDictInit( xtypeddict* pDict, const xrttype* pItemType );
参数说明
xtypeddict* pDict字典
const xrttype* pItemTypeItemTye 参数
返回:初始化、创建、结束或销毁一个拥有类型值的空字典。

示例已编译验证

typeddictinit obj;
xrtTypedDictInit(&obj, pDict, pItemType);

xrtTypedDictCreate

XRT_API xtypeddict* xrtTypedDictCreate(const xrttype* pItemType);

;
返回:XRT_API xtypeddict* xrtTypedDictCreate(const xrttype* pItemType);

示例已编译验证

/* XRT_API xtypeddict* xrtTypedDictCreate(const xrttype* pItemType); */
xhandle* h = xrtTypedDictCreate();

xrtTypedDictUnit

XRT_API void xrtTypedDictUnit(xtypeddict* pDict);

;
返回:XRT_API void xrtTypedDictUnit(xtypeddict* pDict);

示例已编译验证

xrtTypedDictUnit(obj);

xrtTypedDictDestroy

XRT_API void xrtTypedDictDestroy(xtypeddict* pDict);

;
返回:XRT_API void xrtTypedDictDestroy(xtypeddict* pDict);

示例已编译验证

xrtTypedDictDestroy(obj);

xrtTypedDictItemType

返回借用元素类型、当前键数和再次扩容前的容量。

const xrttype* xrtTypedDictItemType(const xtypeddict* pDict);
参数说明
const xtypeddict* pDict字典
返回:返回借用元素类型、当前键数和再次扩容前的容量。

示例已编译验证

/* 返回借用元素类型、当前键数和再次扩容前的容量。 */
result = xrtTypedDictItemType(pDict);

xrtTypedDictCount

XRT_API size_t xrtTypedDictCount(const xtypeddict* pDict);

;
返回:XRT_API size_t xrtTypedDictCount(const xtypeddict* pDict);

示例已编译验证

/* XRT_API size_t xrtTypedDictCount(const xtypeddict* pDict); */
result = xrtTypedDictCount();

xrtTypedDictCapacity

XRT_API size_t xrtTypedDictCapacity(const xtypeddict* pDict);

;
返回:XRT_API size_t xrtTypedDictCapacity(const xtypeddict* pDict);

示例已编译验证

/* XRT_API size_t xrtTypedDictCapacity(const xtypeddict* pDict); */
result = xrtTypedDictCapacity();

xrtTypedDictClear

清空、预留或裁剪字典存储。

bool xrtTypedDictClear(xtypeddict* pDict);
参数说明
xtypeddict* pDict字典
返回:清空、预留或裁剪字典存储。

示例已编译验证

/* 清空、预留或裁剪字典存储。 */
result = xrtTypedDictClear(pDict);

xrtTypedDictReserve

XRT_API bool xrtTypedDictReserve(xtypeddict* pDict, size_t iCapacity);

;
返回:XRT_API bool xrtTypedDictReserve(xtypeddict* pDict, size_t iCapacity);

示例已编译验证

/* XRT_API bool xrtTypedDictReserve(xtypeddict* pDict, size_t iCapacity); */
result = xrtTypedDictReserve();

xrtTypedDictTrim

XRT_API bool xrtTypedDictTrim(xtypeddict* pDict);

;
返回:XRT_API bool xrtTypedDictTrim(xtypeddict* pDict);

示例已编译验证

/* XRT_API bool xrtTypedDictTrim(xtypeddict* pDict); */
result = xrtTypedDictTrim();

xrtTypedDictGetOrAdd

返回已有值槽,或按元素类型默认初始化一个新值。

ptr xrtTypedDictGetOrAdd( xtypeddict* pDict, xstrview Key, bool* pNew );
参数说明
xtypeddict* pDict字典
xstrview Key键
bool* pNewNew 参数
返回:返回已有值槽,或按元素类型默认初始化一个新值。

示例已编译验证

/* 返回已有值槽,或按元素类型默认初始化一个新值。 */
result = xrtTypedDictGetOrAdd(pDict, Key, pNew);

xrtTypedDictSet

失败原子地复制插入或替换一个键值。

bool xrtTypedDictSet( xtypeddict* pDict, xstrview Key, const void* pItem );
参数说明
xtypeddict* pDict字典
xstrview Key键
const void* pItem元素
返回:失败原子地复制插入或替换一个键值。

示例已编译验证

/* 失败原子地复制插入或替换一个键值。 */
result = xrtTypedDictSet(pDict, Key, pItem);

xrtTypedDictSetTake

成功时把外部已初始化值移交给字典,并把来源恢复为类型空值。

bool xrtTypedDictSetTake( xtypeddict* pDict, xstrview Key, ptr pItem );
参数说明
xtypeddict* pDict字典
xstrview Key键
ptr pItem元素
返回:成功时把外部已初始化值移交给字典,并把来源恢复为类型空值。

示例已编译验证

/* 成功时把外部已初始化值移交给字典,并把来源恢复为类型空值。 */
result = xrtTypedDictSetTake(pDict, Key, pItem);

xrtTypedDictGet

返回指定键的可写或只读借用值槽;缺失是正常结果。

ptr xrtTypedDictGet(xtypeddict* pDict, xstrview Key);
参数说明
xtypeddict* pDict字典
xstrview Key键
返回:返回指定键的可写或只读借用值槽;缺失是正常结果。

示例已编译验证

/* 返回指定键的可写或只读借用值槽;缺失是正常结果。 */
result = xrtTypedDictGet(pDict, Key);

xrtTypedDictConstGet

XRT_API const void* xrtTypedDictConstGet( const xtypeddict* pDict, xstrview Key );

;
返回:XRT_API const void* xrtTypedDictConstGet( const xtypeddict* pDict, xstrview Key );

示例已编译验证

/* XRT_API const void* xrtTypedDictConstGet( const xtypeddict* pDict, xstrview Key ); */
result = xrtTypedDictConstGet();

xrtTypedDictHas

XRT_API bool xrtTypedDictHas(const xtypeddict* pDict, xstrview Key);

;
返回:XRT_API bool xrtTypedDictHas(const xtypeddict* pDict, xstrview Key);

示例已编译验证

/* XRT_API bool xrtTypedDictHas(const xtypeddict* pDict, xstrview Key); */
result = xrtTypedDictHas();

xrtTypedDictStoredKey

返回与查询等价的内部规范键视图,缺失时清空输出。

bool xrtTypedDictStoredKey( const xtypeddict* pDict, xstrview Key, xstrview* pStoredKey );
参数说明
const xtypeddict* pDict字典
xstrview Key键
xstrview* pStoredKeyStoredKey 参数
返回:返回与查询等价的内部规范键视图,缺失时清空输出。

示例已编译验证

/* 返回与查询等价的内部规范键视图,缺失时清空输出。 */
result = xrtTypedDictStoredKey(pDict, Key, pStoredKey);

xrtTypedDictRemove

删除指定键,或把值移动到外部已初始化输出后删除。

bool xrtTypedDictRemove(xtypeddict* pDict, xstrview Key);
参数说明
xtypeddict* pDict字典
xstrview Key键
返回:删除指定键,或把值移动到外部已初始化输出后删除。

示例已编译验证

/* 删除指定键,或把值移动到外部已初始化输出后删除。 */
result = xrtTypedDictRemove(pDict, Key);

xrtTypedDictTake

XRT_API bool xrtTypedDictTake( xtypeddict* pDict, xstrview Key, ptr pValue );

;
返回:XRT_API bool xrtTypedDictTake( xtypeddict* pDict, xstrview Key, ptr pValue );

示例已编译验证

/* XRT_API bool xrtTypedDictTake( xtypeddict* pDict, xstrview Key, ptr pValue ); */
result = xrtTypedDictTake();

xrtTypedDictAt

按插入顺序返回指定位置的借用键和值,复杂度为 O(n)。

ptr xrtTypedDictAt( xtypeddict* pDict, size_t iIndex, xstrview* pKey );
参数说明
xtypeddict* pDict字典
size_t iIndex下标
xstrview* pKey键
返回:按插入顺序返回指定位置的借用键和值,复杂度为 O(n)。

示例已编译验证

/* 按插入顺序返回指定位置的借用键和值,复杂度为 O(n)。 */
result = xrtTypedDictAt(pDict, iIndex, pKey);

xrtTypedDictConstAt

XRT_API const void* xrtTypedDictConstAt( const xtypeddict* pDict, size_t iIndex, xstrview* pKey );

;
返回:XRT_API const void* xrtTypedDictConstAt( const xtypeddict* pDict, size_t iIndex, xstrview* pKey );

示例已编译验证

/* XRT_API const void* xrtTypedDictConstAt( const xtypeddict* pDict, size_t iIndex, xstrview* pKey ); */
result = xrtTypedDictConstAt();

xrtTypedDictIterBegin

启动按插入顺序或逆序的外置迭代。

bool xrtTypedDictIterBegin( xtypeddict* pDict, xtypeddictiter* pIterator );
参数说明
xtypeddict* pDict字典
xtypeddictiter* pIterator迭代器
返回:启动按插入顺序或逆序的外置迭代。

示例已编译验证

/* 启动按插入顺序或逆序的外置迭代。 */
result = xrtTypedDictIterBegin(pDict, pIterator);

xrtTypedDictIterRBegin

XRT_API bool xrtTypedDictIterRBegin( xtypeddict* pDict, xtypeddictiter* pIterator );

;
返回:XRT_API bool xrtTypedDictIterRBegin( xtypeddict* pDict, xtypeddictiter* pIterator );

示例已编译验证

/* XRT_API bool xrtTypedDictIterRBegin( xtypeddict* pDict, xtypeddictiter* pIterator ); */
result = xrtTypedDictIterRBegin();

xrtTypedDictIterNext

XRT_API ptr xrtTypedDictIterNext( xtypeddictiter* pIterator, xstrview* pKey );

;
返回:XRT_API ptr xrtTypedDictIterNext( xtypeddictiter* pIterator, xstrview* pKey );

示例已编译验证

/* XRT_API ptr xrtTypedDictIterNext( xtypeddictiter* pIterator, xstrview* pKey ); */
result = xrtTypedDictIterNext();

xrtTypedDictIterEnd

XRT_API void xrtTypedDictIterEnd(xtypeddictiter* pIterator);

;
返回:XRT_API void xrtTypedDictIterEnd(xtypeddictiter* pIterator);

示例已编译验证

/* XRT_API void xrtTypedDictIterEnd(xtypeddictiter* pIterator); */
result = xrtTypedDictIterEnd();

xrtTypedDictMerge

事务合并同类型字典,并深复制创建独立字典。

bool xrtTypedDictMerge( xtypeddict* pTarget, const xtypeddict* pSource, bool bReplace );
参数说明
xtypeddict* pTarget目标
const xtypeddict* pSource来源
bool bReplace是否替换
返回:事务合并同类型字典,并深复制创建独立字典。

示例已编译验证

/* 事务合并同类型字典,并深复制创建独立字典。 */
result = xrtTypedDictMerge(pTarget, pSource, bReplace);

xrtTypedDictClone

XRT_API xtypeddict* xrtTypedDictClone(const xtypeddict* pDict);

;
返回:XRT_API xtypeddict* xrtTypedDictClone(const xtypeddict* pDict);

示例已编译验证

/* XRT_API xtypeddict* xrtTypedDictClone(const xtypeddict* pDict); */
result = xrtTypedDictClone();

xrtTypedDictEquals

比较两个字典的精确类型身份、键集合和值内容。

bool xrtTypedDictEquals( const xtypeddict* pLeft, const xtypeddict* pRight );
参数说明
const xtypeddict* pLeft左操作数
const xtypeddict* pRight右操作数
返回:比较两个字典的精确类型身份、键集合和值内容。

示例已编译验证

/* 比较两个字典的精确类型身份、键集合和值内容。 */
result = xrtTypedDictEquals(pLeft, pRight);

xrtTypedDictTypeValidate

验证对象字典类型描述,并返回其共享实例操作表。

bool xrtTypedDictTypeValidate(const xrttype* pType);
参数说明
const xrttype* pType类型
返回:验证对象字典类型描述,并返回其共享实例操作表。

示例已编译验证

/* 验证对象字典类型描述,并返回其共享实例操作表。 */
result = xrtTypedDictTypeValidate(pType);

xrtTypedDictInstanceOps

XRT_API const xrtinstanceops* xrtTypedDictInstanceOps(void);

;
返回:XRT_API const xrtinstanceops* xrtTypedDictInstanceOps(void);

示例已编译验证

/* XRT_API const xrtinstanceops* xrtTypedDictInstanceOps(void); */
result = xrtTypedDictInstanceOps();