repos
/
qt.gui
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
filehistory
normal
|
plain
|
shade
|
zebra
QList<QByteArray> and QList<QVariant> conversion & use cxx:operator== and qt:operator== in cxx:=
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
2010-01-10 tobias
40
(smoke:eval-startup (:compile-toplevel :execute)
2009-06-11 tobias
41
(let ((method (smoke::make-smoke-method (find-class 'byte-array)
2009-08-02 tobias
42
"data")))
2009-06-11 tobias
43
(defmethod cxx:data ((array byte-array))
2009-07-01 tobias
44
(values ;; Discarge 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-06-11 tobias
50
(cxx:data (make-instance '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
2009-05-27 tobias
59
(with-foreign-string ((data length) string :null-terminated-p nil)
17:18:41 '
60
(qt-smoke-string-to-qstring data length))
2009-08-02 tobias
61
#'(lambda (pointer)
2009-06-11 tobias
62
(free-translated-object pointer (make-instance 'qt::qstring)
2009-08-02 tobias
63
nil))))
2010-01-10 tobias
64
08:52:49 '
65
(define-from-lisp-translation ("const QString&" "QString") string
'
66
coerce-qstring)
'
67