ftp.nice.ch/Attic/openStep/developer/resources/MiscKit.2.0.5.s.gnutar.gz#/MiscKit2/Frameworks/MiscFoundation/NSObject+MiscExtentions.m

This is NSObject+MiscExtentions.m in view mode; [Download] [Up]

/*************************************************************************
 * File Name: NSObject_MiscExtentions.m
 * Version  : 0.0 alpha
 * Date     : Mon 30-Jun-1997
 *************************************************************************
 *  COPYRIGHT (C) 1997 by Cambridge Technology Partners, Dublin, Ireland
 *                    ALL RIGHTS RESERVED
 *************************************************************************    
 * Notes      : 
 * Bugs       : 
 * Author(s)  : tsengel
 * Last update: $Date: 1997/06/30 12:09:27 $
 * History    : $Log: m.template,v $
 * History    : Revision 1.1.1.1  1997/06/30 12:09:27  tsengel
 * History    : Next try
 * History    :
 *************************************************************************/ 

#import "NSObject+MiscExtentions.h"

@interface NSObject(Misc_cover_for_a_stupid_compiler)
- (int)state;
@end

@implementation NSObject (MiscExtentions)

- (int)invertedState
/*"
If the receiver responds to the <B>state</B> message then this method will return the inverted state. So 0 (YES) will become 1 (NO) and vica versa. This is helpful if you connect to a NSCell or NSButton and the actual method that needs this data as an input expects the inverted flag.
 If the value does not match the YES/NO criteria or the class does not know about a <B>state</B> then we will return -1 by default.
"*/
{
    int		value;

    if( [self respondsToSelector:@selector(state)] )
    {
        value = [self state];
        if( value == 0 ) return 1;
        else if( value == 1 ) return 0;
    }
    return -1;

}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.