repos
/
qt.gui
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
filehistory
normal
|
plain
|
shade
|
zebra
Break API compatibility for qt:with-app and qt:exec & spellcheck
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
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 correctly.
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)
'
31
(qt:text-codec.set-codec-for-cstrings
'
32
(qt:text-codec.codec-for-name (string *default-foreign-encoding*)))
'
33
(qt:text-codec.set-codec-for-locale
'
34
(qt:text-codec.codec-for-name (string *default-foreign-encoding*))))
'
35
2009-07-22 tobias
36
2009-08-02 tobias
37
(define-parse-method qstring ()
11:15:21 '
38
(make-instance 'qstring))
'
39
2010-01-10 tobias
40
(smoke:eval-startup (:compile-toplevel :execute)
2009-08-02 tobias
41
(let ((method (smoke::make-smoke-method-from-name (find-class 'qt:byte-array)
11:15:21 '
42
"data")))
'
43
(defmethod cxx:data ((array qt:byte-array))
2009-07-01 tobias
44
(values ;; Discharge second return value (length of string)
2009-08-02 tobias
45
(foreign-string-to-lisp (smoke::pointer-call method
11:15:21 '
46
(smoke::pointer array))
'
47
:count (cxx:size array))))))
2010-01-10 tobias
48
2009-08-02 tobias
49
(defmethod translate-from-foreign (string (type qstring))
2009-08-27 tobias
50
(cxx:data (make-instance 'qt:byte-array
2009-08-02 tobias
51
:pointer (qt-smoke-qstring-to-byte-array string))))
2010-01-10 tobias
52
2009-08-02 tobias
53
(defmethod free-translated-object (pointer (type qstring) param)
11:15:21 '
54
(declare (ignore param))
'
55
(qt-smoke-free-qstring pointer))
2010-01-10 tobias
56
08:52:49 '
57
(defun coerce-qstring (string)
'
58
(make-cleanup-pointer
'
59
(with-foreign-string ((data length) string :null-terminated-p nil)
'
60
(qt-smoke-string-to-qstring data length))
2009-08-02 tobias
61
#'(lambda (pointer)
11:15:21 '
62
(free-translated-object pointer (make-instance 'qstring)
'
63
nil))))
2010-01-10 tobias
64
08:52:49 '
65
(define-from-lisp-translation ("const QString&" "QString") string
'
66
coerce-qstring)
'
67