~ubuntu-branches/ubuntu/karmic/gnustep-base/karmic

« back to all changes in this revision

Viewing changes to Source/NSClassDescription.m

  • Committer: Bazaar Package Importer
  • Author(s): Eric Heintzmann
  • Date: 2005-04-17 00:14:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050417001438-enf0y07c9tku85z1
Tags: 1.10.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/** NSClassDescription 
 
1
/** NSClassDescription
2
2
   Copyright (C) 2000 Free Software Foundation, Inc.
3
3
 
4
4
   Written by:  Richard Frith-Macdonald <rfm@gnu.org>
21
21
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
22
22
 
23
23
   <title>NSClassDescription class reference</title>
24
 
   $Date: 2002/02/12 12:33:57 $ $Revision: 1.6 $
 
24
   $Date: 2005/02/22 11:22:43 $ $Revision: 1.9 $
25
25
*/
26
26
 
27
 
#include <Foundation/NSClassDescription.h>
28
 
#include <Foundation/NSLock.h>
29
 
#include <Foundation/NSMapTable.h>
30
 
#include <Foundation/NSNotification.h>
31
 
 
32
 
 
 
27
#include "Foundation/NSClassDescription.h"
 
28
#include "Foundation/NSLock.h"
 
29
#include "Foundation/NSMapTable.h"
 
30
#include "Foundation/NSNotification.h"
 
31
 
 
32
 
 
33
/**
 
34
 *  Each instance of this class provides descriptive information for an
 
35
 *  Objective C class.  This is used for key-value coding, a framework
 
36
 *  used in Cocoa for scripting with Objective-C objects.  Scripting is
 
37
 *  available in GNUstep using Guile, however that implementation does
 
38
 *  not make use of class descriptions.  Therefore the primary purpose
 
39
 *  of this class is to smooth the process of porting between GNUstep
 
40
 *  and other OpenStep-derived systems.
 
41
 */
33
42
@implementation NSClassDescription
34
43
 
35
44
static NSRecursiveLock  *mapLock = nil;
36
45
static NSMapTable       *classMap;
37
46
 
38
47
/**
39
 
 * Returns the class descriptuion for aClass.  If there is no such description
40
 
 * available, sends an NSClassDescriptionNeededForClassNotification (with
41
 
 * aClass as its object) so that objects providing class descriptions can
42
 
 * register one, and tries again to find one.<br />
43
 
 * Returns nil if there is no description found.<br />
44
 
 * Handles locking to ensure thread safety and ensures that the returned
45
 
 * object will not be destroyed by other threads.
 
48
 * Returns the class description for aClass.  If there is no such description
 
49
 * available, sends an
 
50
 * <code>NSClassDescriptionNeededForClassNotification</code> (with aClass as
 
51
 * its object) so that objects providing class descriptions can register one,
 
52
 * and tries again to find one.<br /> Returns nil if there is no description
 
53
 * found.<br /> Handles locking to ensure thread safety and ensures that the
 
54
 * returned object will not be destroyed by other threads.
46
55
 */
47
56
+ (NSClassDescription*) classDescriptionForClass: (Class)aClass
48
57
{
66
75
    }
67
76
  RETAIN(description);
68
77
  [mapLock unlock];
69
 
  
 
78
 
70
79
  return AUTORELEASE(description);
71
80
}
72
81
 
167
176
  if (NSClassDescriptionClass == 0)
168
177
    {
169
178
      NSClassDescriptionClass = [NSClassDescription class];
170
 
    } 
 
179
    }
171
180
  return [NSClassDescriptionClass classDescriptionForClass: [self class]];
172
181
}
173
182