gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about objc category


From: Fred Kiefer
Subject: Re: Question about objc category
Date: Wed, 01 May 2013 23:01:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

On 01.05.2013 11:53, address@hidden wrote:
I am reading the GNUstep source code and especially the parts that
concern the loading of a Xib and I am currently looking at the following
code :

Could you please explain why you think this code is in any way involved in the loading of XIB files? If it really is, we might have a problem in GNUstep gui. Thc code in the Model directory is not directly part of the GNUstep gui library in fact it was already been proposed to remove it completely from GNUstep gui. This code gets used to read and write GModel files, a very old way of transferring interface definitions between Next/Apple and GNUstep environments.

XIB loading gets handled by (hopefully) completely separate code.

//https://github.com/gnustep/gnustep-gui/blob/master/Model/IBClasses.h

@interface NSCustomObject : NSObject
{
     NSString *className;
     id realObject;
     id extension;
}
@end


//https://github.com/gnustep/gnustep-gui/blob/master/Model/IBClasses.m

@implementation NSCustomObject (NibToGModel)
- (id)awakeAfterUsingCoder:(NSCoder*)aDecoder
{
#ifdef DEBUG
   NSLog (@"%x awakeAfterUsingCoder NSCustomObject: className = %@,
realObject = %@, "
      @"extension = %@", self, className, realObject, extension);
#endif
   [objects addObject:self];
   return self;
}


What I don't understand is the line [objects addObject:self]; where does
the ivar objects comes from ?
Is it the objects variable from the GSXibKeyedUnarchiver ? In this case
does it mean when you use a category
you have access to the caller's context ?

To answer your specific question, objects in a global variable declared in Translator.h:

extern NSMutableArray* objects;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]