Use macro to create classes

This commit is contained in:
Marcus Kammer 2024-10-04 16:35:05 +02:00
parent 62e7885f1d
commit f9736946f7
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -140,7 +140,20 @@
,@(loop for name in property-names
collect `(define-property-method ,class-name ,name))))
(defclass object (property-container) ())
(defmacro define-extend-class (base-class name)
`(defclass ,name (,base-class) ()))
(defmacro define-extend-classes (base-class &rest class-names)
`(progn
,@ (loop for name in class-names
collect `(define-extend-class ,base-class ,name))))
;;; Core Types
(define-extend-classes property-container
object
link)
(define-property-methods object
attachment
attributed-to
@ -171,7 +184,6 @@
media-type
duration)
(defclass link (property-container) ())
(define-property-methods link
id
href
@ -183,7 +195,10 @@
width
preview)
(defclass activity (object) ())
(define-extend-classes object
activity
collection)
(define-property-methods activity
actor
object
@ -192,7 +207,6 @@
origin
instrument)
(defclass collection (object) ())
(define-property-methods collection
total-items
current
@ -200,11 +214,13 @@
last-as2
items)
(defclass ordered-collection (collection) ())
(define-extend-classes collection
ordered-collection
collection-page)
(define-property-methods ordered-collection
ordered-items)
(defclass collection-page (collection) ())
(define-property-methods collection-page
part-of
next