]> err.no Git - sope/blob - sope-core/NGExtensions/FdExt.subproj/NSException+misc.m
renamed packages as discussed in the developer list
[sope] / sope-core / NGExtensions / FdExt.subproj / NSException+misc.m
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo 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
9   later version.
10
11   OGo 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.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #include "NSException+misc.h"
24 #include "common.h"
25
26 @implementation NSException(NGMiscellaneous)
27
28 - (id)initWithReason:(NSString *)_reason {
29   return [self initWithReason:_reason userInfo:nil];
30 }
31 - (id)initWithReason:(NSString *)_reason userInfo:(id)_userInfo {
32   return [self initWithName:NSStringFromClass([self class])
33                reason:_reason
34                userInfo:_userInfo];
35 }
36
37 - (id)initWithFormat:(NSString *)_format,... {
38   NSString *tmp = nil;
39   va_list  ap;
40   
41   va_start(ap, _format);
42   tmp = [[NSString allocWithZone:[self zone]]
43                    initWithFormat:_format arguments:ap];
44   va_end(ap);
45
46   self = [self initWithReason:tmp userInfo:nil];
47   [tmp release]; tmp = nil;
48   return self;
49 }
50
51 - (id)copyWithZone:(NSZone *)_zone {
52   // TODO: should make a real copy?
53   return [self retain];
54 }
55
56 @end /* NSException(NGMiscellaneous) */
57
58 #if COCOA_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
59
60 @implementation NSException (NGLibFoundationCompatibility)
61 - (void)setReason:(NSString *)_reason {
62   [_reason retain];
63   [self->reason release];
64   self->reason = _reason;
65 }
66 @end
67
68 #elif GNUSTEP_BASE_LIBRARY
69
70 @implementation NSException (NGLibFoundationCompatibility)
71 - (void)setReason:(NSString *)_reason {
72   [_reason retain];
73   [self->_e_reason release];
74   self->_e_reason = _reason;
75 }
76 @end
77
78 #endif
79
80 void __link_NGExtensions_NSExceptionMisc() {
81   __link_NGExtensions_NSExceptionMisc();
82 }