X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=example.lisp;h=9398cc6f171247f22d95a34f0d8eaba58315808e;hb=7ffe31bff2d7daa3df28ed34fe439f7e541ffbb5;hp=974a1e20af5717b456f39d26b6a5b8c7f3ee61a7;hpb=c3f7ae77695d2e8ab2378890c10eaf09b0021dfc;p=hyperobject.git diff --git a/example.lisp b/example.lisp index 974a1e2..9398cc6 100644 --- a/example.lisp +++ b/example.lisp @@ -2,31 +2,31 @@ ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; -;;;; Name: hyperobject-plain-example.lisp -;;;; Purpose: Hyper Object Metaclass +;;;; Name: hyperobject-example.lisp +;;;; Purpose: Hyperobject Example file ;;;; Programmer: Kevin M. Rosenberg -;;;; Date Started: Apr 2000 +;;;; Date Started: Oct 2002 ;;;; -;;;; This metaclass as functions to classes to allow display -;;;; in Text, HTML, and XML formats. This includes hyperlinking -;;;; capability and sub-objects. +;;;; A simple example file for hyperobjects ;;;; -;;;; $Id: example.lisp,v 1.1 2002/11/22 10:49:24 kevin Exp $ +;;;; $Id: example.lisp,v 1.2 2002/11/22 15:45:06 kevin Exp $ ;;;; ;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg ;;;; ;;;; ************************************************************************* -(in-package :hyperobject-user) +(in-package :hyperobject-mop-user) -(define-hyperobject person () - ((first-name :type string :reference find-person-by-last-name) - (last-name :type string) - (dob :type integer :initform 0 :format-func format-date) - (resume :type cdata) - (addresses :subobject t)) - (:title "Person") - (:documentation "Person hyperobject class")) + +(defclass person (hyperobject) + ((first-name :type string :initarg :first-name :reader first-name :initform nil) + (last-name :type string :initarg :last-name :reader last-name :initform nil + :reference find-person-by-last-name) + (dob :type integer :initarg :dob :reader dob :initform 0 :format-func format-date) + (resume :type cdata :initarg :resume :reader resume) + (addresses :initarg :addresses :reader addresses :initform nil :subobject t)) + (:metaclass hyperobject-class) + (:title "Person")) (defun format-date (ut) (when (typep ut 'integer) @@ -40,17 +40,17 @@ year hr min sec)))) -(define-hyperobject address () - ((title :type string) - (street :type string) - (phones :subobject t)) - (:title "Address") - (:documentation "Address hyperobject")) +(defclass address (hyperobject) + ((title :type string :initarg :title :reader title :initform nil) + (street :type string :initarg :street :reader street :initform nil) + (phones :initarg :phones :reader phones :initform nil :subobject t)) + (:metaclass hyperobject-class) + (:title "Address")) -(define-hyperobject phone () - ((phone-number :type string)) - (:title "Phone Number") - (:documentation "Phone hyperobject")) +(defclass phone (hyperobject) + ((phone-number :type string :initarg :phone-number :reader phone-number)) + (:metaclass hyperobject-class) + (:title "Phone Number")) (defparameter home-phone-1 (make-instance 'phone :phone-number "367-9812"))