QList<QByteArray> and QList<QVariant> conversion & use cxx:operator== and qt:operator== in cxx:=
Annotate for file src/properties.lisp
2009-06-11 tobias 1 (in-package :qt)
2010-01-10 tobias 2
08:52:49 ' 3 (defun reverse-lispify (symbol)
' 4 "Converts the name of symbol to C++ style."
2009-07-22 tobias 5 (smoke::lisp-to-cxx (symbol-name symbol)))
2010-01-10 tobias 6
08:52:49 ' 7 (defun property-name (name)
' 8 "The property name is a string or a to camelCase converted symbol."
' 9 (typecase name
' 10 (string name)
' 11 (symbol (reverse-lispify name))))
' 12
2009-06-11 tobias 13 (defun property (object name)
2010-01-10 tobias 14 "Returns the property NAME of OBJECT."
2009-06-11 tobias 15 (from-variant (cxx:property object (property-name name))))
2010-01-10 tobias 16
2009-06-11 tobias 17 (defun (setf property) (new-value object name)
2009-07-22 tobias 18 (cxx:set-property object (property-name name)
22:21:01 ' 19 (make-instance 'qt:variant
' 20 :args (list new-value)))
2010-01-10 tobias 21 new-value)
08:52:49 ' 22
2009-06-11 tobias 23 (defun property-p (object name)
2010-01-10 tobias 24 "Returns T when NAME is a property of OBJECT and NIL otherwise."
2009-06-11 tobias 25 (variant-boundp (cxx:property object (property-name name))))
2010-01-10 tobias 26
08:52:49 ' 27 (defun meta-object-properties (meta-object &optional (all t))
' 28 "Returns a list of the properties of META-OBJECT."
' 29 (loop for index from (if all 0 (cxx:property-offset meta-object))
' 30 below (cxx:property-count meta-object)
2009-07-22 tobias 31 collect (smoke::lispify (cxx:name (cxx:property meta-object index)))))
2010-01-10 tobias 32
2009-06-11 tobias 33 (defgeneric class-properties (class)
2010-01-10 tobias 34 (:documentation "Returns a list of the properties of CLASS.")
08:52:49 ' 35 (:method ((class class))
2009-07-22 tobias 36 (meta-object-properties (cxx:static-meta-object class)))
2010-01-10 tobias 37 (:method ((symbol symbol))
2009-06-11 tobias 38 (class-properties (find-class symbol))))
2010-01-10 tobias 39
2009-06-11 tobias 40 (defgeneric class-direct-properties (class)
2010-01-10 tobias 41 (:documentation "Returns a list of the properties of CLASS.")
08:52:49 ' 42 (:method ((class class))
' 43 (meta-object-properties (cxx:static-meta-object class) nil))
' 44 (:method ((symbol symbol))
2009-06-11 tobias 45 (class-direct-properties (find-class symbol))))
2010-01-10 tobias 46
2009-05-27 tobias 47 (defun dynamic-properties (object)
17:18:41 ' 48 (map 'list (compose #'smoke::lispify #'cxx:data)
' 49 (cxx:dynamic-property-names object)))
' 50
2009-06-11 tobias 51 (defun properties (object)
2010-01-10 tobias 52 "Returns a list of the properties of OBJECT."
2009-05-27 tobias 53 (nconc (dynamic-properties object)
17:18:41 ' 54 (meta-object-properties (cxx:meta-object object))))