|
Revision 3680, 1.1 kB
(checked in by ksprotte, 4 months ago)
|
add &allow-other-keys to initialize-persistent-instance for now
|
| Line | |
|---|
| 1 |
(in-package :bos.m2) |
|---|
| 2 |
|
|---|
| 3 |
;; Die Implementation kurvt ein bisschen um den aktuellen Datastore |
|---|
| 4 |
;; herum, da eine Àsthetische Implementation der mehrsprachigen |
|---|
| 5 |
;; Strings MOP erforderlich machen wÃŒrde, die Umstellung des Datastore |
|---|
| 6 |
;; auf MOP jedoch noch nicht fertig ist. |
|---|
| 7 |
|
|---|
| 8 |
;; Multilinguale Strings als Slots, werden als Hashes im Objekt |
|---|
| 9 |
;; gespeichert und ÃŒber slot-string bzw. (setf slot-string) |
|---|
| 10 |
;; angesprochen. |
|---|
| 11 |
|
|---|
| 12 |
(defun make-string-hash-table () |
|---|
| 13 |
(make-hash-table :test #'equal)) |
|---|
| 14 |
|
|---|
| 15 |
(defun slot-string (object slot-name language &optional (not-found-value "")) |
|---|
| 16 |
(or (gethash language (slot-value object slot-name)) not-found-value)) |
|---|
| 17 |
|
|---|
| 18 |
(defun set-slot-string (object slot-name language new-value) |
|---|
| 19 |
(unless (in-transaction-p) |
|---|
| 20 |
(error "attempt to set string in multi-language string slot ~a of ~ |
|---|
| 21 |
object ~a outside of transaction" slot-name object)) |
|---|
| 22 |
(setf (gethash language (slot-value object slot-name)) new-value)) |
|---|
| 23 |
|
|---|
| 24 |
(defsetf slot-string set-slot-string) |
|---|
| 25 |
|
|---|
| 26 |
(deftransaction set-slot-string-values (object language &rest args) |
|---|
| 27 |
(loop for (slot-name value) on args by #'cddr |
|---|
| 28 |
do (setf (slot-string object slot-name language) value))) |
|---|
| 29 |
|
|---|