:qt and :qt-impl packages to prevent collision with :cl symbols and fix object with non smoke parent.
Annotate for file src/properties.lisp
2009-06-11 tobias 1 (in-package :cl-smoke.qt-impl)
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 qt:property (object name)
2010-01-10 tobias 14 "Returns the property NAME of OBJECT."
2009-06-11 tobias 15 (qt:from-variant (cxx:property object (property-name name))))
2010-01-10 tobias 16
2009-07-22 tobias 17
2009-06-11 tobias 18 (defun (setf qt:property) (new-value object name)
2009-07-22 tobias 19 (cxx:set-property object (property-name name)
22:21:01 ' 20 (make-instance 'qt:variant
' 21 :args (list new-value)))
2010-01-10 tobias 22 new-value)
08:52:49 ' 23
2009-06-11 tobias 24 (defun qt:remove-property (object name)
2010-01-10 tobias 25 "Removes the property NAME from OBJECT."
2009-06-11 tobias 26 (setf (qt:property object name) (qt:make-variant)))
2010-01-10 tobias 27
2009-06-11 tobias 28 (defun qt:property-p (object name)
2010-01-10 tobias 29 "Returns T when NAME is a property of OBJECT and NIL otherwise."
2009-06-11 tobias 30 (qt:variant-boundp (cxx:property object (property-name name))))
2010-01-10 tobias 31
08:52:49 ' 32 (defun meta-object-properties (meta-object &optional (all t))
' 33 "Returns a list of the properties of META-OBJECT."
' 34 (loop for index from (if all 0 (cxx:property-offset meta-object))
' 35 below (cxx:property-count meta-object)
2009-07-22 tobias 36 collect (smoke::lispify (cxx:name (cxx:property meta-object index)))))
2010-01-10 tobias 37
2009-06-11 tobias 38 (defgeneric qt:class-properties (class)
2010-01-10 tobias 39 (:documentation "Returns a list of the properties of CLASS.")
08:52:49 ' 40 (:method ((class class))
2009-07-22 tobias 41 (meta-object-properties (cxx:static-meta-object class)))
2010-01-10 tobias 42 (:method ((symbol symbol))
2009-06-11 tobias 43 (qt:class-properties (find-class symbol))))
2010-01-10 tobias 44
2009-06-11 tobias 45 (defgeneric qt:class-direct-properties (class)
2010-01-10 tobias 46 (:documentation "Returns a list of the properties of CLASS.")
08:52:49 ' 47 (:method ((class class))
' 48 (meta-object-properties (cxx:static-meta-object class) nil))
' 49 (:method ((symbol symbol))
2009-06-11 tobias 50 (qt:class-direct-properties (find-class symbol))))
2010-01-10 tobias 51
08:52:49 ' 52 (defun dynamic-properties (object)
2009-07-22 tobias 53 (map 'list (compose #'smoke::lispify #'cxx:data)
2010-01-10 tobias 54 (cxx:dynamic-property-names object)))
08:52:49 ' 55
2009-06-11 tobias 56 (defun qt:properties (object)
2010-01-10 tobias 57 "Returns a list of the properties of OBJECT."
2009-07-22 tobias 58 (nconc (dynamic-properties object)
22:21:01 ' 59 (meta-object-properties (cxx:meta-object object))))