initial import
Annotate for file src/properties.lisp
2009-04-05 tobias 1 (in-package :qt)
17:56:16 ' 2
' 3 (defun reverse-lispify (symbol)
' 4 "Converts the name of symbol to C++ style."
' 5 (smoke::lisp-to-cxx (symbol-name symbol)))
' 6
' 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
' 13 (defun property (object name)
' 14 "Returns the property NAME of OBJECT."
' 15 (from-variant (cxx:property object (property-name name))))
' 16
' 17 (defun (setf property) (new-value object name)
' 18 (cxx:set-property object (property-name name)
' 19 (make-instance 'qt:variant
' 20 :args (list new-value)))
' 21 new-value)
' 22
' 23 (defun property-p (object name)
' 24 "Returns T when NAME is a property of OBJECT and NIL otherwise."
' 25 (valid-p (cxx:property object (property-name name))))
' 26
' 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)
' 31 collect (smoke::lispify (cxx:name (cxx:property meta-object index)))))
' 32
' 33 (defgeneric class-properties (class)
' 34 (:documentation "Returns a list of the properties of CLASS.")
' 35 (:method ((class class))
' 36 (meta-object-properties (cxx:static-meta-object class)))
' 37 (:method ((symbol symbol))
' 38 (class-properties (find-class symbol))))
' 39
' 40 (defgeneric class-direct-properties (class)
' 41 (:documentation "Returns a list of the properties of CLASS.")
' 42 (:method ((class class))
' 43 (meta-object-properties (cxx:static-meta-object class) nil))
' 44 (:method ((symbol symbol))
' 45 (class-direct-properties (find-class symbol))))
' 46
' 47 (defun properties (object)
' 48 "Returns a list of the properties of OBJECT."
' 49 (warn "FIXME: dynamicPropertyNames not implemented")
' 50 (meta-object-properties (cxx:meta-object object)))