Fix double space when printing a qt:object.
Annotate for file src/qstring.lisp
2010-01-10 tobias 1 (in-package :cl-smoke.qt-impl)
08:52:49 ' 2
' 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
' 13 ;;; make sure, that you have configured slime correctly.
' 14 ;;; e.g.:
' 15 ;;; (string #\U9999) crashed slime for me. Adding
' 16 ;;; (set-language-environment "UTF-8")
' 17 ;;; (setq slime-net-coding-system 'utf-8-unix)
' 18 ;;; to .emacs helps.
' 19 ;;; Use emacs 23 for better unicode support.
' 20 (smoke:eval-startup (:compile-toplevel :execute)
' 21 (qt:text-codec.set-codec-for-cstrings
' 22 (qt:text-codec.codec-for-name (string *default-foreign-encoding*)))
' 23 (qt:text-codec.set-codec-for-locale
' 24 (qt:text-codec.codec-for-name (string *default-foreign-encoding*))))
' 25
' 26 (smoke:eval-startup (:compile-toplevel :execute)
' 27 (let ((method (smoke::make-smoke-method-from-name (find-class 'qt:byte-array)
2009-08-27 tobias 28 "data")))
08:37:36 ' 29 (defmethod cxx:data ((array qt:byte-array))
2010-01-10 tobias 30 (values ;; Discharge second return value (length of string)
08:52:49 ' 31 (foreign-string-to-lisp (smoke::pointer-call method
' 32 (smoke::pointer array))
' 33 :count (cxx:size array))))))
' 34
' 35 (defun from-qstring (qstring)
2009-08-27 tobias 36 (cxx:data (make-instance 'qt:byte-array
08:37:36 ' 37 :pointer (qt-smoke-qstring-to-byte-array qstring))))
2010-01-10 tobias 38
08:52:49 ' 39 (define-to-lisp-translation ("QString" "const QString&")
' 40 from-qstring qt-smoke-free-qstring)
' 41
' 42 (defun coerce-qstring (string)
' 43 (make-cleanup-pointer
' 44 (with-foreign-string ((data length) string :null-terminated-p nil)
' 45 (qt-smoke-string-to-qstring data length))
' 46 #'qt-smoke-free-qstring))
' 47
' 48 (define-from-lisp-translation ("const QString&" "QString") string
' 49 coerce-qstring)
' 50
2009-08-02 tobias 51 (defmethod print-object ((object qt:byte-array) stream)
11:29:13 ' 52 (if (null-pointer-p (pointer object))
' 53 (call-next-method)
' 54 (print-unreadable-object (object stream :type t :identity t)
' 55 (prin1 (cxx:data object) stream))))
' 56