72 lines
1.7 KiB
Racket
72 lines
1.7 KiB
Racket
#lang racket/base
|
|
|
|
(require racket/class
|
|
"library-item.rkt"
|
|
"../misc/utils.rkt")
|
|
|
|
(provide library-cfg%)
|
|
|
|
(define library-cfg%
|
|
(class object%
|
|
(init-field
|
|
library-cfg-id
|
|
libraries-config)
|
|
|
|
(check/c* library-cfg%
|
|
(library-cfg-id symbol?)
|
|
(libraries-config object?))
|
|
|
|
(define/private (get-item)
|
|
(let ((item (send libraries-config
|
|
get-item
|
|
library-cfg-id)))
|
|
(unless item
|
|
(raise-arguments-error
|
|
'library-cfg%
|
|
"library configuration no longer exists"
|
|
"library-cfg-id" library-cfg-id))
|
|
item))
|
|
|
|
(define/public (get-id)
|
|
library-cfg-id)
|
|
|
|
(define/public (get-name)
|
|
(library-item-name (get-item)))
|
|
|
|
(define/public (get-kind)
|
|
(library-item-kind (get-item)))
|
|
|
|
(define/public (get-kind-version)
|
|
(library-item-kind-version (get-item)))
|
|
|
|
(define/public (get-root)
|
|
(library-item-root (get-item)))
|
|
|
|
(define/public (get-host)
|
|
(library-item-host (get-item)))
|
|
|
|
(define/public (get-item-limit)
|
|
(library-item-item-limit (get-item)))
|
|
|
|
(define/public (is-current?)
|
|
(library-item-current (get-item)))
|
|
|
|
(define/public (get-current)
|
|
(library-item-current (get-item)))
|
|
|
|
(define/public (get-revision)
|
|
(send libraries-config
|
|
get-item-revision
|
|
library-cfg-id))
|
|
|
|
(define/public (set-current! value)
|
|
(check/c library-cfg% set-current! value boolean?)
|
|
|
|
(send libraries-config
|
|
update-item!
|
|
(struct-copy library-item
|
|
(get-item)
|
|
[current value])))
|
|
|
|
(super-new)))
|