2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "NSException+misc.h"
23 #import <Foundation/NSNull.h>
26 @implementation NSObject(NSExceptionNGMiscellaneous)
31 - (BOOL)isExceptionOrNull {
35 @end /* NSObject(NSExceptionNGMiscellaneous) */
37 @implementation NSNull(NSExceptionNGMiscellaneous)
42 - (BOOL)isExceptionOrNull {
46 @end /* NSNull(NSExceptionNGMiscellaneous) */
48 @implementation NSException(NGMiscellaneous)
53 - (BOOL)isExceptionOrNull {
57 - (id)initWithReason:(NSString *)_reason {
58 return [self initWithReason:_reason userInfo:nil];
60 - (id)initWithReason:(NSString *)_reason userInfo:(id)_userInfo {
61 return [self initWithName:NSStringFromClass([self class])
66 - (id)initWithFormat:(NSString *)_format,... {
71 NSLog(@"ERROR(%s): missing format!", __PRETTY_FUNCTION__);
73 va_start(ap, _format);
74 tmp = [[NSString alloc] initWithFormat:
75 _format ? _format : (NSString *)@"Exception"
79 self = [self initWithReason:tmp userInfo:nil];
80 [tmp release]; tmp = nil;
86 - (id)copyWithZone:(NSZone *)_zone {
87 // TODO: should make a real copy?
91 @end /* NSException(NGMiscellaneous) */
93 #if COCOA_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
95 @implementation NSException (NGLibFoundationCompatibility)
96 - (void)setReason:(NSString *)_reason {
98 [self->reason release];
99 self->reason = _reason;
103 #elif GNUSTEP_BASE_LIBRARY
105 @implementation NSException (NGLibFoundationCompatibility)
106 - (void)setReason:(NSString *)_reason {
108 [self->_e_reason release];
109 self->_e_reason = _reason;
115 void __link_NGExtensions_NSExceptionMisc() {
116 __link_NGExtensions_NSExceptionMisc();