|
echo $fn ?>
|
|
../code/restrictable.cls/var/www/html/ooRexx/wip
/* ---------------------------------------------------------------- */
/* An .Array mixinclass to restrict membership of an inheriting */
/* class, which should be an .Array itself or a subclass of .Array */
/* */
/* Note: Check if the mixinclass could be for OrderedCollection. */
/* */
/* The inheriting class has to only implement an "isAllowed" */
/* method, that returns .true if allowed and .false if denied. */
/* */
/* ---------------------------------------------------------------- */
/* */
/* Originally by Ruurd J. Idenburg */
/* */
/* No copyright, no licence, no guarantees or warrantees, be it */
/* explicit, implicit or whatever. Usage is totally and completely */
/* at the users own risk, the author shall not be liable for any */
/* damages whatsoever, for any reason whatsoever. */
/* */
/* Please keep this comment block intact when modifying this code */
/* and add a note with date and a description. */
/* */
/* ---------------------------------------------------------------- */
/* 2014/01/26 - Initial version approximately */
/* ---------------------------------------------------------------- */
::class restrictable public mixinclass array
-- I think I covered all the "set" methods
::method "[]="
self~checkIt("[]=",arg(1,'A'))
::method append
self~checkIt(append,arg(1,'A'))
::method appendAll
self~checkIt(appendAll,arg(1,'A'))
::method fill
self~checkIt(fill,arg(1,'A'))
::method insert
self~checkIt(insert,arg(1,'A'))
::method put
self~checkIt(put,arg(1,'A'))
::method checkIt private
use arg msg -- argument 1 is the original method invoked
item = arg(2)[1] -- argument 2 is an array of original arguments
if \self~isAllowed(item) -- the potential member is the first item in the args array
then raise syntax 93.900 array(self~syntaxMsg(item))
forward class (super) message(msg) arguments (arg(2)) -- forward original method and args
::method syntaxMsg private
use arg object
msg = 'The "'self~class~id'" class does not allow a "'object~class~id'" object as a collection member'
return msg
If you feel inclined to make corrections, suggestions etc.,
please mail me any.
| |
All content © Ruurd Idenburg, 2007– echo date('Y');?>,
except where marked otherwise. All rights reserved. This page is primarily for non-commercial use only.
The Idenburg website records no personal information and sets no ‘cookies’.
This site is hosted on a VPS(Virtual Private System) rented from Transip.nl, a Dutch company, falling under Dutch (privacy) laws (I think).
This page updated on echo date("r", filemtime("./index.php"));?> by Ruurd Idenburg.
|
|