Split up in qt.gui & cleanup name prefix.
src/qstring.lisp
Sun Jan 10 09:52:49 CET 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Split up in qt.gui & cleanup name prefix.
--- old-qt.gui/src/qstring.lisp 2014-10-30 07:42:27.000000000 +0100
+++ new-qt.gui/src/qstring.lisp 1970-01-01 01:00:00.000000000 +0100
@@ -1,57 +0,0 @@
-(in-package :cl-smoke.qt-impl)
-
-(defcfun qt-smoke-string-to-qstring :pointer
- (data :string)
- (length :int))
-
-(defcfun qt-smoke-free-qstring :void
- (string :pointer))
-
-(defcfun qt-smoke-qstring-to-byte-array :pointer
- (qstring :pointer))
-
-;;; make sure, that you have configured slime correctly.
-;;; e.g.:
-;;; (string #\U9999) crashed slime for me. Adding
-;;; (set-language-environment "UTF-8")
-;;; (setq slime-net-coding-system 'utf-8-unix)
-;;; to .emacs helps.
-;;; Use emacs 23 for better unicode support.
-(smoke:eval-startup (:compile-toplevel :execute)
- (qt:text-codec.set-codec-for-cstrings
- (qt:text-codec.codec-for-name (string *default-foreign-encoding*)))
- (qt:text-codec.set-codec-for-locale
- (qt:text-codec.codec-for-name (string *default-foreign-encoding*))))
-
-(smoke:eval-startup (:compile-toplevel :execute)
- (let ((method (smoke::make-smoke-method-from-name (find-class 'qt:byte-array)
- "constData")))
- (defmethod cxx:const-data ((array qt:byte-array))
- (values ;; Discharge second return value (length of string)
- (foreign-string-to-lisp (smoke::pointer-call method
- (smoke::pointer array))
- :count (cxx:size array))))))
-
-(defun from-qstring (qstring)
- (cxx:const-data (make-instance 'qt:byte-array
- :pointer (qt-smoke-qstring-to-byte-array qstring))))
-
-(define-to-lisp-translation ("QString" "const QString&")
- from-qstring qt-smoke-free-qstring)
-
-(defun coerce-qstring (string)
- (make-cleanup-pointer
- (with-foreign-string ((data length) string :null-terminated-p nil)
- (qt-smoke-string-to-qstring data length))
- #'qt-smoke-free-qstring))
-
-(define-from-lisp-translation ("const QString&" "QString") string
- coerce-qstring)
-
-(defmethod print-object ((object qt:byte-array) stream)
- (if (null-pointer-p (pointer object))
- (call-next-method)
- (print-unreadable-object (object stream :type t :identity t)
- (when (smoke::const-p object)
- (princ "CONST " stream))
- (prin1 (cxx:const-data object) stream))))