set_dict_tuple_atT_set_dict_tuple_atSetDictTupleAtSetDictTupleAtset_dict_tuple_at (Operator)

Name

set_dict_tuple_atT_set_dict_tuple_atSetDictTupleAtSetDictTupleAtset_dict_tuple_at — Zuweisung eines oder mehrerer Werte an ein oder mehrere Tupelelemente in einem Dictionary.

Signatur

set_dict_tuple_at( : : DictHandle, Key, Index, Value : )

Herror T_set_dict_tuple_at(const Htuple DictHandle, const Htuple Key, const Htuple Index, const Htuple Value)

void SetDictTupleAt(const HTuple& DictHandle, const HTuple& Key, const HTuple& Index, const HTuple& Value)

void HDict::SetDictTupleAt(const HTuple& Key, const HTuple& Index, const HTuple& Value) const

void HDict::SetDictTupleAt(const HString& Key, const HTuple& Index, const HTuple& Value) const

void HDict::SetDictTupleAt(const char* Key, const HTuple& Index, const HTuple& Value) const

void HDict::SetDictTupleAt(const wchar_t* Key, const HTuple& Index, const HTuple& Value) const   (Nur Windows)

static void HOperatorSet.SetDictTupleAt(HTuple dictHandle, HTuple key, HTuple index, HTuple value)

void HDict.SetDictTupleAt(HTuple key, HTuple index, HTuple value)

void HDict.SetDictTupleAt(string key, HTuple index, HTuple value)

def set_dict_tuple_at(dict_handle: HHandle, key: Union[str, int], index: Sequence[int], value: Sequence[HTupleElementType]) -> None

Beschreibung

set_dict_tuple_atset_dict_tuple_atSetDictTupleAtSetDictTupleAtSetDictTupleAtset_dict_tuple_at weist einem oder mehreren Tupelelementen eines in DictHandleDictHandleDictHandleDictHandledictHandledict_handle unter dem Schlüssel KeyKeyKeyKeykeykey gespeicherten Tupels einen oder mehrere neue Werte zu. Mit diesem Operator können effizient Teile eines Tupels in einem Dictionary geändert werden, ohne dass das Tuple zunächst aus dem Dictionary ausgelesen werden muss.

Falls es in dem Dictionary noch kein Tupel mit dem Schlüssel KeyKeyKeyKeykeykey gibt, oder falls unter diesem Schlüssel ein ikonisches Objekt gespeichert ist, so wird ein neues Tupel erzeugt und unter dem Schlüssel abgelegt. In letzterem Fall wird das existierende ikonische Objekt aus dem Dictionary entfernt.

Werden Indizes übergeben, die außerhalb der aktuellen Größe des im Dictionary gespeicherten Tupels liegen, wird das Tupel entsprechend vergrößert und die nicht gesetzten Werte werden mit einem Defaultwert initialisiert.

KeyKeyKeyKeykeykey ist ein String oder eine ganze Zahl (integer). Bei Strings muss die Groß-/Kleinschreibung beachtet. Als IndexIndexIndexIndexindexindex Parameter ist jeder Ausdruck erlaubt, der eine beliebige Anzahl von positiven Integerwerten ergibt. Als ValueValueValueValuevaluevalue Parameter muss entweder genau ein Wert übergeben werden, oder es müssen genauso viele Werte wie Indizes übergeben werden.

Die Tupeldaten für den übergebenen Schlüssel können mit Hilfe des Operators get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple aus dem Dictionary wieder ausgelesen werden.

Achtung

Falls ValueValueValueValuevaluevalue Handles enthält, werden nur die Handle-Werte kopiert. Von Handles, die in dem Tupel enthalten sind, wird keine tiefe Kopie erzeugt.

Ausführungsinformationen

Dieser Operator modifiziert den Zustand des folgenden Eingabeparameters:

Während der Ausführung dieses Operators muss der Zugriff auf den Wert dieses Parameters synchronisiert werden, wenn er über mehrere Threads hinweg verwendet wird.

Parameter

DictHandleDictHandleDictHandleDictHandledictHandledict_handle (input_control, Zustand wird modifiziert)  dict HDict, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle des Dictionaries.

Parameteranzahl: DictHandle == 1

KeyKeyKeyKeykeykey (input_control)  string HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Schlüssel.

Parameteranzahl: Key == 1

Restriktion: length(Key) > 0

IndexIndexIndexIndexindexindex (input_control)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Indizes der Tupelelemente, die durch die übergebenen Werte ersetzt werden sollen.

Defaultwert: 0

Wertevorschläge: 0, 1, 2, 3, 4, 5, 6

Minimale Schrittweite: 1

ValueValueValueValuevaluevalue (input_control)  tuple-array HTupleSequence[HTupleElementType]HTupleHtuple (string / integer / real / handle) (string / int / long / double / HHandle) (HString / Hlong / double / HHandle) (char* / Hlong / double / handle)

Werte, die im Tupel gesetzt werden sollen.

Beispiel (HDevelop)

Dict := dict{}
Dict.some_key := 27

set_dict_tuple_at (Dict, 'some_key', 1, 5)
* Dict.some_key is now [27, 5]

* Alternative TRIAS syntax
Dict.some_key[0] := 66
* Dict.some_key is now [66, 5]

Ergebnis

Im Erfolgsfall gibt set_dict_tuple_atset_dict_tuple_atSetDictTupleAtSetDictTupleAtSetDictTupleAtset_dict_tuple_at den Wert 2 (H_MSG_TRUE) zurück. Andernfalls wird eine Fehlerbehandlung durchgeführt. Mögliche Fehler sind ungültige Parameter oder ein Allokierungsfehler.

Vorgänger

create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict

Nachfolger

set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple, get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple

Alternativen

set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple

Siehe auch

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, get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObjectget_dict_object, get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParamget_dict_param, remove_dict_keyremove_dict_keyRemoveDictKeyRemoveDictKeyRemoveDictKeyremove_dict_key

Modul

Foundation