1 (in-package :cl-smoke.qt.core)
3 (defcfun cl-smoke-string-list-size :int
4 (string-list :pointer))
6 (defcfun cl-smoke-string-list-at :pointer
10 (defcfun cl-smoke-free-string-list :void
11 (string-list :pointer))
13 (defcfun cl-smoke-make-string-list :pointer)
15 (defcfun cl-smoke-string-list-append :void
16 (string-list :pointer)
20 (defun from-string-list (string-list)
21 (let ((vector (make-array (cl-smoke-string-list-size string-list)
23 :element-type 'string)))
24 (dotimes (index (length vector) vector)
25 (setf (aref vector index)
26 (cxx:data (make-instance 'qt:byte-array
27 :pointer (cl-smoke-string-list-at
28 string-list index)))))))
30 (define-to-lisp-translation ("QStringList" "const QStringList&")
31 from-string-list cl-smoke-free-string-list)
33 (defun coerce-string-list (sequence)
34 (let ((string-list (cl-smoke-make-string-list)))
37 (with-foreign-string ((data length) string :null-terminated-p nil)
38 (cl-smoke-string-list-append string-list data length)))
41 string-list #'cl-smoke-free-string-list)))
43 (defun string-list-p (sequence)
44 (every #'stringp sequence))
46 (define-from-lisp-translation "const QStringList&"
48 (satisfies string-list-p))