home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscClassVariable.m -- a class to implement true class variables
- // Written by Mike Ferris Copyright (c) 1994 by Mike Ferris.
- // Modified from original MOKit "MOClassVariable" class by Don Yacktman.
- // Version 1.0. All rights reserved.
- //
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
-
-
- // About the MiscClassVariable Class...
- //
- // MiscClassVariable provides for better class variables than plain old
- // static variables in the .m file. You make a MiscClassVariable by
- // declaring a static variable, but then the class handles keeping
- // separate values of the variable for the class itself and for any of
- // its subclasses. Values must be objects in the current implementation.
-
- // Note that by using static variables in .m files containing categories,
- // you can simulate extra instance variables for categories of objects too!
- // Just cast the arguments like this:
- // [MyNewInstanceVar getObjectForClass:(Class)self];
- // and it will use [self name] as the key to search for the variable.
- // You have to give your instances unique names for this to work...
- // (It might be better to have the implementation key off the id of
- // a class object/instance, but using names is less ObjC-implementation
- // dependant, which is probably a good thing.)
-
- #import <appkit/appkit.h>
-
- @interface MiscClassVariable:Object
- {
- HashTable *ht;
- BOOL doesFreeValues;
- }
-
- + initialize;
-
- - init;
- - initDoesFreeValues:(BOOL)flag;
- - free;
-
- - setObject:obj forClass:(Class)class;
- - getObjectForClass:(Class)class;
-
- @end
-