OO framework
This commit is contained in:
38
private/wv-settings.rkt
Normal file
38
private/wv-settings.rkt
Normal file
@@ -0,0 +1,38 @@
|
||||
#lang racket/base
|
||||
|
||||
(require racket/class
|
||||
simple-ini/class
|
||||
)
|
||||
|
||||
(provide wv-settings%)
|
||||
|
||||
(define wv-settings%
|
||||
(class object%
|
||||
(init-field ini
|
||||
wv-context
|
||||
)
|
||||
|
||||
(define/public (get key . default-value)
|
||||
(if (null? default-value)
|
||||
(send ini get wv-context key)
|
||||
(send ini get wv-context key (car default-value))))
|
||||
|
||||
(define/public (set! key value)
|
||||
(send ini set! wv-context key value))
|
||||
|
||||
(define/public (get/global key . default-value)
|
||||
(if (null? default-value)
|
||||
(send ini get 'global key)
|
||||
(send ini get 'global key (car default-value))))
|
||||
|
||||
(define/public (set/global! key value)
|
||||
(send ini set! 'global key value))
|
||||
|
||||
(define/public (clone context)
|
||||
(new wv-settings% [ini ini] [wv-context context]))
|
||||
|
||||
(super-new)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user