get_dict_objectT_get_dict_objectGetDictObjectGetDictObject (Operator)

Name

get_dict_objectT_get_dict_objectGetDictObjectGetDictObject — Retrieve an object associated with the key from the dictionary.

Signature

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)

Description

get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObject retrieves an object associated with the KeyKeyKeyKeykey from the dictionary denoted by the DictHandleDictHandleDictHandleDictHandledictHandle. The object has to be previously stored to the dictionary using set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObject.

The operator returns the data in the parameter ObjectObjectObjectObjectobjectVal. 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 KeyKeyKeyKeykey is not present in the dictionary or if the data associated with the key is not an object, get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObject fails. Presence of keys and information about the data associated with the key can be verified using get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParam.

Execution Information

Parameters

ObjectObjectObjectObjectobjectVal (output_object)  object(-array) objectHObjectHObjectHobject *

Object value retrieved from the dictionary.

DictHandleDictHandleDictHandleDictHandledictHandle (input_control)  dict HDict, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Dictionary handle.

Number of elements: DictHandle == 1

KeyKeyKeyKeykey (input_control)  string HTupleHTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Key string.

Number of elements: Key == 1

Restriction: length(Key) > 0

Example (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')

Result

If the operation succeeds, get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObject returns 2 (H_MSG_TRUE). Otherwise an exception is raised. 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.

Possible Predecessors

set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObject

Alternatives

get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTuple

See also

create_dictcreate_dictCreateDictCreateDictCreateDict, set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTuple, get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTuple, set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObject, remove_dict_keyremove_dict_keyRemoveDictKeyRemoveDictKeyRemoveDictKey, get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParam

Module

Foundation