get_dict_objectT_get_dict_objectGetDictObjectGetDictObjectget_dict_object (算子)

名称

get_dict_objectT_get_dict_objectGetDictObjectGetDictObjectget_dict_object — 从字典中检索与键关联的对象。

签名

get_dict_object( : Object : DictHandle, Key : )

Herror T_get_dict_object(Hobject* Object, const Htuple DictHandle, const Htuple Key)

void GetDictObject(HObject* Object, const HTuple& DictHandle, const HTuple& Key)

HObject HDict::GetDictObject(const HTuple& Key) const

HObject HDict::GetDictObject(const HString& Key) const

HObject HDict::GetDictObject(const char* Key) const

HObject HDict::GetDictObject(const wchar_t* Key) const   ( Windows only)

static void HOperatorSet.GetDictObject(out HObject objectVal, HTuple dictHandle, HTuple key)

HObject HDict.GetDictObject(HTuple key)

HObject HDict.GetDictObject(string key)

def get_dict_object(dict_handle: HHandle, key: Union[str, int]) -> HObject

描述

get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObjectget_dict_object retrieves an object associated with the KeyKeyKeyKeykeykey from the dictionary denoted by the DictHandleDictHandleDictHandleDictHandledictHandledict_handle. The object has to be previously stored to the dictionary using set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObjectset_dict_object

The operator returns the data in the parameter ObjectObjectObjectObjectobjectValobject. The iconic object is copied by the operation. Therefore, clearing or reusing the dictionary object afterwards will not have any side-effect on the returned iconic object.

If the given KeyKeyKeyKeykeykey is not present in the dictionary or if the data associated with the key is not an object, get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObjectget_dict_object fails. Presence of keys and information about the data associated with the key can be verified using get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParamget_dict_param

执行信息

参数

ObjectObjectObjectObjectobjectValobject (输出对象)  object(-array) objectHObjectHObjectHObjectHobject *

Object value retrieved from the dictionary.

DictHandleDictHandleDictHandleDictHandledictHandledict_handle (输入控制)  dict HDict, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Dictionary handle.

元素数量: DictHandle == 1

KeyKeyKeyKeykeykey (输入控制)  string HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Key string.

元素数量: Key == 1

限制: length(Key) > 0

示例(HDevelop)

* ...
get_dict_param (Dict, 'key_exists', ['simple_string','foo','my_image'], \
                KeysPresence)
get_dict_param (Dict, 'key_data_type', ['simple_string','my_image'], \
                KeysType)
get_dict_object (Image, Dict, 'my_image')

结果

If the operation succeeds, get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObjectget_dict_object 返回 2 ( H_MSG_TRUE )。否则将抛出异常。 Possible error conditions include invalid parameters (handle or key), the required key not found in the dictionary or other than object data associated with given key.

可能的前趋

set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObjectset_dict_object

可能的后继

get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObjectget_dict_object

替代

get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple

另见

create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict, set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple, get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple, set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObjectset_dict_object, remove_dict_keyremove_dict_keyRemoveDictKeyRemoveDictKeyRemoveDictKeyremove_dict_key, get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParamget_dict_param

模块

基础