Skip to content

Commit

Permalink
Add QVariant marshalling.
Browse files Browse the repository at this point in the history
  • Loading branch information
stassats committed Aug 19, 2010
1 parent 8c34c7e commit 37002cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions marshal.lisp
Expand Up @@ -87,12 +87,16 @@
(let ((slot (qtype-stack-item-slot <type>)))
(case slot
(bool (lambda (val si) (setf (si bool) (if val 1 0))))
(class (let ((<from> (qobject-class obj)))
(multiple-value-bind (castfn <to>)
(resolve-cast <from> (qtype-class <type>))
(class (if (typep obj 'qobject)
(let ((<from> (qobject-class obj)))
(multiple-value-bind (castfn <to>)
(resolve-cast <from> (qtype-class <type>))
(lambda (val si)
(setf (si class)
(perform-cast val castfn <from> <to>)))))
(lambda (val si)
(setf (si class)
(perform-cast val castfn <from> <to>))))))
(qobject-pointer val)))))
(enum (etypecase obj
(integer
(lambda (val si) (setf (si enum) val)))
Expand Down Expand Up @@ -173,3 +177,9 @@

(defmarshal (argument :|const QList<int>&| :type qlist<int>)
(qlist-pointer argument))

(defmarshal (value :|QVariant|)
(typecase value
(string (#_new QVariant :|const QString&| value))
(integer (#_new QVariant :|int| value))
(t value)))
2 changes: 1 addition & 1 deletion meta.lisp
Expand Up @@ -105,7 +105,7 @@

(defun cache! (object)
(let ((ptr (qobject-pointer object)))
(assert (null (pointer->cached-object ptr)))
; (assert (null (pointer->cached-object ptr)))
(setf (pointer->cached-object ptr) object)
(when (typep object 'dynamic-object)
(setf (gethash (cffi:pointer-address ptr) *strongly-cached-objects*)
Expand Down

0 comments on commit 37002cf

Please sign in to comment.