X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/a6c0166ce6bea990735fb2be293e04ef4ce7e215..ddf67d6be45e1ea2d58aef8cceeba26f73ed1a0c:/src/standard-descriptions/validate.lisp diff --git a/src/standard-descriptions/validate.lisp b/src/standard-descriptions/validate.lisp index d98a787..3f423e8 100644 --- a/src/standard-descriptions/validate.lisp +++ b/src/standard-descriptions/validate.lisp @@ -1,8 +1,7 @@ (in-package :lisp-on-lines) -(defclass #.(defining-description 'validate) () - ((invalid-object-condition-map :layered t :special t )) - (:metaclass standard-description-class)) +(define-description validate () + ((invalid-object-condition-map :layered t :special t ))) (define-layered-class standard-attribute :in-layer #.(defining-description 'validate) @@ -50,7 +49,7 @@ (setf (gethash name *validators*) fn)) (defun find-validator (name) - (gethash name *validators*)) + (gethash name *validators*)) (register-validator 'boundp (lambda (a v) @@ -63,22 +62,23 @@ :object (attribute-object a)))) t))) -(defun validp (object) +(defun validp (object) (with-described-object (object nil) (every #'identity (mapcar (lambda (attribute) - (validate-attribute-value attribute (attribute-value attribute))) - (attributes (description-of object)))))) + (validate-attribute-value attribute (attribute-value attribute))) + (attributes (description-of object)))))) (define-layered-method lol::display-attribute-editor :in-layer #.(defining-description 'validate) :after (attribute) - (let ((conditions (remove-if-not (lambda (a) - (eq a attribute)) - (gethash - (attribute-object attribute) - lol::*invalid-objects*) - :key #'car))) + (let ((conditions (remove-if-not + (lambda (a) + (eq a attribute)) + (gethash + (attribute-object attribute) + lol::*invalid-objects*) + :key #'car))) (dolist (c conditions) (<:div :style "color:red" (<:as-html