Package: glib
GBoxed glib:variant-dict
Details The g:variant-dict structure is a mutable interface to g:variant dictionaries.
It can be used for doing a sequence of dictionary lookups in an efficient way on an existing g:variant dictionary or it can be used to
construct new dictionaries with a hashtable-like interface. It can also be
used for taking existing dictionaries and modifying them in order to create new ones. The g:variant-dict structure can only be used with a(sv) dictionaries. You allocate a g:variant-dict instance with the g:variant-dict-new function. The g:variant-dict-end function is used to convert the g:variant-dict instance back into a g:variant dictionary type. This also implicitly frees all associated memory. Examples(defun add-to-count (orig) (let* ((dict (g:variant-dict-new orig)) (variant (g:variant-dict-lookup-value dict "count"))) (when variant (let ((value (1+ (g:variant-int32 variant)))) (g:variant-dict-insert-value dict "count" (g:variant-new-int32 value)) (g:variant-dict-end dict))))) | Returned bySee also |
2024-11-20