This is AppDefaults.h in view mode; [Download] [Up]
// Copyright 1991, 1994 Scott Hess. Permission to use, copy, // modify, and distribute this software and its documentation for // any purpose and without fee is hereby granted, provided that // this copyright notice appear in all copies. // // Scott Hess makes no representations about the suitability of // this software for any purpose. It is provided "as is" without // express or implied warranty. // // // This file adds a category to Application which provides for // access to the defaults database for use in simple programs. // The -default*: routines return the named default in the specified // format. Thus, [NXApp defaultAsInt:"Integer"] returns the value // of the "Integer" default converted to an int. The -default*:default: // routines allow the programmer to provide a value to be used if // the named default does not exist in the database. Thus, // [NXApp defaultAsInt:"Integer" default:10] will return the value // of the "Integer" default if it exists, otherwise it will return // 10. // // The -default:as*: routines set the named default to the given // value, converting the value to a string. Thus, // [NXApp default:"Integer" asInt:10] will store "10" as the value // of the "Integer" default. // // The -cmpDefault:*with: routines compare the current value for // a default with a given string. If they are equal, YES is // returned, otherwise NO is returned. Comparison using NXOrderStrings() // with NULL for the ordering table. // // In all cases the owner of the default is [NXApp appName]. // #import <appkit/appkit.h> @interface Application (AppDefaults) // Reference to allow linking from a library. Classes have a // linkable "tag" that can be used to refer to them in your // code, and if you refer to the class, it'll get linked from // the library. Categories have no such tag (that I can // determine), so instead I use this reference somewhere in my // code (if this category is in a library). extern int appDefaultsReference; // Get a default by name and convert it to a specified type. -(const char *)default:(const char *)defName; -(int)defaultAsInt:(const char *)defName; -(BOOL)defaultAsBOOL:(const char *)defName; -(float)defaultAsFloat:(const char *)defName; -(NXColor)defaultAsColor:(const char *)defName; // Get a default by name and convert it to a specified type. // If the default cannot be found, use the given defValue. -(const char *)default:(const char *)defName default:(const char *)defValue; -(int)defaultAsInt:(const char *)defName default:(int)defValue; -(BOOL)defaultAsBOOL:(const char *)defName default:(BOOL)defValue; -(float)defaultAsFloat:(const char *)defName default:(float)defValue; -(NXColor) defaultAsColor:(const char *)defName default:(NXColor)defValue; // Set the value of a default by name converting from a specified // type. - default:(const char *)defName as:(const char *)defValue; - default:(const char *)defName asInt:(int)defValue; - default:(const char *)defName asBOOL:(BOOL)defValue; - default:(const char *)defName asFloat:(float)defValue; - default:(const char *)defName asColor:(NXColor)defValue; // Compare the current value of a default with a string. -(BOOL)cmpDefault:(const char *)defName with:(const char *)cmp; -(BOOL)cmpDefault:(const char *)defName caseWith:(const char *)cmp; @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.