Support ownership transfer to non smoke wrapped QObjects & cleanup C++ to Lisp translation.
Annotate for file src/string-list.lisp
2010-01-10 tobias 1 (in-package :cl-smoke.qt-impl)
08:52:49 ' 2
' 3 (defcfun qt-smoke-string-list-size :int
' 4 (string-list :pointer))
' 5
' 6 (defcfun qt-smoke-string-list-at :pointer
' 7 (string-list :pointer)
' 8 (index :int))
' 9
' 10 (defcfun qt-smoke-free-string-list :void
' 11 (string-list :pointer))
' 12
' 13 (defcfun qt-smoke-make-string-list :pointer)
' 14
' 15 (defcfun qt-smoke-string-list-append :void
' 16 (string-list :pointer)
' 17 (string :pointer)
' 18 (length :int))
' 19
2009-08-02 tobias 20 (defun from-string-list (string-list)
11:15:21 ' 21 (let ((vector (make-array (qt-smoke-string-list-size string-list)
' 22 :initial-element ""
' 23 :element-type 'string)))
2010-01-10 tobias 24 (dotimes (index (length vector) vector)
08:52:49 ' 25 (setf (aref vector index)
' 26 (cxx:data (make-instance 'qt:byte-array
' 27 :pointer (qt-smoke-string-list-at
' 28 string-list index)))))))
2009-08-02 tobias 29
11:15:21 ' 30 (define-to-lisp-translation ("QStringList" "const QStringList&")
' 31 from-string-list qt-smoke-free-string-list)
2010-01-10 tobias 32
2009-08-02 tobias 33 (defun coerce-string-list (sequence)
11:15:21 ' 34 (let ((string-list (qt-smoke-make-string-list)))
' 35 (map nil
' 36 #'(lambda (string)
' 37 (with-foreign-string ((data length) string :null-terminated-p nil)
' 38 (qt-smoke-string-list-append string-list data length)))
' 39 sequence)
' 40 (make-cleanup-pointer
' 41 string-list #'qt-smoke-free-string-list)))
2010-01-10 tobias 42
08:52:49 ' 43 (define-from-lisp-translation "const QStringList&"
2009-09-02 tobias 44 (vector string) coerce-string-list)
2009-05-11 tobias 45