Use argument conversion/promotion when emiting signals
Annotate for file src/qstring.lisp
2009-06-11 tobias 1 (in-package :qt)
2010-01-10 tobias 2
08:52:49 ' 3 (defcfun qt-smoke-string-to-qstring :pointer
' 4 (data :string)
' 5 (length :int))
' 6
' 7 (defcfun qt-smoke-free-qstring :void
' 8 (string :pointer))
' 9
' 10 (defcfun qt-smoke-qstring-to-byte-array :pointer
' 11 (qstring :pointer))
' 12
2009-08-02 tobias 13 (define-foreign-type qstring ()
11:15:21 ' 14 ()
' 15 (:actual-type :pointer))
' 16
' 17 (defun setup-type-map ()
' 18 (smoke::add-type "QString" 'qstring)
' 19 (smoke::add-type "const QString&" 'qstring))
' 20
' 21 (eval-when (:load-toplevel :execute)
' 22 (setup-type-map))
' 23
2009-07-01 tobias 24 ;;; make sure, that you have configured slime corretly.
2009-07-22 tobias 25 ;;; e.g.
2010-01-10 tobias 26 ;;; (string #\U9999) crashed slime for me. Adding
08:52:49 ' 27 ;;; (set-language-environment "UTF-8")
' 28 ;;; (setq slime-net-coding-system 'utf-8-unix)
' 29 ;;; to .emacs helps.
' 30 (smoke:eval-startup (:compile-toplevel :execute)
2009-06-11 tobias 31 (text-codec.set-codec-for-cstrings
14:59:48 ' 32 (text-codec.codec-for-name (string *default-foreign-encoding*)))
' 33 (text-codec.set-codec-for-locale
' 34 (text-codec.codec-for-name (string *default-foreign-encoding*))))
2010-01-10 tobias 35
2009-07-22 tobias 36
2009-08-02 tobias 37 (define-parse-method qstring ()
11:15:21 ' 38 (make-instance 'qstring))
' 39
2009-05-27 tobias 40 (defmethod translate-to-foreign (string (type qstring))
17:18:41 ' 41 (with-foreign-string ((data length) string :null-terminated-p nil)
' 42 (qt-smoke-string-to-qstring data length)))
' 43
2010-01-10 tobias 44 (smoke:eval-startup (:compile-toplevel :execute)
2009-06-11 tobias 45 (let ((method (smoke::make-smoke-method (find-class 'byte-array)
2009-08-02 tobias 46 "data")))
2009-06-11 tobias 47 (defmethod cxx:data ((array byte-array))
2009-07-01 tobias 48 (values ;; Discarge second return value (length of string)
2009-08-02 tobias 49 (foreign-string-to-lisp (smoke::pointer-call method
11:15:21 ' 50 (smoke::pointer array))
' 51 :count (cxx:size array))))))
2010-01-10 tobias 52
2009-08-02 tobias 53 (defmethod translate-from-foreign (string (type qstring))
2009-06-11 tobias 54 (cxx:data (make-instance 'byte-array
2009-08-02 tobias 55 :pointer (qt-smoke-qstring-to-byte-array string))))
2010-01-10 tobias 56
2009-08-02 tobias 57 (defmethod free-translated-object (pointer (type qstring) param)
11:15:21 ' 58 (declare (ignore param))
' 59 (qt-smoke-free-qstring pointer))
2010-01-10 tobias 60
08:52:49 ' 61 (defun coerce-qstring (string)
' 62 (make-cleanup-pointer
2009-05-27 tobias 63 (translate-to-foreign string (make-instance 'qt::qstring))
2009-08-02 tobias 64 #'(lambda (pointer)
2009-06-11 tobias 65 (free-translated-object pointer (make-instance 'qt::qstring)
2009-08-02 tobias 66 nil))))
2010-01-10 tobias 67
2009-05-26 tobias 68 (define-from-lisp-translation ("const QString&" "QString") string
2010-01-10 tobias 69 coerce-qstring)
08:52:49 ' 70