mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-21 04:32:03 +00:00
added GSdoc comments to class, method, and function declarations; for some classes some comments were already in the source file (not the header), in which case further comments were added here; otherwise comments were put in the headers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19588 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
febc42573a
commit
dbdfcfab37
56 changed files with 1744 additions and 516 deletions
|
@ -93,7 +93,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* Extension methods for the NSData class
|
||||
* Extension methods for the NSData class.
|
||||
*/
|
||||
@implementation NSData (GSCategories)
|
||||
|
||||
|
@ -1196,29 +1196,6 @@ newLockAt(Class self, SEL _cmd, id *location)
|
|||
|
||||
|
||||
@implementation NSLock (GSCategories)
|
||||
/**
|
||||
* Initializes the id pointed to by location
|
||||
* with a new instance of the receiver's class
|
||||
* in a thread safe manner, unless
|
||||
* it has been previously initialized.
|
||||
* Returns the contents pointed to by location.
|
||||
* The location is considered unintialized if it contains nil.
|
||||
* <br/>
|
||||
* This method is used in the GS_INITIALIZED_LOCK macro
|
||||
* to initialize lock variables when it cannot be insured
|
||||
* that they can be initialized in a thread safe environment.
|
||||
* <example>
|
||||
* NSLock *my_lock = nil;
|
||||
*
|
||||
* void function (void)
|
||||
* {
|
||||
* [GS_INITIALIZED_LOCK(my_lock, NSLock) lock];
|
||||
* do_work ();
|
||||
* [my_lock unlock];
|
||||
* }
|
||||
*
|
||||
* </example>
|
||||
*/
|
||||
+ (id) newLockAt: (id *)location
|
||||
{
|
||||
return newLockAt(self, _cmd, location);
|
||||
|
@ -1226,29 +1203,6 @@ newLockAt(Class self, SEL _cmd, id *location)
|
|||
@end
|
||||
|
||||
@implementation NSRecursiveLock (GSCategories)
|
||||
/**
|
||||
* Initializes the id pointed to by location
|
||||
* with a new instance of the receiver's class
|
||||
* in a thread safe manner, unless
|
||||
* it has been previously initialized.
|
||||
* Returns the contents pointed to by location.
|
||||
* The location is considered unintialized if it contains nil.
|
||||
* <br/>
|
||||
* This method is used in the GS_INITIALIZED_LOCK macro
|
||||
* to initialize lock variables when it cannot be insured
|
||||
* that they can be initialized in a thread safe environment.
|
||||
* <example>
|
||||
* NSLock *my_lock = nil;
|
||||
*
|
||||
* void function (void)
|
||||
* {
|
||||
* [GS_INITIALIZED_LOCK(my_lock, NSRecursiveLock) lock];
|
||||
* do_work ();
|
||||
* [my_lock unlock];
|
||||
* }
|
||||
*
|
||||
* </example>
|
||||
*/
|
||||
+ (id) newLockAt: (id *)location
|
||||
{
|
||||
return newLockAt(self, _cmd, location);
|
||||
|
|
|
@ -1134,7 +1134,7 @@ else \
|
|||
* </list>
|
||||
* <p>On return, the function result is a flag indicating success (YES)
|
||||
* or failure (NO), and on success, the value stored in size is the number
|
||||
* of characters in the converted string. The converted string itsself is
|
||||
* of characters in the converted string. The converted string itself is
|
||||
* stored in the location given by dst.<br />
|
||||
* NB. If the value stored in dst has been changed, it is a pointer to
|
||||
* allocated memory which the caller is responsible for freeing, and the
|
||||
|
|
|
@ -313,7 +313,7 @@ setup(void)
|
|||
* The GSPlaceholderString class is used by the abstract cluster root
|
||||
* class to provide temporary objects that will be replaced as soon
|
||||
* as the objects are initialised. This object tries to replace
|
||||
* itsself with an appropriate object whose type may vary depending
|
||||
* itself with an appropriate object whose type may vary depending
|
||||
* on the initialisation method used.
|
||||
*/
|
||||
@implementation GSPlaceholderString
|
||||
|
|
|
@ -1996,7 +1996,7 @@ static unsigned wordAlign;
|
|||
header = [components objectAtIndex: 0];
|
||||
/*
|
||||
* The Item header contains the item type and the length of the
|
||||
* data in the item (excluding the item header itsself).
|
||||
* data in the item (excluding the item header itself).
|
||||
*/
|
||||
hLength = [header length];
|
||||
l = hLength - sizeof(GSPortItemHeader);
|
||||
|
|
|
@ -56,6 +56,16 @@ NSString * const NSInconsistentArchiveException =
|
|||
|
||||
#define PREFIX "GNUstep archive"
|
||||
|
||||
/**
|
||||
* <p>Implementation of [NSCoder] capable of creating sequential archives which
|
||||
* must be read in the same order they were written. This class implements
|
||||
* methods for saving to and restoring from a serial archive (usually a file
|
||||
* on disk, but can be an [NSData] object) as well as methods that can be
|
||||
* used by objects that need to write/restore themselves.</p>
|
||||
*
|
||||
* <p>Note, the sibling class [NSKeyedArchiver] supports a form of archive
|
||||
* that is more robust to class changes, and is recommended over this one.</p>
|
||||
*/
|
||||
@implementation NSArchiver
|
||||
|
||||
static SEL serSel;
|
||||
|
@ -80,6 +90,10 @@ static Class NSMutableDataMallocClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an NSMutableData instance and calls
|
||||
* [initForWritingWithMutableData:].
|
||||
*/
|
||||
- (id) init
|
||||
{
|
||||
NSMutableData *d;
|
||||
|
@ -90,6 +104,10 @@ static Class NSMutableDataMallocClass;
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init instance that will archive its data to mdata. (Even if
|
||||
* [archiveRootObject:toFile:] is called, this still gets written to.)
|
||||
*/
|
||||
- (id) initForWritingWithMutableData: (NSMutableData*)mdata
|
||||
{
|
||||
self = [super init];
|
||||
|
@ -164,6 +182,10 @@ static Class NSMutableDataMallocClass;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes serialized representation of object and, recursively, any
|
||||
* other objects it holds references to, to byte array.
|
||||
*/
|
||||
+ (NSData*) archivedDataWithRootObject: (id)rootObject
|
||||
{
|
||||
NSArchiver *archiver;
|
||||
|
@ -197,6 +219,10 @@ static Class NSMutableDataMallocClass;
|
|||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes out serialized representation of object and, recursively, any
|
||||
* other objects it holds references to.
|
||||
*/
|
||||
+ (BOOL) archiveRootObject: (id)rootObject
|
||||
toFile: (NSString*)path
|
||||
{
|
||||
|
@ -804,11 +830,19 @@ static Class NSMutableDataMallocClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whatever data has been encoded thusfar.
|
||||
*/
|
||||
- (NSMutableData*) archiverData
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns substitute class used to encode objects of given class. This
|
||||
* would have been set through an earlier call to
|
||||
* [NSArchiver -encodeClassName:intoClassName:].
|
||||
*/
|
||||
- (NSString*) classNameEncodedForTrueClassName: (NSString*)trueName
|
||||
{
|
||||
if (_namMap->nodeCount)
|
||||
|
@ -827,6 +861,14 @@ static Class NSMutableDataMallocClass;
|
|||
return trueName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify substitute class used in archiving objects of given class. This
|
||||
* class is written to the archive as the class to use for restoring the
|
||||
* object, instead of what is returned from [NSObject -classForArchiver].
|
||||
* This can be used to provide backward compatibility across class name
|
||||
* changes. The object is still encoded by calling
|
||||
* <code>encodeWithCoder:</code> as normal.
|
||||
*/
|
||||
- (void) encodeClassName: (NSString*)trueName
|
||||
intoClassName: (NSString*)inArchiveName
|
||||
{
|
||||
|
@ -857,6 +899,9 @@ static Class NSMutableDataMallocClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set encoder to write out newObject in place of object.
|
||||
*/
|
||||
- (void) replaceObject: (id)object
|
||||
withObject: (id)newObject
|
||||
{
|
||||
|
@ -886,14 +931,15 @@ static Class NSMutableDataMallocClass;
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* Catagories for compatibility with old GNUstep encoding.
|
||||
/**
|
||||
* Catagory for compatibility with old GNUstep encoding.
|
||||
*/
|
||||
|
||||
@implementation NSArchiver (GNUstep)
|
||||
|
||||
/* Re-using an archiver */
|
||||
|
||||
/**
|
||||
* Allow reuse of archiver (clears class substitution maps, etc.) but
|
||||
* do not clear out current serialized data.
|
||||
*/
|
||||
- (void) resetArchiver
|
||||
{
|
||||
if (_clsMap)
|
||||
|
@ -937,11 +983,17 @@ static Class NSMutableDataMallocClass;
|
|||
pointers: 0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns YES.
|
||||
*/
|
||||
- (BOOL) directDataAccess
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes out header for GNUstep archive format.
|
||||
*/
|
||||
- (void) serializeHeaderAt: (unsigned)positionInData
|
||||
version: (unsigned)systemVersion
|
||||
classes: (unsigned)classCount
|
||||
|
|
|
@ -643,7 +643,7 @@ static SEL rlSel;
|
|||
* which must contain an array in property-list format.
|
||||
* </p>
|
||||
* <p>In GNUstep, the property-list format may be either the OpenStep
|
||||
* format (ASCII data), or the MacOS-X format (URF8 XML data) ... this
|
||||
* format (ASCII data), or the MacOS-X format (UTF-8 XML data) ... this
|
||||
* method will recognise which it is.
|
||||
* </p>
|
||||
* <p>If there is a failure to load the file for any reason, the receiver
|
||||
|
@ -937,8 +937,8 @@ compare(id elem1, id elem2, void* context)
|
|||
/**
|
||||
* Returns an autoreleased array in which the objects are ordered
|
||||
* according to a sort with comparator, where the comparator function
|
||||
* is passed two objects to compare, and the copntext as the third
|
||||
* argument.
|
||||
* is passed two objects to compare, and the context as the third
|
||||
* argument. The hint argument is currently ignored, and may be nil.
|
||||
*/
|
||||
- (NSArray*) sortedArrayUsingFunction: (NSComparisonResult(*)(id,id,void*))comparator
|
||||
context: (void*)context
|
||||
|
@ -1243,6 +1243,10 @@ compare(id elem1, id elem2, void* context)
|
|||
@end
|
||||
|
||||
|
||||
/**
|
||||
* <code>NSMutableArray</code> is the mutable version of [NSArray]. It
|
||||
* provides methods for altering the contents of the array.
|
||||
*/
|
||||
@implementation NSMutableArray
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -1412,7 +1416,7 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes all occurrances of anObject (found by pointer equality)
|
||||
* Removes all occurrences of anObject (found by pointer equality)
|
||||
* from the receiver.
|
||||
*/
|
||||
- (void) removeObjectIdenticalTo: (id)anObject
|
||||
|
@ -1447,7 +1451,7 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes all occurrances of anObject (found by the -isEqual: method
|
||||
* Removes all occurrences of anObject (found by the -isEqual: method
|
||||
* of anObject) aRange in the receiver.
|
||||
*/
|
||||
- (void) removeObject: (id)anObject inRange: (NSRange)aRange
|
||||
|
@ -1547,7 +1551,7 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes all occurrances of anObject (found by anObjects -isEqual: method)
|
||||
* Removes all occurrences of anObject (found by anObjects -isEqual: method)
|
||||
* from the receiver.
|
||||
*/
|
||||
- (void) removeObject: (id)anObject
|
||||
|
@ -1928,7 +1932,9 @@ compare(id elem1, id elem2, void* context)
|
|||
}
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* [NSArray] enhancements provided by GNUstep.
|
||||
*/
|
||||
@implementation NSArray (GNUstep)
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,7 +85,13 @@ static IMP remDictImp;
|
|||
+ (NSMutableString*) stringWithOwner: (NSMutableAttributedString*)as;
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* A string in which name-value pairs represented by an [NSDictionary] may
|
||||
* be associated to ranges of characters. Used for text rendering by the
|
||||
* GUI/AppKit framework, in which fonts, sizes, etc. are stored under standard
|
||||
* attributes in the dictionaries.
|
||||
*
|
||||
*/
|
||||
@implementation NSAttributedString
|
||||
|
||||
static Class NSAttributedStringClass;
|
||||
|
@ -232,16 +238,26 @@ static Class GSMutableAttributedStringClass;
|
|||
return [self initWithString: nil attributes: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize to aString with no attributes.
|
||||
*/
|
||||
- (id) initWithString: (NSString*)aString
|
||||
{
|
||||
return [self initWithString: aString attributes: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize to copy of attributedString.
|
||||
*/
|
||||
- (id) initWithAttributedString: (NSAttributedString*)attributedString
|
||||
{
|
||||
return [self initWithString: (NSString*)attributedString attributes: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize to aString with given attributes applying over full range of
|
||||
* string.
|
||||
*/
|
||||
- (id) initWithString: (NSString*)aString attributes: (NSDictionary*)attributes
|
||||
{
|
||||
//This is the designated initializer
|
||||
|
@ -269,11 +285,17 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
|
||||
//Retrieving character information
|
||||
/**
|
||||
* Return length of the underlying string.
|
||||
*/
|
||||
- (unsigned int) length
|
||||
{
|
||||
return [[self string] length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the underlying string, stripped of attributes.
|
||||
*/
|
||||
- (NSString*) string
|
||||
{
|
||||
[self subclassResponsibility: _cmd];/* Primitive method! */
|
||||
|
@ -281,6 +303,12 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
|
||||
//Retrieving attribute information
|
||||
/**
|
||||
* Returns attributes and values at index, and, if effectiveRange
|
||||
* is non-nil, this gets filled with a range over which these attributes
|
||||
* and values still hold. This may not be the maximum range, depending
|
||||
* on the implementation.
|
||||
*/
|
||||
- (NSDictionary*) attributesAtIndex: (unsigned int)index
|
||||
effectiveRange: (NSRange*)aRange
|
||||
{
|
||||
|
@ -288,6 +316,11 @@ static Class GSMutableAttributedStringClass;
|
|||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns attributes and values at index, and, if longestEffectiveRange
|
||||
* is non-nil, this gets filled with the range over which the attribute-value
|
||||
* set is the same as at index, clipped to rangeLimit.
|
||||
*/
|
||||
- (NSDictionary*) attributesAtIndex: (unsigned int)index
|
||||
longestEffectiveRange: (NSRange*)aRange
|
||||
inRange: (NSRange)rangeLimit
|
||||
|
@ -337,6 +370,11 @@ static Class GSMutableAttributedStringClass;
|
|||
return attrDictionary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns value for given attribute at index, and, if effectiveRange is
|
||||
* non-nil, this gets filled with a range over which this value holds. This
|
||||
* may not be the maximum range, depending on the implementation.
|
||||
*/
|
||||
- (id) attribute: (NSString*)attributeName
|
||||
atIndex: (unsigned int)index
|
||||
effectiveRange: (NSRange*)aRange
|
||||
|
@ -362,6 +400,11 @@ static Class GSMutableAttributedStringClass;
|
|||
return attrValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns value for given attribute at index, and, if longestEffectiveRange
|
||||
* is non-nil, this gets filled with the range over which the attribute
|
||||
* applies, clipped to rangeLimit.
|
||||
*/
|
||||
- (id) attribute: (NSString*)attributeName
|
||||
atIndex: (unsigned int)index
|
||||
longestEffectiveRange: (NSRange*)aRange
|
||||
|
@ -432,6 +475,10 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
|
||||
//Comparing attributed strings
|
||||
/**
|
||||
* Returns whether all characters and attributes are equal between this
|
||||
* string and otherString.
|
||||
*/
|
||||
- (BOOL) isEqualToAttributedString: (NSAttributedString*)otherString
|
||||
{
|
||||
NSRange ownEffectiveRange,otherEffectiveRange;
|
||||
|
@ -492,6 +539,9 @@ static Class GSMutableAttributedStringClass;
|
|||
|
||||
|
||||
//Extracting a substring
|
||||
/**
|
||||
* Returns substring with attribute information.
|
||||
*/
|
||||
- (NSAttributedString*) attributedSubstringFromRange: (NSRange)aRange
|
||||
{
|
||||
NSAttributedString *newAttrString;
|
||||
|
@ -537,6 +587,9 @@ static Class GSMutableAttributedStringClass;
|
|||
return newAttrString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synonym for [-attributedSubstringFromRange:].
|
||||
*/
|
||||
- (NSAttributedString*) attributedSubstringWithRange: (NSRange)aRange
|
||||
{
|
||||
return [self attributedSubstringFromRange: aRange];
|
||||
|
@ -544,6 +597,9 @@ static Class GSMutableAttributedStringClass;
|
|||
|
||||
@end //NSAttributedString
|
||||
|
||||
/**
|
||||
* Mutable version of [NSAttributedString].
|
||||
*/
|
||||
@implementation NSMutableAttributedString
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
|
@ -601,23 +657,35 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
|
||||
//Retrieving character information
|
||||
/**
|
||||
* Returns mutable version of the underlying string.
|
||||
*/
|
||||
- (NSMutableString*) mutableString
|
||||
{
|
||||
return [GSMutableAttributedStringTracker stringWithOwner: self];
|
||||
}
|
||||
|
||||
//Changing characters
|
||||
/**
|
||||
* Removes characters and attributes applying to them.
|
||||
*/
|
||||
- (void) deleteCharactersInRange: (NSRange)aRange
|
||||
{
|
||||
[self replaceCharactersInRange: aRange withString: nil];
|
||||
}
|
||||
|
||||
//Changing attributes
|
||||
/**
|
||||
* Sets attributes to apply over range, replacing any previous attributes.
|
||||
*/
|
||||
- (void) setAttributes: (NSDictionary*)attributes range: (NSRange)aRange
|
||||
{
|
||||
[self subclassResponsibility: _cmd];// Primitive method!
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds attribute applying to given range.
|
||||
*/
|
||||
- (void) addAttribute: (NSString*)name value: (id)value range: (NSRange)aRange
|
||||
{
|
||||
NSRange effectiveRange;
|
||||
|
@ -664,6 +732,9 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add attributes to apply over given range.
|
||||
*/
|
||||
- (void) addAttributes: (NSDictionary*)attributes range: (NSRange)aRange
|
||||
{
|
||||
NSRange effectiveRange;
|
||||
|
@ -721,6 +792,9 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes given attribute from aRange.
|
||||
*/
|
||||
- (void) removeAttribute: (NSString*)name range: (NSRange)aRange
|
||||
{
|
||||
NSRange effectiveRange;
|
||||
|
@ -768,12 +842,18 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
|
||||
//Changing characters and attributes
|
||||
/**
|
||||
* Appends attributed string to end of this one, preserving attributes.
|
||||
*/
|
||||
- (void) appendAttributedString: (NSAttributedString*)attributedString
|
||||
{
|
||||
[self replaceCharactersInRange: NSMakeRange([self length],0)
|
||||
withAttributedString: attributedString];
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts attributed string within this one, preserving attributes.
|
||||
*/
|
||||
- (void) insertAttributedString: (NSAttributedString*)attributedString
|
||||
atIndex: (unsigned int)index
|
||||
{
|
||||
|
@ -781,6 +861,9 @@ static Class GSMutableAttributedStringClass;
|
|||
withAttributedString: attributedString];
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces substring and attributes.
|
||||
*/
|
||||
- (void) replaceCharactersInRange: (NSRange)aRange
|
||||
withAttributedString: (NSAttributedString*)attributedString
|
||||
{
|
||||
|
@ -823,12 +906,19 @@ static Class GSMutableAttributedStringClass;
|
|||
[self endEditing];
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces substring; replacement is granted attributes equal to those of
|
||||
* the first character of the portion replaced.
|
||||
*/
|
||||
- (void) replaceCharactersInRange: (NSRange)aRange
|
||||
withString: (NSString*)aString
|
||||
{
|
||||
[self subclassResponsibility: _cmd];// Primitive method!
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces entire contents (so this object can be reused).
|
||||
*/
|
||||
- (void) setAttributedString: (NSAttributedString*)attributedString
|
||||
{
|
||||
[self replaceCharactersInRange: NSMakeRange(0,[self length])
|
||||
|
@ -836,11 +926,17 @@ static Class GSMutableAttributedStringClass;
|
|||
}
|
||||
|
||||
//Grouping changes
|
||||
/**
|
||||
* Call before executing a collection of changes, for optimization.
|
||||
*/
|
||||
- (void) beginEditing
|
||||
{
|
||||
//Overridden by subclasses
|
||||
}
|
||||
|
||||
/**
|
||||
* Call after executing a collection of changes, for optimization.
|
||||
*/
|
||||
- (void) endEditing
|
||||
{
|
||||
//Overridden by subclasses
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
return [self initWithBitmap: NULL];
|
||||
}
|
||||
|
||||
/* Designated initializer */
|
||||
/** Designated initializer */
|
||||
- (id) initWithBitmap: (NSData*)bitmap
|
||||
{
|
||||
[super init];
|
||||
|
|
|
@ -2246,7 +2246,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
@end
|
||||
|
||||
/**
|
||||
* Routines for manipulating Gregorian dates
|
||||
* Routines for manipulating Gregorian dates.
|
||||
*/
|
||||
// The following code is based upon the source code in
|
||||
// ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
|
||||
|
@ -2288,7 +2288,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
|
||||
|
||||
/**
|
||||
* Methods present in OpenStep but later removed from MacOS-X
|
||||
* Methods present in OpenStep but later removed from MacOS-X.
|
||||
*/
|
||||
@implementation NSCalendarDate (OPENSTEP)
|
||||
|
||||
|
|
|
@ -45,6 +45,10 @@ static NSCharacterSet *cache_set[MAX_STANDARD_SETS];
|
|||
static NSLock *cache_lock = nil;
|
||||
static Class abstractClass = nil;
|
||||
|
||||
/**
|
||||
* Represents a set of unicode characters. Used by [NSScanner] and [NSString]
|
||||
* for parsing-related methods.
|
||||
*/
|
||||
@implementation NSCharacterSet
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -139,11 +143,19 @@ static Class abstractClass = nil;
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a character set containing letters, numbers, and diacritical
|
||||
* marks. Note that "letters" includes all alphabetic as well as Chinese
|
||||
* characters, etc..
|
||||
*/
|
||||
+ (NSCharacterSet*) alphanumericCharacterSet
|
||||
{
|
||||
return [self _bitmapForSet: @"alphanumericCharSet" number: 0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a character set containing control and format characters.
|
||||
*/
|
||||
+ (NSCharacterSet*) controlCharacterSet
|
||||
{
|
||||
return [self _bitmapForSet: @"controlCharSet" number: 1];
|
||||
|
@ -176,6 +188,10 @@ static Class abstractClass = nil;
|
|||
return [self _bitmapForSet: @"illegalCharSet" number: 4];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a character set containing letters, including all alphabetic as
|
||||
* well as Chinese characters, etc..
|
||||
*/
|
||||
+ (NSCharacterSet*) letterCharacterSet
|
||||
{
|
||||
return [self _bitmapForSet: @"letterCharSet" number: 5];
|
||||
|
@ -191,16 +207,26 @@ static Class abstractClass = nil;
|
|||
return [self _bitmapForSet: @"lowercaseLetterCharSet" number: 6];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a character set containing characters for diacritical marks, which
|
||||
* are usually only rendered in conjunction with another character.
|
||||
*/
|
||||
+ (NSCharacterSet*) nonBaseCharacterSet
|
||||
{
|
||||
return [self _bitmapForSet: @"nonBaseCharSet" number: 7];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a character set containing punctuation marks.
|
||||
*/
|
||||
+ (NSCharacterSet*) punctuationCharacterSet
|
||||
{
|
||||
return [self _bitmapForSet: @"punctuationCharSet" number: 8];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a character set containing mathematical symbols, etc..
|
||||
*/
|
||||
+ (NSCharacterSet*) symbolAndOperatorCharacterSet
|
||||
{
|
||||
return [self _bitmapForSet: @"symbolAndOperatorCharSet" number: 9];
|
||||
|
@ -244,6 +270,10 @@ static Class abstractClass = nil;
|
|||
return AUTORELEASE([[NSBitmapCharSet alloc] initWithBitmap: data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns set with characters in aString, or empty set for empty string.
|
||||
* Raises an exception if given a nil string.
|
||||
*/
|
||||
+ (NSCharacterSet*) characterSetWithCharactersInString: (NSString*)aString
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -270,6 +300,9 @@ static Class abstractClass = nil;
|
|||
return [self characterSetWithBitmapRepresentation: bitmap];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns set containing unicode index range given by aRange.
|
||||
*/
|
||||
+ (NSCharacterSet*)characterSetWithRange: (NSRange)aRange
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -291,6 +324,12 @@ static Class abstractClass = nil;
|
|||
return [self characterSetWithBitmapRepresentation: bitmap];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes from a bitmap. (See [NSBitmapCharSet].) File must have
|
||||
* extension "<code>.bitmap</code>". (To get around this load the file
|
||||
* into data yourself and use
|
||||
* [NSCharacterSet -characterSetWithBitmapRepresentation].
|
||||
*/
|
||||
+ (NSCharacterSet*) characterSetWithContentsOfFile: (NSString*)aFile
|
||||
{
|
||||
if ([@"bitmap" isEqual: [aFile pathExtension]])
|
||||
|
@ -394,6 +433,9 @@ static Class abstractClass = nil;
|
|||
|
||||
@end
|
||||
|
||||
/**
|
||||
* An [NSCharacterSet] that can be modified.
|
||||
*/
|
||||
@implementation NSMutableCharacterSet
|
||||
|
||||
/* Provide a default object for allocation */
|
||||
|
@ -408,37 +450,61 @@ static Class abstractClass = nil;
|
|||
return AUTORELEASE([[NSMutableBitmapCharSet alloc] initWithBitmap: data]);
|
||||
}
|
||||
|
||||
/* Mutable subclasses must implement ALL of these methods. */
|
||||
/* Mutable subclasses must implement ALL of these methods. */
|
||||
|
||||
/**
|
||||
* Adds characters specified by unicode indices in aRange to set.
|
||||
*/
|
||||
- (void) addCharactersInRange: (NSRange)aRange
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds characters in aString to set.
|
||||
*/
|
||||
- (void) addCharactersInString: (NSString*)aString
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set union of character sets.
|
||||
*/
|
||||
- (void) formUnionWithCharacterSet: (NSCharacterSet*)otherSet
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set intersection of character sets.
|
||||
*/
|
||||
- (void) formIntersectionWithCharacterSet: (NSCharacterSet*)otherSet
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop given range of characters. No error for characters not currently in
|
||||
* set.
|
||||
*/
|
||||
- (void) removeCharactersInRange: (NSRange)aRange
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop characters in aString. No error for characters not currently in
|
||||
* set.
|
||||
*/
|
||||
- (void) removeCharactersInString: (NSString*)aString
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all characters currently in set and add all other characters.
|
||||
*/
|
||||
- (void) invert
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
|
|
@ -30,19 +30,28 @@
|
|||
#include "Foundation/NSNotification.h"
|
||||
|
||||
|
||||
/**
|
||||
* Each instance of this class provides descriptive information for an
|
||||
* Objective C class. This is used for key-value coding, a framework
|
||||
* used in Cocoa for scripting with Objective-C objects. Scripting is
|
||||
* available in GNUstep using Guile, however that implementation does
|
||||
* not make use of class descriptions. Therefore the primary purpose
|
||||
* of this class is to smooth the process of porting between GNUstep
|
||||
* and other OpenStep-derived systems.
|
||||
*/
|
||||
@implementation NSClassDescription
|
||||
|
||||
static NSRecursiveLock *mapLock = nil;
|
||||
static NSMapTable *classMap;
|
||||
|
||||
/**
|
||||
* Returns the class descriptuion for aClass. If there is no such description
|
||||
* available, sends an NSClassDescriptionNeededForClassNotification (with
|
||||
* aClass as its object) so that objects providing class descriptions can
|
||||
* register one, and tries again to find one.<br />
|
||||
* Returns nil if there is no description found.<br />
|
||||
* Handles locking to ensure thread safety and ensures that the returned
|
||||
* object will not be destroyed by other threads.
|
||||
* Returns the class description for aClass. If there is no such description
|
||||
* available, sends an
|
||||
* <code>NSClassDescriptionNeededForClassNotification</code> (with aClass as
|
||||
* its object) so that objects providing class descriptions can register one,
|
||||
* and tries again to find one.<br /> Returns nil if there is no description
|
||||
* found.<br /> Handles locking to ensure thread safety and ensures that the
|
||||
* returned object will not be destroyed by other threads.
|
||||
*/
|
||||
+ (NSClassDescription*) classDescriptionForClass: (Class)aClass
|
||||
{
|
||||
|
|
|
@ -290,6 +290,8 @@
|
|||
|
||||
- (unsigned int) systemVersion
|
||||
{
|
||||
//PENDING(ABR)- should probably mult major version by 1000, not 100, since,
|
||||
// e.g., 2.0.0 is going to be <1000
|
||||
return (((GNUSTEP_BASE_MAJOR_VERSION * 100)
|
||||
+ GNUSTEP_BASE_MINOR_VERSION) * 100) + GNUSTEP_BASE_SUBMINOR_VERSION;
|
||||
}
|
||||
|
|
|
@ -50,13 +50,14 @@ static BOOL uniquing = NO;
|
|||
|
||||
/**
|
||||
* <p>
|
||||
* The NSCountedSet class is used to maintain a set of objects where
|
||||
* the number of times each object has been added (wiithout a
|
||||
* The <code>NSCountedSet</code> class is used to maintain a set of objects
|
||||
* where the number of times each object has been added (without a
|
||||
* corresponding removal) is kept track of.
|
||||
* </p>
|
||||
* <p>
|
||||
* In GNUstep, extra methods are provided to make use of a counted
|
||||
* set for <em>uniquing</em> objects easier.
|
||||
* In GNUstep, the <code>purge</code> and <code>unique</code> methods
|
||||
* are provided to make use of a counted set for <em>uniquing</em> objects
|
||||
* easier.
|
||||
* </p>
|
||||
*/
|
||||
@implementation NSCountedSet
|
||||
|
@ -90,7 +91,7 @@ static Class NSCountedSet_concrete_class;
|
|||
|
||||
/**
|
||||
* Returns the number of times that an object that is equal to the
|
||||
* specified object (as determined byt the [-isEqual:] method) has
|
||||
* specified object (as determined by the [-isEqual:] method) has
|
||||
* been added to the set and not removed from it.
|
||||
*/
|
||||
- (unsigned int) countForObject: (id)anObject
|
||||
|
@ -205,17 +206,6 @@ static Class NSCountedSet_concrete_class;
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This method removes from the set all objects whose count is
|
||||
* less than or equal to the specified value.
|
||||
* </p>
|
||||
* <p>
|
||||
* This is useful where a counted set is used for uniquing objects.
|
||||
* The set can be periodically purged of objects that have only
|
||||
* been added once - and are therefore simply wasting space.
|
||||
* </p>
|
||||
*/
|
||||
- (void) purge: (int)level
|
||||
{
|
||||
if (level > 0)
|
||||
|
@ -251,22 +241,6 @@ static Class NSCountedSet_concrete_class;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* If the supplied object (or one equal to it as determined by
|
||||
* the [-isEqual:] method) is already present in the set, the
|
||||
* count for that object is incremented, the supplied object
|
||||
* is released, and the object in the set is retained and returned.
|
||||
* Otherwise, the supplied object is added to the set and returned.
|
||||
* </p>
|
||||
* <p>
|
||||
* This method is useful for uniquing objects - the init method of
|
||||
* a class need simply end with -
|
||||
* <code>
|
||||
* return [myUniquingSet unique: self];
|
||||
* </code>
|
||||
* </p>
|
||||
*/
|
||||
- (id) unique: (id)anObject
|
||||
{
|
||||
id o = [self member: anObject];
|
||||
|
@ -288,7 +262,7 @@ static Class NSCountedSet_concrete_class;
|
|||
@end
|
||||
|
||||
/**
|
||||
* This function purges the global NSCountedSet object used for
|
||||
* This function purges the global [NSCountedSet] object used for
|
||||
* uniquing. It handles locking as necessary. It can be used to
|
||||
* purge the set even when uniquing is turned off.
|
||||
*/
|
||||
|
|
163
Source/NSData.m
163
Source/NSData.m
|
@ -310,6 +310,17 @@ failure:
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Class for storing a byte array. Methods for initializing from memory a
|
||||
* file, or the network are provided, as well as the ability to write to a
|
||||
* file or the network. If desired, object can take over management of a
|
||||
* pre-allocated buffer (with malloc or similar), free'ing it when deallocated.
|
||||
* </p>
|
||||
* <p>The data buffer at any given time has a <em>capacity</em>, which is the
|
||||
* size of its allocated memory area, in bytes, and a <em>length</em>, which
|
||||
* is the length of data it is currently storing.</p>
|
||||
*/
|
||||
@implementation NSData
|
||||
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
|
@ -574,6 +585,11 @@ static unsigned gsu32Align;
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with data pointing to contents of file at path. Bytes are
|
||||
* only "swapped in" as needed. File should not be moved or deleted for
|
||||
* the life of this object.
|
||||
*/
|
||||
- (id) initWithContentsOfMappedFile: (NSString *)path
|
||||
{
|
||||
#ifdef HAVE_MMAP
|
||||
|
@ -586,6 +602,10 @@ static unsigned gsu32Align;
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with data pointing to contents of URL, which will be
|
||||
* retrieved immediately in a blocking manner.
|
||||
*/
|
||||
- (id) initWithContentsOfURL: (NSURL*)url
|
||||
{
|
||||
NSData *data = [url resourceDataUsingCache: YES];
|
||||
|
@ -593,6 +613,9 @@ static unsigned gsu32Align;
|
|||
return [self initWithData: data];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes by copying data's bytes into a new buffer.
|
||||
*/
|
||||
- (id) initWithData: (NSData*)data
|
||||
{
|
||||
if (data == nil)
|
||||
|
@ -620,6 +643,9 @@ static unsigned gsu32Align;
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of this object.
|
||||
*/
|
||||
- (NSString*) description
|
||||
{
|
||||
extern void GSPropertyListMake(id,NSDictionary*,BOOL,BOOL,unsigned,id*);
|
||||
|
@ -987,11 +1013,19 @@ failure:
|
|||
|
||||
// Deserializing Data
|
||||
|
||||
/**
|
||||
* Copies data from buffer starting from cursor. <strong>Deprecated</strong>.
|
||||
* Use [-getBytes:] and related methods instead.
|
||||
*/
|
||||
- (unsigned int) deserializeAlignedBytesLengthAtCursor: (unsigned int*)cursor
|
||||
{
|
||||
return (unsigned)[self deserializeIntAtCursor: cursor];
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies data from buffer starting from cursor. <strong>Deprecated</strong>.
|
||||
* Use [-getBytes:] and related methods instead.
|
||||
*/
|
||||
- (void) deserializeBytes: (void*)buffer
|
||||
length: (unsigned int)bytes
|
||||
atCursor: (unsigned int*)cursor
|
||||
|
@ -1289,6 +1323,10 @@ failure:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve an int from this data, which is assumed to be in network
|
||||
* (big-endian) byte order. Cursor refers to byte position.
|
||||
*/
|
||||
- (int) deserializeIntAtCursor: (unsigned int*)cursor
|
||||
{
|
||||
unsigned ni, result;
|
||||
|
@ -1298,6 +1336,10 @@ failure:
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve an int from this data, which is assumed to be in network
|
||||
* (big-endian) byte order. Index refers to byte position.
|
||||
*/
|
||||
- (int) deserializeIntAtIndex: (unsigned int)index
|
||||
{
|
||||
unsigned ni, result;
|
||||
|
@ -1307,6 +1349,11 @@ failure:
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve ints from intBuffer, which is assumed to be in network (big-endian)
|
||||
* byte order. Count refers to number of ints, but index refers to byte
|
||||
* position.
|
||||
*/
|
||||
- (void) deserializeInts: (int*)intBuffer
|
||||
count: (unsigned int)numInts
|
||||
atCursor: (unsigned int*)cursor
|
||||
|
@ -1320,6 +1367,11 @@ failure:
|
|||
intBuffer[i] = NSSwapBigIntToHost(intBuffer[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve ints from intBuffer, which is assumed to be in network (big-endian)
|
||||
* byte order. Count refers to number of ints, but index refers to byte
|
||||
* position.
|
||||
*/
|
||||
- (void) deserializeInts: (int*)intBuffer
|
||||
count: (unsigned int)numInts
|
||||
atIndex: (unsigned int)index
|
||||
|
@ -1369,7 +1421,14 @@ failure:
|
|||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Provides some shared-memory extensions to [NSData].
|
||||
*/
|
||||
@implementation NSData (GNUstepExtensions)
|
||||
|
||||
/**
|
||||
* New instance with given shared memory ID.
|
||||
*/
|
||||
+ (id) dataWithShmID: (int)anID length: (unsigned int)length
|
||||
{
|
||||
#ifdef HAVE_SHMCTL
|
||||
|
@ -1384,6 +1443,9 @@ failure:
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* New instance with given bytes in shared memory.
|
||||
*/
|
||||
+ (id) dataWithSharedBytes: (const void*)bytes length: (unsigned int)length
|
||||
{
|
||||
NSData *d;
|
||||
|
@ -1463,6 +1525,10 @@ failure:
|
|||
@end
|
||||
|
||||
|
||||
/**
|
||||
* Mutable version of [NSData]. Methods are provided for appending and
|
||||
* replacing bytes in the buffer, which will be grown as needed.
|
||||
*/
|
||||
@implementation NSMutableData
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
|
@ -1505,6 +1571,10 @@ failure:
|
|||
return AUTORELEASE(d);
|
||||
}
|
||||
|
||||
/**
|
||||
* New instance with buffer of given numBytes with length of valid data set
|
||||
* to zero. Note that capacity will be automatically increased as necessary.
|
||||
*/
|
||||
+ (id) dataWithCapacity: (unsigned int)numBytes
|
||||
{
|
||||
NSMutableData *d;
|
||||
|
@ -1552,6 +1622,12 @@ failure:
|
|||
return AUTORELEASE(d);
|
||||
}
|
||||
|
||||
/**
|
||||
* New instance with buffer of capacity and valid data size equal to given
|
||||
* length in bytes. The buffer contents are set to zero. The length of
|
||||
* valid data is set to zero. Note that buffer will be automatically
|
||||
* increased as necessary.
|
||||
*/
|
||||
+ (id) dataWithLength: (unsigned int)length
|
||||
{
|
||||
NSMutableData *d;
|
||||
|
@ -1590,6 +1666,11 @@ failure:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with buffer capable of holding size bytes. The length of valid
|
||||
* data is initially set to zero.
|
||||
* <init/>
|
||||
*/
|
||||
- (id) initWithCapacity: (unsigned int)capacity
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -1628,6 +1709,10 @@ failure:
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with buffer of capacity equal to length, and with the length
|
||||
* of valid data set to length. Data is set to zero.
|
||||
*/
|
||||
- (id) initWithLength: (unsigned int)length
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -1635,7 +1720,10 @@ failure:
|
|||
}
|
||||
|
||||
// Adjusting Capacity
|
||||
|
||||
/**
|
||||
* Increases buffer length by given number of bytes, filling the new space
|
||||
* with zeros.
|
||||
*/
|
||||
- (void) increaseLengthBy: (unsigned int)extraLength
|
||||
{
|
||||
[self setLength: [self length]+extraLength];
|
||||
|
@ -1683,6 +1771,10 @@ failure:
|
|||
|
||||
// Appending Data
|
||||
|
||||
/**
|
||||
* Appends bufferSize bytes from aBuffer to data, increasing capacity if
|
||||
* necessary.
|
||||
*/
|
||||
- (void) appendBytes: (const void*)aBuffer
|
||||
length: (unsigned int)bufferSize
|
||||
{
|
||||
|
@ -1694,6 +1786,10 @@ failure:
|
|||
memcpy(buffer + oldLength, aBuffer, bufferSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies and appends data from other to data, increasing capacity if
|
||||
* necessary.
|
||||
*/
|
||||
- (void) appendData: (NSData*)other
|
||||
{
|
||||
[self appendBytes: [other bytes] length: [other length]];
|
||||
|
@ -1784,6 +1880,9 @@ failure:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bytes in aRange to 0.
|
||||
*/
|
||||
- (void) resetBytesInRange: (NSRange)aRange
|
||||
{
|
||||
unsigned size = [self length];
|
||||
|
@ -1792,6 +1891,10 @@ failure:
|
|||
memset((char*)[self bytes] + aRange.location, 0, aRange.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces contents of buffer with contents of data's buffer, increasing
|
||||
* or shrinking capacity to match.
|
||||
*/
|
||||
- (void) setData: (NSData*)data
|
||||
{
|
||||
NSRange r = NSMakeRange(0, [data length]);
|
||||
|
@ -1802,6 +1905,10 @@ failure:
|
|||
|
||||
// Serializing Data
|
||||
|
||||
/**
|
||||
* Does not act as the name suggests. Instead, serializes length itself
|
||||
* as an int into buffer.
|
||||
*/
|
||||
- (void) serializeAlignedBytesLength: (unsigned int)length
|
||||
{
|
||||
[self serializeInt: length];
|
||||
|
@ -1976,12 +2083,21 @@ failure:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize an int into this object's data buffer, swapping it to network
|
||||
* (big-endian) byte order first.
|
||||
*/
|
||||
- (void) serializeInt: (int)value
|
||||
{
|
||||
unsigned ni = NSSwapHostIntToBig(value);
|
||||
[self appendBytes: &ni length: sizeof(unsigned)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize an int into this object's data buffer at index (replacing
|
||||
* anything there currently), swapping it to network (big-endian) byte order
|
||||
* first.
|
||||
*/
|
||||
- (void) serializeInt: (int)value atIndex: (unsigned int)index
|
||||
{
|
||||
unsigned ni = NSSwapHostIntToBig(value);
|
||||
|
@ -1990,6 +2106,10 @@ failure:
|
|||
[self replaceBytesInRange: range withBytes: &ni];
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize one or more ints into this object's data buffer, swapping them to
|
||||
* network (big-endian) byte order first.
|
||||
*/
|
||||
- (void) serializeInts: (int*)intBuffer
|
||||
count: (unsigned int)numInts
|
||||
{
|
||||
|
@ -2003,6 +2123,11 @@ failure:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize one or more ints into this object's data buffer at index
|
||||
* (replacing anything there currently), swapping them to network (big-endian)
|
||||
* byte order first.
|
||||
*/
|
||||
- (void) serializeInts: (int*)intBuffer
|
||||
count: (unsigned int)numInts
|
||||
atIndex: (unsigned int)index
|
||||
|
@ -2019,7 +2144,15 @@ failure:
|
|||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* Provides some additional methods to [NSData].
|
||||
*/
|
||||
@implementation NSMutableData (GNUstepExtensions)
|
||||
|
||||
/**
|
||||
* New instance with given shared memory ID.
|
||||
*/
|
||||
+ (id) dataWithShmID: (int)anID length: (unsigned int)length
|
||||
{
|
||||
#ifdef HAVE_SHMCTL
|
||||
|
@ -2034,6 +2167,9 @@ failure:
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* New instance with given bytes in shared memory.
|
||||
*/
|
||||
+ (id) dataWithSharedBytes: (const void*)bytes length: (unsigned int)length
|
||||
{
|
||||
NSData *d;
|
||||
|
@ -2048,18 +2184,28 @@ failure:
|
|||
return AUTORELEASE(d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current capacity of data buffer.
|
||||
*/
|
||||
- (unsigned int) capacity
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets current capacity of data buffer. Unlike [-setLength:], this will
|
||||
* shrink the buffer if requested.
|
||||
*/
|
||||
- (id) setCapacity: (unsigned int)newCapacity
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return shared memory ID, if using one, else -1.
|
||||
*/
|
||||
- (int) shmID
|
||||
{
|
||||
return -1;
|
||||
|
@ -2614,6 +2760,11 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with data pointing to contents of file at path. Bytes are
|
||||
* only "swapped in" as needed. File should not be moved or deleted for
|
||||
* the life of this object.
|
||||
*/
|
||||
- (id) initWithContentsOfMappedFile: (NSString*)path
|
||||
{
|
||||
int fd;
|
||||
|
@ -2858,8 +3009,10 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* THIS IS THE DESIGNATED INITIALISER
|
||||
// THIS IS THE DESIGNATED INITIALISER
|
||||
/**
|
||||
* Initialize with buffer capable of holding size bytes.
|
||||
* <init/>
|
||||
*/
|
||||
- (id) initWithCapacity: (unsigned int)size
|
||||
{
|
||||
|
@ -2890,6 +3043,10 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with buffer capable of holding size bytes. Buffer is zeroed
|
||||
* out.
|
||||
*/
|
||||
- (id) initWithLength: (unsigned int)size
|
||||
{
|
||||
self = [self initWithCapacity: size];
|
||||
|
|
|
@ -168,9 +168,12 @@ GSTimeNow(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* NSDate is the abstract base class of a cluster of date classes.<br />
|
||||
* An NSDate object encapsulates a constant date/time to a high
|
||||
* resolution represented by the NSTimeInterval typedef.
|
||||
* An <code>NSDate</code> object encapsulates a constant date/time to a high
|
||||
* resolution represented by the <code>NSTimeInterval</code> typedef.
|
||||
* <code>NSDate</code> has methods relating to times and time differences in
|
||||
* the abstract, but not calendar dates or time zones. These features are
|
||||
* added in the [NSCalendarDate] subclass. The [NSTimeZone] class handles time
|
||||
* zone information.
|
||||
*/
|
||||
@implementation NSDate
|
||||
|
||||
|
@ -1338,6 +1341,9 @@ GSTimeNow(void)
|
|||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether equal to other within one <code>NSTimeInterval</code> unit.
|
||||
*/
|
||||
- (BOOL) isEqualToDate: (NSDate*)other
|
||||
{
|
||||
if (other == nil)
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
/*
|
||||
This file provides two implementations of the NSDecimal functions.
|
||||
One is based on pure simple decimal mathematics, as we all learned it
|
||||
in school. This version is rather slow and may be inexact in the extrem
|
||||
in school. This version is rather slow and may be inexact in the extreme
|
||||
cases.
|
||||
THIS IS TESTED AND WORKING.
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
|
||||
The data structure used for NSDecimals is a bit strange. It also does not
|
||||
correspond to the description in the OpenStep specification. But this is
|
||||
not consistent, so a decission had to be made.
|
||||
not consistent, so a decision had to be made.
|
||||
The mantissa part (I know D. Knuth does not like this term, but it is used
|
||||
in the specification so we stay with it) consists of up to 38 digits, this
|
||||
are stored as an integer (in decimal representation or limps depending on the
|
||||
|
@ -72,7 +72,7 @@ typedef struct {
|
|||
BOOL isNegative; /* Is this negative? */
|
||||
BOOL validNumber; /* Is this a valid number? */
|
||||
unsigned char length; /* digits in mantissa. */
|
||||
unsigned char cMantissa[2*NSDecimalMaxDigit]; /* Make this big enought for multiplication */
|
||||
unsigned char cMantissa[2*NSDecimalMaxDigit]; /* Make this big enough for multiplication */
|
||||
} GSDecimal;
|
||||
|
||||
static NSDecimal zero = {0, NO, YES, 0, {0}};
|
||||
|
@ -84,6 +84,15 @@ static NSDecimal one = {0, NO, YES, 1, {1}};
|
|||
#else
|
||||
|
||||
// Make GSDecimal a synonym of NSDecimal
|
||||
/** <code>
|
||||
typedef struct {<br/>
|
||||
signed char exponent; // Signed exponent - -128 to 127<br/>
|
||||
BOOL isNegative; // Is this negative?<br/>
|
||||
BOOL validNumber; // Is this a valid number?<br/>
|
||||
unsigned char length; // digits in mantissa.<br/>
|
||||
unsigned char cMantissa[2*NSDecimalMaxDigit];<br/>
|
||||
}<br/>
|
||||
</code> */
|
||||
typedef NSDecimal GSDecimal;
|
||||
|
||||
static NSDecimal zero = {0, NO, YES, 0, {0}};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "Foundation/NSDecimalNumber.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
// shared default behavior for NSDecimalNumber class
|
||||
static NSDecimalNumberHandler *handler;
|
||||
|
||||
@implementation NSDecimalNumberHandler
|
||||
|
|
|
@ -43,6 +43,27 @@
|
|||
#include "GNUstepBase/GSCategories.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
/**
|
||||
* <p>This class and its subclasses store key-value pairs, where the key and
|
||||
* the value are objects. A great many utility methods for working with
|
||||
* dictionaries are provided as part of this class, including the ability to
|
||||
* retrieve multiple entries simultaneously, obtain sorted contents, and
|
||||
* read/write from/to a serialized representation.</p>
|
||||
*
|
||||
* <p>Both keys and values are retained by the implementation, and released
|
||||
* when either their entry is dropped or the entire dictionary is deallocated.
|
||||
* This differs from the implementation on OS X, where keys are copied instead
|
||||
* of being retained and must therefore implement the [NSCopying] protocol.</p>
|
||||
*
|
||||
* <p>Objects of this class are immutable. For a mutable version, use the
|
||||
* [NSMutableDictionary] subclass.</p>
|
||||
*
|
||||
* <p>The basic functionality in <code>NSDictionary</code> is similar to that
|
||||
* in Java's <code>HashMap</code>, and like that class it includes no locking
|
||||
* code and is not thread-safe. If the contents will be modified and
|
||||
* accessed from multiple threads you should enclose critical operations
|
||||
* within locks (see [NSLock]).</p>
|
||||
*/
|
||||
@implementation NSDictionary
|
||||
|
||||
@class GSDictionary;
|
||||
|
@ -96,7 +117,12 @@ static SEL appSel;
|
|||
}
|
||||
}
|
||||
|
||||
/** <init />
|
||||
/**
|
||||
* Initializes contents to the given objects and keys.
|
||||
* The two arrays must have the same size.
|
||||
* The n th element of the objects array is associated with the n th
|
||||
* element of the keys array.
|
||||
* <init />
|
||||
*/
|
||||
- (id) initWithObjects: (id*)objects
|
||||
forKeys: (id*)keys
|
||||
|
@ -304,6 +330,9 @@ static SEL appSel;
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new autoreleased empty dictionary.
|
||||
*/
|
||||
+ (id) dictionary
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] init]);
|
||||
|
@ -394,6 +423,12 @@ static SEL appSel;
|
|||
return AUTORELEASE(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a dictionary created using the given objects and keys.
|
||||
* The two arrays must have the same length.
|
||||
* The n th element of the objects array is associated with the n th
|
||||
* element of the keys array.
|
||||
*/
|
||||
+ (id) dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
|
@ -416,6 +451,10 @@ static SEL appSel;
|
|||
return [self initWithObjects: NULL forKeys: NULL count: 0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes with the keys and objects of otherDictionary.
|
||||
* (The keys and objects are not copied.)
|
||||
*/
|
||||
- (id) initWithDictionary: (NSDictionary*)otherDictionary
|
||||
{
|
||||
return [self initWithDictionary: otherDictionary copyItems: NO];
|
||||
|
@ -478,7 +517,7 @@ static SEL appSel;
|
|||
* which must contain a dictionary in property-list format.
|
||||
* </p>
|
||||
* <p>In GNUstep, the property-list format may be either the OpenStep
|
||||
* format (ASCII data), or the MacOS-X format (URF8 XML data) ... this
|
||||
* format (ASCII data), or the MacOS-X format (UTF-8 XML data) ... this
|
||||
* method will recognise which it is.
|
||||
* </p>
|
||||
* <p>If there is a failure to load the file for any reason, the receiver
|
||||
|
@ -531,7 +570,7 @@ static SEL appSel;
|
|||
* which must contain a dictionary in property-list format.
|
||||
* </p>
|
||||
* <p>In GNUstep, the property-list format may be either the OpenStep
|
||||
* format (ASCII data), or the MacOS-X format (URF8 XML data) ... this
|
||||
* format (ASCII data), or the MacOS-X format (UTF-8 XML data) ... this
|
||||
* method will recognise which it is.
|
||||
* </p>
|
||||
* <p>If there is a failure to load the URL for any reason, the receiver
|
||||
|
@ -610,6 +649,12 @@ static SEL appSel;
|
|||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Two dictionaries are equal if they each hold the same number of
|
||||
* entries, each key in one <code>isEqual</code> to a key in the other,
|
||||
* and, for a given key, the corresponding value objects also satisfy
|
||||
* <code>isEqual</code>.
|
||||
*/
|
||||
- (BOOL) isEqualToDictionary: (NSDictionary*)other
|
||||
{
|
||||
unsigned count;
|
||||
|
@ -764,6 +809,14 @@ compareIt(id o1, id o2, void* context)
|
|||
return (int)[o1 performSelector: f->s withObject: o2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ordered array of the keys sorted according to the values they
|
||||
* correspond to. To sort the values, a message with selector comp is
|
||||
* send to each value with another value as argument, as in
|
||||
* <code>[a comp: b]</code>. The comp method should return
|
||||
* <code>NSOrderedSame</code>, <code>NSOrderedAscending</code>, or
|
||||
* <code>NSOrderedDescending</code> as appropriate.
|
||||
*/
|
||||
- (NSArray*) keysSortedByValueUsingSelector: (SEL)comp
|
||||
{
|
||||
struct foo info;
|
||||
|
@ -776,6 +829,12 @@ compareIt(id o1, id o2, void* context)
|
|||
return k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiple version of [-objectForKey:]. Objects for each key in keys are
|
||||
* looked up and placed into return array in same order. For each key that
|
||||
* has no corresponding value in this dictionary, marker is put into the
|
||||
* array in its place.
|
||||
*/
|
||||
- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)marker
|
||||
{
|
||||
unsigned c = [keys count];
|
||||
|
@ -978,6 +1037,10 @@ compareIt(id o1, id o2, void* context)
|
|||
}
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* Mutable version of [NSDictionary].
|
||||
*/
|
||||
@implementation NSMutableDictionary
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -1037,23 +1100,46 @@ compareIt(id o1, id o2, void* context)
|
|||
return NSMutableDictionaryClass;
|
||||
}
|
||||
|
||||
/* This is the designated initializer */
|
||||
/**
|
||||
* Initializes an empty dictionary with memory preallocated for given number
|
||||
* of entries. Although memory space will be grown as needed when entries
|
||||
* are added, this can avoid the reallocate-and-copy process if the size of
|
||||
* the ultimate contents is known in advance.
|
||||
* <init/>
|
||||
*/
|
||||
- (id) initWithCapacity: (unsigned)numItems
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds entry for aKey, mapping to anObject. If either is nil, an exception
|
||||
* is raised. If aKey already in dictionary, the value it maps to is
|
||||
* silently replaced. aKey and anObject are both retained. (This differs
|
||||
* from OS X, where the key is copied and must therefore implement the
|
||||
* [NSCopying] protocol.)
|
||||
*/
|
||||
- (void) setObject: anObject forKey: (id)aKey
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove key-value mapping for given key aKey. No error if there is no
|
||||
* mapping for the key. A warning will be generated if aKey is nil.
|
||||
*/
|
||||
- (void) removeObjectForKey: (id)aKey
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an empty dictionary with memory preallocated for given number of
|
||||
* entries. Although memory space will be grown as needed when entries are
|
||||
* added, this can avoid the reallocate-and-copy process if the size of the
|
||||
* ultimate contents is known in advance.
|
||||
*/
|
||||
+ (id) dictionaryWithCapacity: (unsigned)numItems
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
|
@ -1061,6 +1147,12 @@ compareIt(id o1, id o2, void* context)
|
|||
}
|
||||
|
||||
/* Override superclass's designated initializer */
|
||||
/**
|
||||
* Initializes contents to the given objects and keys.
|
||||
* The two arrays must have the same size.
|
||||
* The n th element of the objects array is associated with the n th
|
||||
* element of the keys array.
|
||||
*/
|
||||
- (id) initWithObjects: (id*)objects
|
||||
forKeys: (id*)keys
|
||||
count: (unsigned)count
|
||||
|
@ -1079,6 +1171,9 @@ compareIt(id o1, id o2, void* context)
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out this dictionary by removing all entries.
|
||||
*/
|
||||
- (void) removeAllObjects
|
||||
{
|
||||
id k;
|
||||
|
@ -1092,6 +1187,11 @@ compareIt(id o1, id o2, void* context)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove entries specified by the given keyArray. No error is generated if
|
||||
* no mapping exists for a key or one is nil, although a console warning is
|
||||
* produced in the latter case.
|
||||
*/
|
||||
- (void) removeObjectsForKeys: (NSArray*)keyArray
|
||||
{
|
||||
unsigned c = [keyArray count];
|
||||
|
@ -1132,6 +1232,9 @@ compareIt(id o1, id o2, void* context)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all entries, then add all entries from otherDictionary.
|
||||
*/
|
||||
- (void) setDictionary: (NSDictionary*)otherDictionary
|
||||
{
|
||||
[self removeAllObjects];
|
||||
|
|
|
@ -803,6 +803,9 @@ enum
|
|||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Adds some backwards-compatibility and other methods.
|
||||
*/
|
||||
@implementation NSDistantObject(GNUstepExtensions)
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
|
||||
static NSFileManager *mgr = nil;
|
||||
|
||||
/**
|
||||
* This class does not adopt the [NSLocking] protocol but supports locking
|
||||
* across processes, including processes on different machines, as long as
|
||||
* they can access a common filesystem.
|
||||
*/
|
||||
@implementation NSDistributedLock
|
||||
|
||||
+ (void) initialize
|
||||
|
|
|
@ -62,9 +62,9 @@ NSString *GSNetworkNotificationCenterType =
|
|||
@end
|
||||
|
||||
/**
|
||||
* <p>The NSDistributedNotificationCenter provides a versatile yet
|
||||
* <p>The <code>NSDistributedNotificationCenter</code> provides a versatile yet
|
||||
* simple mechanism for objects in different processes to communicate
|
||||
* effectively while knowing very little about each others internals.<br />
|
||||
* effectively while knowing very little about each others' internals.<br />
|
||||
* A distributed notification center acts much like a normal
|
||||
* notification center, but it handles notifications on a machine-wide
|
||||
* (or local network wide) basis rather than just notifications within
|
||||
|
@ -76,7 +76,7 @@ NSString *GSNetworkNotificationCenterType =
|
|||
* <p>Since posting of distributed notifications involves inter-process
|
||||
* (and sometimes inter-host) communication, it is fundamentally slower
|
||||
* than normal notifications, and should be used relatively sparingly.
|
||||
* In order to help with this, the NSDistributedNotificationCenter
|
||||
* In order to help with this, the <code>NSDistributedNotificationCenter</code>
|
||||
* provides a notion of 'suspension', whereby a center can be suspended
|
||||
* causing notifications for observers in the process where the center
|
||||
* was suspended to cease receiving notifications. Observers can
|
||||
|
@ -86,19 +86,19 @@ NSString *GSNetworkNotificationCenterType =
|
|||
* </p>
|
||||
* <p>Distributed notifications are mediated by a server process which
|
||||
* handles all notifications for a particular center type. In GNUstep
|
||||
* this process is the gdnc tool, and when started without special
|
||||
* this process is the <code>gdnc</code> tool, and when started without special
|
||||
* options, a gdnc process acts as the local centre for the host it is
|
||||
* running on. When started with the GSNetwork user default set to YES,
|
||||
* the gdnc tool acts as a local network wide server (you should only
|
||||
* run one copy of gdnc like this on your LAN).<br />
|
||||
* The gdnc process should be started at machine boot time, but GNUstep
|
||||
* will attempt to start it automatically if it can't find it.
|
||||
* running on. When started with the <code>GSNetwork</code> user default set
|
||||
* to YES, the <code>gdnc</code> tool acts as a local network wide server (you
|
||||
* should only run one copy of <code>gdnc</code> like this on your LAN).<br />
|
||||
* The <code>gdnc</code> process should be started at machine boot time, but
|
||||
* GNUstep will attempt to start it automatically if it can't find it.
|
||||
* </p>
|
||||
* <p>MacOS-X currently defines only a notification center for the
|
||||
* local host. GNUstep also defines a local network center which can
|
||||
* be used from multiple hosts. By default the system sends this to
|
||||
* any gdnc process it can find which is configured as a network-wide
|
||||
* server, but the GDNCHost user default may be used to specify a
|
||||
* server, but the <code>GDNCHost</code> user default may be used to specify a
|
||||
* particular host to be contacted ... this may be of use where you
|
||||
* wish to have logically separate clusters of machines on a shared LAN.
|
||||
* </p>
|
||||
|
@ -119,7 +119,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
* Returns the default notification center ... a shared notification
|
||||
* center for the local host. This is simply a convenience method
|
||||
* equivalent to calling +notificationCenterForType: with
|
||||
* NSLocalNotificationCenterType as its argument.
|
||||
* <code>NSLocalNotificationCenterType</code> as its argument.
|
||||
*/
|
||||
+ (id) defaultCenter
|
||||
{
|
||||
|
@ -128,11 +128,11 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
|
||||
/**
|
||||
* Returns a notification center of the specified type.<br />
|
||||
* The NSLocalNotificationCenterType provides a shared access to
|
||||
* The <code>NSLocalNotificationCenterType</code> provides a shared access to
|
||||
* a notificatiuon center used by processes on the local host.<br />
|
||||
* The GSNetworkNotificationCenterType provides a shared access to
|
||||
* The <code>GSNetworkNotificationCenterType</code> provides a shared access to
|
||||
* a notificatiuon center used by processes on the local network.<br />
|
||||
* MacOS-X supports only NSLocalNotificationCenterType.
|
||||
* MacOS-X supports only <code>NSLocalNotificationCenterType</code>.
|
||||
*/
|
||||
+ (id) notificationCenterForType: (NSString*)type
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
/**
|
||||
* Adds an observer to the receiver. Calls
|
||||
* -addObserver:selector:name:object:suspensionBehavior: with
|
||||
* NSNotificationSuspensionBehaviorCoalesce.
|
||||
* <code>NSNotificationSuspensionBehaviorCoalesce</code>.
|
||||
*/
|
||||
- (void) addObserver: (id)anObserver
|
||||
selector: (SEL)aSelector
|
||||
|
@ -248,23 +248,23 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
* when the process to which the notification should be delivered is
|
||||
* suspended:
|
||||
* <deflist>
|
||||
* <term>NSNotificationSuspensionBehaviorDrop</term>
|
||||
* <term><code>NSNotificationSuspensionBehaviorDrop</code></term>
|
||||
* <desc>
|
||||
* Discards the notification if the observing process is suspended.
|
||||
* </desc>
|
||||
* <term>NSNotificationSuspensionBehaviorCoalesce</term>
|
||||
* <term><code>NSNotificationSuspensionBehaviorCoalesce</code></term>
|
||||
* <desc>
|
||||
* Discards previously queued notifications when the observing process
|
||||
* is suspended, leaving only the last notification posted in the queue.
|
||||
* Delivers this single notification when the process becomes unsuspended.
|
||||
* </desc>
|
||||
* <term>NSNotificationSuspensionBehaviorHold</term>
|
||||
* <term><code>NSNotificationSuspensionBehaviorHold</code></term>
|
||||
* <desc>
|
||||
* Queues notifications when the observing process is suspended,
|
||||
* delivering all the queued notifications when the process becomes
|
||||
* unsuspended again.
|
||||
* </desc>
|
||||
* <term>NSNotificationSuspensionBehaviorDeliverImmediately</term>
|
||||
* <term><code>NSNotificationSuspensionBehaviorDeliverImmediately</code></term>
|
||||
* <desc>
|
||||
* Deliver the notification immediately, even if the destination
|
||||
* process is suspended.
|
||||
|
@ -547,7 +547,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
|
||||
/**
|
||||
* Establish a connection to the server. This method should only be called
|
||||
* when protected by the centres lock, so that it is thread-safe.
|
||||
* when protected by the center's lock, so that it is thread-safe.
|
||||
*/
|
||||
- (void) _connect
|
||||
{
|
||||
|
@ -577,7 +577,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
* If we have a host specified, but it is the current host,
|
||||
* we do not need to ask for a host by name (nameserver lookup
|
||||
* can be faster) and the empty host name can be used to
|
||||
* indicate that we may start a gdnc server locally.
|
||||
* indicate that we may start a <code>gdnc</code> server locally.
|
||||
*/
|
||||
h = [NSHost hostWithName: host];
|
||||
if (h == nil)
|
||||
|
|
|
@ -29,8 +29,15 @@
|
|||
#include "Foundation/NSUtilities.h"
|
||||
#include "Foundation/NSArray.h"
|
||||
|
||||
/**
|
||||
* Simple class for iterating over a collection of objects, usually returned
|
||||
* from an [NSArray] or similar.
|
||||
*/
|
||||
@implementation NSEnumerator
|
||||
|
||||
/**
|
||||
* Returns all objects remaining in the enumeration as an array.
|
||||
*/
|
||||
- (NSArray*) allObjects
|
||||
{
|
||||
NSMutableArray *array;
|
||||
|
@ -54,6 +61,10 @@
|
|||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns next object in enumeration, or nil if none remain. Use code like
|
||||
* <code>while (object = [enumerator nextObject]) { ... }</code>.
|
||||
*/
|
||||
- (id) nextObject
|
||||
{
|
||||
[self subclassResponsibility:_cmd];
|
||||
|
|
|
@ -40,7 +40,7 @@ NSString* const NSGenericException
|
|||
= @"NSGenericException";
|
||||
|
||||
/**
|
||||
* An exception for caes where unexpected state is detected within an object
|
||||
* An exception for cases where unexpected state is detected within an object.
|
||||
*/
|
||||
NSString* const NSInternalInconsistencyException
|
||||
= @"NSInternalInconsistencyException";
|
||||
|
@ -53,7 +53,7 @@ NSString* const NSInvalidArgumentException
|
|||
= @"NSInvalidArgumentException";
|
||||
|
||||
/**
|
||||
* An exception used when the system faols to allocate required memory.
|
||||
* An exception used when the system fails to allocate required memory.
|
||||
*/
|
||||
NSString* const NSMallocException
|
||||
= @"NSMallocException";
|
||||
|
@ -120,15 +120,16 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
|
||||
/**
|
||||
<p>
|
||||
The NSException class helps manage errors in a program. It provides
|
||||
a mechanism for lower-level methods to provide information about
|
||||
The <code>NSException</code> class helps manage errors in a program. It
|
||||
provides a mechanism for lower-level methods to provide information about
|
||||
problems to higher-level methods, which more often than not, have a
|
||||
better ability to decide what to do about the problems.
|
||||
</p>
|
||||
<p>
|
||||
Exceptions are typically handled by enclosing a sensitive section
|
||||
of code inside the macros NS_DURING and NS_HANDLER, and then
|
||||
handling any problems after this, up to the NS_ENDHANDLER macro:
|
||||
of code inside the macros <code>NS_DURING</code> and <code>NS_HANDLER</code>,
|
||||
and then handling any problems after this, up to the
|
||||
<code>NS_ENDHANDLER</code> macro:
|
||||
</p>
|
||||
<example>
|
||||
NS_DURING
|
||||
|
@ -141,9 +142,9 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
NS_ENDHANDLER
|
||||
</example>
|
||||
<p>
|
||||
The local variable localException is the name of the exception
|
||||
object you can use in the NS_HANDLER section.
|
||||
The easiest way to cause an exeption is using the +raise:format:,...
|
||||
The local variable <code>localException</code> is the name of the exception
|
||||
object you can use in the <code>NS_HANDLER</code> section.
|
||||
The easiest way to cause an exception is using the +raise:format:,...
|
||||
method.
|
||||
</p>
|
||||
*/
|
||||
|
@ -248,7 +249,7 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
longjmp(handler->jumpState, 1);
|
||||
}
|
||||
|
||||
/** Returns the name of the exception */
|
||||
/** Returns the name of the exception. */
|
||||
- (NSString*) name
|
||||
{
|
||||
if (_e_name != nil)
|
||||
|
@ -261,7 +262,7 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the exception reason */
|
||||
/** Returns the exception reason. */
|
||||
- (NSString*) reason
|
||||
{
|
||||
if (_e_reason != nil)
|
||||
|
@ -274,7 +275,7 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the exception userInfo dictionary */
|
||||
/** Returns the exception userInfo dictionary. */
|
||||
- (NSDictionary*) userInfo
|
||||
{
|
||||
return _e_info;
|
||||
|
|
|
@ -52,12 +52,12 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
|
||||
/**
|
||||
* <p>
|
||||
* NSFileHandler is a Class that provides a wrapper for accessing
|
||||
* system files and other connections. You can open connections to a
|
||||
* <code>NSFileHandle</code> is a class that provides a wrapper for accessing
|
||||
* system files and socket connections. You can open connections to a
|
||||
* file using class methods such as +fileHandleForReadingAtPath:.
|
||||
* </p>
|
||||
* <p>
|
||||
* GNUstep extends the use of this Class to allow you to create
|
||||
* GNUstep extends the use of this class to allow you to create
|
||||
* network connections (sockets), secure connections and also allows
|
||||
* you to use compression with these files and connections (as long as
|
||||
* GNUstep Base was compiled with the zlib library).
|
||||
|
@ -88,7 +88,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
|
||||
// Allocating and Initializing a FileHandle Object
|
||||
/**
|
||||
* Returns an NSFileHandle object setup for reading from the
|
||||
* Returns an <code>NSFileHandle</code> object set up for reading from the
|
||||
* file listed at path. If the file does not exist or cannot
|
||||
* be opened for some other reason, nil is returned.
|
||||
*/
|
||||
|
@ -100,7 +100,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an NSFileHandle object setup for writing to the
|
||||
* Returns an <code>NSFileHandle</code> object set up for writing to the
|
||||
* file listed at path. If the file does not exist or cannot
|
||||
* be opened for some other reason, nil is returned.
|
||||
*/
|
||||
|
@ -112,7 +112,7 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an NSFileHandle object setup for updating (reading and
|
||||
* Returns an <code>NSFileHandle</code> object setup for updating (reading and
|
||||
* writing) from the file listed at path. If the file does not exist
|
||||
* or cannot be opened for some other reason, nil is returned.
|
||||
*/
|
||||
|
@ -124,9 +124,9 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an NSFileHandle object for the standard error descriptor.
|
||||
* The returned object is a shared instance as there can only be one
|
||||
* standard error per process.
|
||||
* Returns an <code>NSFileHandle</code> object for the standard error
|
||||
* descriptor. The returned object is a shared instance as there can only be
|
||||
* one standard error per process.
|
||||
*/
|
||||
+ (id) fileHandleWithStandardError
|
||||
{
|
||||
|
@ -136,9 +136,9 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an NSFileHandle object for the standard input descriptor.
|
||||
* The returned object is a shared instance as there can only be one
|
||||
* standard input per process.
|
||||
* Returns an <code>NSFileHandle</code> object for the standard input
|
||||
* descriptor. The returned object is a shared instance as there can only be
|
||||
* one standard input per process.
|
||||
*/
|
||||
+ (id) fileHandleWithStandardInput
|
||||
{
|
||||
|
@ -148,9 +148,9 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an NSFileHandle object for the standard output descriptor.
|
||||
* The returned object is a shared instance as there can only be one
|
||||
* standard output per process.
|
||||
* Returns an <code>NSFileHandle</code> object for the standard output
|
||||
* descriptor. The returned object is a shared instance as there can only be
|
||||
* one standard output per process.
|
||||
*/
|
||||
+ (id) fileHandleWithStandardOutput
|
||||
{
|
||||
|
@ -173,17 +173,29 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
return AUTORELEASE([o initWithNullDevice]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with desc, which can point to either a regular file or
|
||||
* socket connection.
|
||||
*/
|
||||
- (id) initWithFileDescriptor: (int)desc
|
||||
{
|
||||
return [self initWithFileDescriptor: desc closeOnDealloc: NO];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with desc, which can point to either a regular file or
|
||||
* socket connection. Close desc when this instance is deallocated if
|
||||
* flag is YES.
|
||||
*/
|
||||
- (id) initWithFileDescriptor: (int)desc closeOnDealloc: (BOOL)flag
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Windows-Unix compatibility support.
|
||||
*/
|
||||
- (id) initWithNativeHandle: (void*)hdl
|
||||
{
|
||||
return [self initWithNativeHandle: hdl closeOnDealloc: NO];
|
||||
|
@ -191,6 +203,10 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
|
||||
// This is the designated initializer.
|
||||
|
||||
/**
|
||||
* <init/>
|
||||
* Windows-Unix compatibility support.
|
||||
*/
|
||||
- (id) initWithNativeHandle: (void*)hdl closeOnDealloc: (BOOL)flag
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -199,12 +215,18 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
|
||||
// Returning file handles
|
||||
|
||||
/**
|
||||
* Return the underlying file descriptor for this instance.
|
||||
*/
|
||||
- (int) fileDescriptor
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Windows-Unix compatibility support.
|
||||
*/
|
||||
- (void*) nativeHandle
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -213,24 +235,41 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
|
||||
// Synchronous I/O operations
|
||||
|
||||
/**
|
||||
* Synchronously returns data available through this file or connection.
|
||||
* If the handle represents a file, the entire contents from current file
|
||||
* pointer to end are returned. If this is a network connection, reads
|
||||
* what is available, blocking if nothing is available. Raises
|
||||
* <code>NSFileHandleOperationException</code> if problem encountered.
|
||||
*/
|
||||
- (NSData*) availableData
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads up to maximum unsigned int bytes from file or communications
|
||||
* channel into return data.
|
||||
*/
|
||||
- (NSData*) readDataToEndOfFile
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads up to len bytes from file or communications channel into return data.
|
||||
*/
|
||||
- (NSData*) readDataOfLength: (unsigned int)len
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronously writes given data item to file or connection.
|
||||
*/
|
||||
- (void) writeData: (NSData*)item
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -239,11 +278,32 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
|
||||
// Asynchronous I/O operations
|
||||
|
||||
/**
|
||||
* Asynchronously accept a stream-type socket connection and act as the
|
||||
* (server) end of the communications channel. This instance should have
|
||||
* been created by -initWithFileDescriptor: with a stream-type socket created
|
||||
* by the appropriate system routine. Posts a
|
||||
* <code>NSFileHandleConnectionAcceptedNotification</code> when connection
|
||||
* initiated, returning an <code>NSFileHandle</code> for the client side with
|
||||
* that notification.
|
||||
*/
|
||||
- (void) acceptConnectionInBackgroundAndNotify
|
||||
{
|
||||
[self acceptConnectionInBackgroundAndNotifyForModes: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Asynchronously accept a stream-type socket connection and act as the
|
||||
* (server) end of the communications channel. This instance should have
|
||||
* been created by -initWithFileDescriptor: with a stream-type socket created
|
||||
* by the appropriate system routine. Posts a
|
||||
* <code>NSFileHandleConnectionAcceptedNotification</code> when connection
|
||||
* initiated, returning an <code>NSFileHandle</code> for the client side with
|
||||
* that notification.</p>
|
||||
*
|
||||
* <p>The modes array specifies [NSRunLoop] modes that the notification can
|
||||
* be posted in.</p>
|
||||
*/
|
||||
- (void) acceptConnectionInBackgroundAndNotifyForModes: (NSArray*)modes
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -305,18 +365,30 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
|
||||
// Seeking within a file
|
||||
|
||||
/**
|
||||
* Return current position in file, or raises exception if instance does
|
||||
* not represent a regular file.
|
||||
*/
|
||||
- (unsigned long long) offsetInFile
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Position file pointer at end of file, raising exception if instance does
|
||||
* not represent a regular file.
|
||||
*/
|
||||
- (unsigned long long) seekToEndOfFile
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Position file pointer at pos, raising exception if instance does
|
||||
* not represent a regular file.
|
||||
*/
|
||||
- (void) seekToFileOffset: (unsigned long long)pos
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -325,16 +397,27 @@ static Class NSFileHandle_ssl_class = nil;
|
|||
|
||||
// Operations on file
|
||||
|
||||
/**
|
||||
* Disallows further reading from read-access files or connections, and sends
|
||||
* EOF on write-access files or connections. Descriptor is only
|
||||
* <em>deleted</em> when this instance is deallocated.
|
||||
*/
|
||||
- (void) closeFile
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush in-memory buffer to file or connection, then return.
|
||||
*/
|
||||
- (void) synchronizeFile
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Chops file beyond pos then sets file pointer to that point.
|
||||
*/
|
||||
- (void) truncateFileAtOffset: (unsigned long long)pos
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
@ -365,12 +448,19 @@ NSString * const NSFileHandleReadToEndOfFileCompletionNotification
|
|||
|
||||
// Exceptions
|
||||
|
||||
/**
|
||||
* An exception used when a file error occurs.
|
||||
*/
|
||||
NSString * const NSFileHandleOperationException
|
||||
= @"NSFileHandleOperationException";
|
||||
|
||||
|
||||
// GNUstep class extensions
|
||||
|
||||
/**
|
||||
* A set of convenience methods for utilizing the socket communications
|
||||
* capabilities of the [NSFileHandle] class.
|
||||
*/
|
||||
@implementation NSFileHandle (GNUstepExtensions)
|
||||
|
||||
/**
|
||||
|
|
|
@ -230,7 +230,11 @@
|
|||
@end /* NSFileManager (PrivateMethods) */
|
||||
|
||||
/**
|
||||
* This is the main class for management of the local filesystem.
|
||||
* This is the main class for platform-independent management of the local
|
||||
* filesystem, which allows you to read and save files, create/list
|
||||
* directories, and move or delete files and directories. In addition to
|
||||
* simply listing directories, you may obtain an [NSDirectoryEnumerator]
|
||||
* instance for recursive directory contents enumeration.
|
||||
*/
|
||||
@implementation NSFileManager
|
||||
|
||||
|
@ -1378,54 +1382,54 @@ static NSFileManager* defaultManager = nil;
|
|||
|
||||
/**
|
||||
* If a file (or directory etc) exists at the specified path, and can be
|
||||
* queriesd for its attributes, this method returns a dictionary containing
|
||||
* queried for its attributes, this method returns a dictionary containing
|
||||
* the various attributes of that file. Otherwise nil is returned.<br />
|
||||
* If the flag is NO and the file is a symbolic link, the attributes of
|
||||
* the link itsself (rather than the file it points to) are returned.<br />
|
||||
* the link itself (rather than the file it points to) are returned.<br />
|
||||
* <p>
|
||||
* The dictionary keys for attributes are -
|
||||
* </p>
|
||||
* <deflist>
|
||||
* <term>NSFileAppendOnly</term>
|
||||
* <term><code>NSFileAppendOnly</code></term>
|
||||
* <desc>NSNumber ... boolean</desc>
|
||||
* <term>NSFileCreationDate</term>
|
||||
* <term><code>NSFileCreationDate</code></term>
|
||||
* <desc>NSDate when the file was created (if supported)</desc>
|
||||
* <term>NSFileDeviceIdentifier</term>
|
||||
* <term><code>NSFileDeviceIdentifier</code></term>
|
||||
* <desc>NSNumber (identifies the device on which the file is stored)</desc>
|
||||
* <term>NSFileExtensionHidden</term>
|
||||
* <term><code>NSFileExtensionHidden</code></term>
|
||||
* <desc>NSNumber ... boolean</desc>
|
||||
* <term>NSFileGroupOwnerAccountName</term>
|
||||
* <term><code>NSFileGroupOwnerAccountName</code></term>
|
||||
* <desc>NSString name of the file group</desc>
|
||||
* <term>NSFileGroupOwnerAccountID</term>
|
||||
* <term><code>NSFileGroupOwnerAccountID</code></term>
|
||||
* <desc>NSNumber ID of the file group</desc>
|
||||
* <term>NSFileHFSCreatorCode</term>
|
||||
* <term><code>NSFileHFSCreatorCode</code></term>
|
||||
* <desc>NSNumber not used</desc>
|
||||
* <term>NSFileHFSTypeCode</term>
|
||||
* <term><code>NSFileHFSTypeCode</code></term>
|
||||
* <desc>NSNumber not used</desc>
|
||||
* <term>NSFileImmutable</term>
|
||||
* <term><code>NSFileImmutable</code></term>
|
||||
* <desc>NSNumber ... boolean</desc>
|
||||
* <term>NSFileModificationDate</term>
|
||||
* <term><code>NSFileModificationDate</code></term>
|
||||
* <desc>NSDate when the file was last modified</desc>
|
||||
* <term>NSFileOwnerAccountName</term>
|
||||
* <term><code>NSFileOwnerAccountName</code></term>
|
||||
* <desc>NSString name of the file owner</desc>
|
||||
* <term>NSFileOwnerAccountID</term>
|
||||
* <term><code>NSFileOwnerAccountID</code></term>
|
||||
* <desc>NSNumber ID of the file owner</desc>
|
||||
* <term>NSFilePosixPermissions</term>
|
||||
* <term><code>NSFilePosixPermissions</code></term>
|
||||
* <desc>NSNumber posix access permissions mask</desc>
|
||||
* <term>NSFileReferenceCount</term>
|
||||
* <term><code>NSFileReferenceCount</code></term>
|
||||
* <desc>NSNumber number of links to this file</desc>
|
||||
* <term>NSFileSize</term>
|
||||
* <term><code>NSFileSize</code></term>
|
||||
* <desc>NSNumber size of the file in bytes</desc>
|
||||
* <term>NSFileSystemFileNumber</term>
|
||||
* <term><code>NSFileSystemFileNumber</code></term>
|
||||
* <desc>NSNumber the identifier for the file on the filesystem</desc>
|
||||
* <term>NSFileSystemNumber</term>
|
||||
* <term><code>NSFileSystemNumber</code></term>
|
||||
* <desc>NSNumber the filesystem on which the file is stored</desc>
|
||||
* <term>NSFileType</term>
|
||||
* <term><code>NSFileType</code></term>
|
||||
* <desc>NSString the type of file</desc>
|
||||
* </deflist>
|
||||
* <p>
|
||||
* The NSDictionary class also has a set of accessor methods which
|
||||
* enable you to get at file attribute information more efficiently
|
||||
* The [NSDictionary] class also has a set of convenience accessor methods
|
||||
* which enable you to get at file attribute information more efficiently
|
||||
* than using the keys above to extract it. You should generally
|
||||
* use the accessor methods where they are available.
|
||||
* </p>
|
||||
|
@ -1461,15 +1465,15 @@ static NSFileManager* defaultManager = nil;
|
|||
* Returns a dictionary containing the filesystem attributes for the
|
||||
* specified path (or nil if the path is not valid).<br />
|
||||
* <deflist>
|
||||
* <term>NSFileSystemSize</term>
|
||||
* <term><code>NSFileSystemSize</code></term>
|
||||
* <desc>NSNumber the size of the filesystem in bytes</desc>
|
||||
* <term>NSFileSystemFreeSize</term>
|
||||
* <term><code>NSFileSystemFreeSize</code></term>
|
||||
* <desc>NSNumber the amount of unused space on the filesystem in bytes</desc>
|
||||
* <term>NSFileSystemNodes</term>
|
||||
* <term><code>NSFileSystemNodes</code></term>
|
||||
* <desc>NSNumber the number of nodes in use to store files</desc>
|
||||
* <term>NSFileSystemFreeNodes</term>
|
||||
* <term><code>NSFileSystemFreeNodes</code></term>
|
||||
* <desc>NSNumber the number of nodes available to create files</desc>
|
||||
* <term>NSFileSystemNumber</term>
|
||||
* <term><code>NSFileSystemNumber</code></term>
|
||||
* <desc>NSNumber the identifying number for the filesystem</desc>
|
||||
* </deflist>
|
||||
*/
|
||||
|
@ -1709,11 +1713,11 @@ static NSFileManager* defaultManager = nil;
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert from OpenStep internal path format (unix-style) to a string in
|
||||
* Convert from OpenStep internal path format (Unix-style) to a string in
|
||||
* the local filesystem format, suitable for passing to system functions.<br />
|
||||
* Under unix, this simply standardizes the path and converts to a
|
||||
* Under Unix, this simply standardizes the path and converts to a
|
||||
* C string.<br />
|
||||
* Under windoze, this attempts to use local conventions to convert to a
|
||||
* Under Windoze, this attempts to use local conventions to convert to a
|
||||
* windows path. In GNUstep, the conventional unix syntax '~user/...' can
|
||||
* be used to indicate a windoze drive specification by using the drive
|
||||
* letter in place of the username, and the syntax '~@server/...' can be used
|
||||
|
@ -1741,7 +1745,7 @@ static NSFileManager* defaultManager = nil;
|
|||
l = strlen(c_path);
|
||||
if (l >= 2 && c_path[0] == '~' && c_path[1] == '@')
|
||||
{
|
||||
// Conver to windows UNC path.
|
||||
// Convert to windows UNC path.
|
||||
newpath = [NSString stringWithFormat: @"//%s", &c_path[2]];
|
||||
}
|
||||
else if (l >= 2 && c_path[0] == '~' && isalpha(c_path[1])
|
||||
|
@ -1820,7 +1824,7 @@ static NSFileManager* defaultManager = nil;
|
|||
/*
|
||||
* NB ... Don't standardize path, since that would automatically
|
||||
* follow symbolic links ... and mess up any code wishing to
|
||||
* examine the link itsself.
|
||||
* examine the link itself.
|
||||
*/
|
||||
return [path cString];
|
||||
#endif
|
||||
|
@ -2010,15 +2014,22 @@ inline char *append_file_to_path (const char *path, const char *file)
|
|||
static SEL swfsSel = 0;
|
||||
|
||||
/**
|
||||
* NSDirectoryEnumerator implementation<br />
|
||||
* <p>This is a subclass of <code>NSEnumerator</code> which provides a full
|
||||
* listing of all the files beneath a directory and its subdirectories.
|
||||
* Instances can be obtained through [NSFileManager-enumeratorAtPath:],
|
||||
* or through an initializer in this class. (For compatibility with OS X,
|
||||
* use the <code>NSFileManager</code> method.)</p>
|
||||
*
|
||||
* <p>This implementation is optimized and performance should be comparable
|
||||
* to the speed of standard Unix tools for large directories.</p>
|
||||
*/
|
||||
@implementation NSDirectoryEnumerator
|
||||
/*
|
||||
* The Objective-C interface hides a traditional C implementation.
|
||||
* This was the only way I could get near the speed of standard unix
|
||||
* tools for big directories.
|
||||
*/
|
||||
|
||||
@implementation NSDirectoryEnumerator
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSDirectoryEnumerator class])
|
||||
|
@ -2031,11 +2042,21 @@ static SEL swfsSel = 0;
|
|||
|
||||
// Initializing
|
||||
|
||||
/**
|
||||
* Initialize instance to enumerate contents at path, which should be a
|
||||
* directory and can be specified in relative or absolute, and may include
|
||||
* Unix conventions like '<code>~</code>' for user home directory, which will
|
||||
* be appropriately converted on Windoze systems. The justContents flag, if
|
||||
* set, is equivalent to recurseIntoSubdirectories = NO and followSymlinks =
|
||||
* NO, but the implementation will be made more efficient.
|
||||
*/
|
||||
- (id) initWithDirectoryPath: (NSString*)path
|
||||
recurseIntoSubdirectories: (BOOL)recurse
|
||||
followSymlinks: (BOOL)follow
|
||||
justContents: (BOOL)justContents
|
||||
{
|
||||
//TODO: the justContents flag is currently basically useless and should be
|
||||
// removed
|
||||
DIR *dir_pointer;
|
||||
const char *topPath;
|
||||
|
||||
|
@ -2177,6 +2198,8 @@ static SEL swfsSel = 0;
|
|||
return_file_name = append_file_to_path(dir.path, dirbuf->d_name);
|
||||
|
||||
/* TODO - can this one can be removed ? */
|
||||
/* ... seems like it can... */
|
||||
/* also, what if justContents=YES *and* isRecursive=YES? */
|
||||
if (!_flags.justContents)
|
||||
{
|
||||
_current_file_path = append_file_to_path(_top_path,
|
||||
|
@ -2250,10 +2273,9 @@ static SEL swfsSel = 0;
|
|||
|
||||
@end /* NSDirectoryEnumerator */
|
||||
|
||||
/*
|
||||
* Attributes dictionary access
|
||||
/**
|
||||
* Convenience methods for accessing named file attributes in a dictionary.
|
||||
*/
|
||||
|
||||
@implementation NSDictionary(NSFileAttributes)
|
||||
|
||||
/**
|
||||
|
@ -2272,11 +2294,17 @@ static SEL swfsSel = 0;
|
|||
return [[self objectForKey: NSFileExtensionHidden] boolValue];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HFS creator attribute (OS X).
|
||||
*/
|
||||
- (int) fileHFSCreatorCode
|
||||
{
|
||||
return [[self objectForKey: NSFileHFSCreatorCode] intValue];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HFS type code attribute (OS X).
|
||||
*/
|
||||
- (int) fileHFSTypeCode
|
||||
{
|
||||
return [[self objectForKey: NSFileHFSTypeCode] intValue];
|
||||
|
|
|
@ -183,7 +183,9 @@ NSCountHashTable(NSHashTable *table)
|
|||
|
||||
/**
|
||||
* Create a new hash table by calling NSCreateHashTableWithZone() using
|
||||
* NSDefaultMallocZone().<br />
|
||||
* NSDefaultMallocZone(). callbacks provides five helper functions used by
|
||||
* the main implementation. See the NSHashTableCallbacks documentation
|
||||
* for more information.<br />
|
||||
* If capacity is small or 0, then the returned
|
||||
* table has a reasonable (but still small) capacity.
|
||||
*/
|
||||
|
|
|
@ -91,7 +91,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
|
|||
return AUTORELEASE(o);
|
||||
}
|
||||
|
||||
+ (id) indexSetWithIndex: (unsigned int)anIndex;
|
||||
+ (id) indexSetWithIndex: (unsigned int)anIndex
|
||||
{
|
||||
id o = [self allocWithZone: NSDefaultMallocZone()];
|
||||
|
||||
|
@ -99,7 +99,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
|
|||
return AUTORELEASE(o);
|
||||
}
|
||||
|
||||
+ (id) indexSetWithIndexesInRange: (NSRange)aRange;
|
||||
+ (id) indexSetWithIndexesInRange: (NSRange)aRange
|
||||
{
|
||||
id o = [self allocWithZone: NSDefaultMallocZone()];
|
||||
|
||||
|
|
|
@ -58,11 +58,11 @@ static Class NSInvocation_concrete_class;
|
|||
|
||||
|
||||
/**
|
||||
* <p>The NSInvocation class implements a mechanism of constructing
|
||||
* messages (as NSInvocation instances), sending these to other
|
||||
* <p>The <code>NSInvocation</code> class implements a mechanism of constructing
|
||||
* messages (as <code>NSInvocation</code> instances), sending these to other
|
||||
* objects, and handling the returned values.
|
||||
* </p>
|
||||
* <p>An NSInvocation object may contain a target object to which a
|
||||
* <p>An <code>NSInvocation</code> object may contain a target object to which a
|
||||
* message can be sent, or may send the message to an arbitrary object.<br />
|
||||
* Each message consists of a selector for that method and an argument
|
||||
* list. Once the message has been sent, the invocation will contain
|
||||
|
@ -78,8 +78,8 @@ static Class NSInvocation_concrete_class;
|
|||
* object to which it was sent.
|
||||
* </p>
|
||||
* <p>Related to the class are two convenience macros ... NS_MESSAGE()
|
||||
* and NS_INVOCATION() to allow easy construction of invocations with
|
||||
* all the arguments set up.
|
||||
* and NS_INVOCATION() ... to allow easy construction of invocations
|
||||
* with all the arguments set up.
|
||||
* </p>
|
||||
*/
|
||||
@implementation NSInvocation
|
||||
|
@ -717,7 +717,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
|
||||
/**
|
||||
* Provides some minor extensions and some utility methods to aid
|
||||
* integration of NSInvocation with the ObjectiveC runtime.
|
||||
* integration of <code>NSInvocation</code> with the Objective-C runtime.
|
||||
*/
|
||||
@implementation NSInvocation (GNUstep)
|
||||
|
||||
|
@ -903,7 +903,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
/**
|
||||
* Sets the flag to tell the invocation that it should actually invoke a
|
||||
* method in the superclass of the target rather than the method of the
|
||||
* target itsself.<br />
|
||||
* target itself.<br />
|
||||
* This extension permits an invocation to act like a regular method
|
||||
* call sent to <em>super</em> in the method of a class.
|
||||
*/
|
||||
|
|
|
@ -52,6 +52,10 @@
|
|||
#undef _IN_NSKEYEDARCHIVER_M
|
||||
|
||||
/* Exceptions */
|
||||
|
||||
/**
|
||||
* An archiving error has occurred.
|
||||
*/
|
||||
NSString * const NSInvalidArchiveOperationException
|
||||
= @"NSInvalidArchiveOperationException";
|
||||
|
||||
|
@ -316,7 +320,7 @@ static NSDictionary *makeReference(unsigned ref)
|
|||
}
|
||||
|
||||
/*
|
||||
* At last, get the object to encode itsself. Save and restore the
|
||||
* At last, get the object to encode itself. Save and restore the
|
||||
* current object scope of course.
|
||||
*/
|
||||
_enc = m;
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
#include <Foundation/NSKeyedArchiver.h>
|
||||
#undef _IN_NSKEYEDUNARCHIVER_M
|
||||
|
||||
/**
|
||||
* An unarchiving error has occurred.
|
||||
*/
|
||||
NSString * const NSInvalidUnarchiveOperationException
|
||||
= @"NSInvalidUnarchiveOperationException";
|
||||
|
||||
|
|
|
@ -132,14 +132,13 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
|||
// Simplest lock for protecting critical sections of code
|
||||
|
||||
/**
|
||||
* An NSLock is used in multi-threaded applications to protect critical
|
||||
* pieces of code. While one thread holds a lock within a piece of code,
|
||||
* another thread cannot execute that code until the first thread has
|
||||
* given up it's hold on the lock. The limitation of NSLock is that
|
||||
* you can only lock an
|
||||
* NSLock once and it must be unlocked before it can be aquired again.<br />
|
||||
* Other lock classes, notably NSRecursiveLock, have
|
||||
* different restrictions.
|
||||
* An <code>NSLock</code> is used in multi-threaded applications to protect
|
||||
* critical pieces of code. While one thread holds a lock within a piece of
|
||||
* code, another thread cannot execute that code until the first thread has
|
||||
* given up its hold on the lock. The limitation of <code>NSLock</code> is
|
||||
* that you can only lock an <code>NSLock</code> once and it must be unlocked
|
||||
* before it can be aquired again.<br /> Other lock classes, notably
|
||||
* [NSRecursiveLock], have different restrictions.
|
||||
*/
|
||||
@implementation NSLock
|
||||
|
||||
|
@ -567,8 +566,8 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
|||
|
||||
|
||||
/**
|
||||
* See NSLock for more information about what a lock is. A recursive
|
||||
* lock extends NSLock in that you can lock a recursive lock multiple
|
||||
* See [NSLock] for more information about what a lock is. A recursive
|
||||
* lock extends [NSLock] in that you can lock a recursive lock multiple
|
||||
* times. Each lock must be balanced by a cooresponding unlock, and the
|
||||
* lock is not released for another thread to aquire until the last
|
||||
* unlock call is made (corresponding to the first lock message).
|
||||
|
|
|
@ -377,7 +377,7 @@ NSMapGet(NSMapTable *table, const void *key)
|
|||
/**
|
||||
* Adds the key and value to table.<br />
|
||||
* If an equal key is already in table, replaces its mapped value
|
||||
* with the new one, without changing the key itsself.<br />
|
||||
* with the new one, without changing the key itself.<br />
|
||||
* If key is equal to the notAKeyMarker field of the table's
|
||||
* NSMapTableKeyCallBacks, raises an NSInvalidArgumentException.
|
||||
*/
|
||||
|
|
|
@ -1226,7 +1226,7 @@ static int unique_index = 0;
|
|||
/*
|
||||
* This is the preferred initialisation method for NSMessagePort
|
||||
*
|
||||
* 'name' is the name of the socket in the port directory
|
||||
* 'socketName' is the name of the socket in the port directory
|
||||
*/
|
||||
+ (NSMessagePort*) _portWithName: (const unsigned char *)socketName
|
||||
listener: (BOOL)shouldListen
|
||||
|
@ -1642,11 +1642,6 @@ static int unique_index = 0;
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is called when a tcp/ip socket connection is broken. We remove the
|
||||
* connection handle from this port and, if this was the last handle to a
|
||||
* remote port, we invalidate the port.
|
||||
*/
|
||||
- (void) removeHandle: (GSMessageHandle*)handle
|
||||
{
|
||||
M_LOCK(myLock);
|
||||
|
@ -1753,7 +1748,7 @@ static int unique_index = 0;
|
|||
header = [components objectAtIndex: 0];
|
||||
/*
|
||||
* The Item header contains the item type and the length of the
|
||||
* data in the item (excluding the item header itsself).
|
||||
* data in the item (excluding the item header itself).
|
||||
*/
|
||||
hLength = [header length];
|
||||
l = hLength - sizeof(GSPortItemHeader);
|
||||
|
|
|
@ -74,7 +74,12 @@ static void clean_up_names(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Subclass of [NSPortNameServer] taking/returning instances of [NSMessagePort].
|
||||
* Port removal functionality is not supported; if you want to cancel a service,
|
||||
* you have to destroy the port (invalidate the [NSMessagePort] given to
|
||||
* [NSPortNameServer-registerPort:forName:]).
|
||||
*/
|
||||
@implementation NSMessagePortNameServer
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -88,6 +93,9 @@ static void clean_up_names(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain single instance for this host.
|
||||
*/
|
||||
+ (id) sharedInstance
|
||||
{
|
||||
if (defaultServer == nil)
|
||||
|
|
|
@ -29,6 +29,15 @@
|
|||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSString.h"
|
||||
|
||||
/**
|
||||
* <p>Represents a notification for posting to an [NSNotificationCenter].
|
||||
* Consists of a name, an object, and an optional dictionary. The
|
||||
* notification center will check for observers registered to receive
|
||||
* either notifications with the name, the object, or both and pass the
|
||||
* notification instance on to them.</p>
|
||||
* <p>This class is actually the interface for a class cluster, so instances
|
||||
* will be of a (private) subclass.</p>
|
||||
*/
|
||||
@implementation NSNotification
|
||||
|
||||
static Class abstractClass = 0;
|
||||
|
@ -55,8 +64,7 @@ static Class concreteClass = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a new autoreleased notification. Concrete subclasses override
|
||||
* this method to create actual notification objects.
|
||||
* Create a new autoreleased notification.
|
||||
*/
|
||||
+ (NSNotification*) notificationWithName: (NSString*)name
|
||||
object: (id)object
|
||||
|
@ -81,8 +89,7 @@ static Class concreteClass = 0;
|
|||
|
||||
/**
|
||||
* The abstract class implements a copy as a simple retain ...
|
||||
* subclasses should override this to perform more intelligent
|
||||
* copy operations.
|
||||
* subclasses override to perform more intelligent copy operations.
|
||||
*/
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
|
@ -112,8 +119,7 @@ static Class concreteClass = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* Concrete subclasses of NSNotification are responsible for
|
||||
* implementing this method to return the notification name.
|
||||
* Returns the notification name.
|
||||
*/
|
||||
- (NSString*) name
|
||||
{
|
||||
|
@ -122,8 +128,7 @@ static Class concreteClass = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* Concrete subclasses of NSNotification are responsible for
|
||||
* implementing this method to return the notification object.
|
||||
* Returns the notification object.
|
||||
*/
|
||||
- (id) object
|
||||
{
|
||||
|
@ -132,8 +137,7 @@ static Class concreteClass = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* Concrete subclasses of NSNotification are responsible for
|
||||
* implementing this method to return the notification user information.
|
||||
* Returns the notification user information.
|
||||
*/
|
||||
- (NSDictionary*) userInfo
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* Concrete class implementing NSNotification
|
||||
* Concrete class implementing NSNotification.
|
||||
*/
|
||||
@interface GSNotification : NSNotification
|
||||
{
|
||||
|
@ -539,6 +539,24 @@ purgeMapNode(GSIMapTable map, GSIMapNode node, id observer)
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* <p>GNUstep provides a framework for sending messages between objects within
|
||||
* a process called <em>notifications</em>. Objects register with an
|
||||
* <code>NSNotificationCenter</code> to be informed whenever other objects
|
||||
* post [NSNotification]s to it matching certain criteria. The notification
|
||||
* center processes notifications synchronously -- that is, control is only
|
||||
* returned to the notification poster once every recipient of the
|
||||
* notification has received it and processed it. Asynchronous processing is
|
||||
* possible using an [NSNotificationQueue].</p>
|
||||
*
|
||||
* <p>Obtain an instance using the +defaultCenter method.</p>
|
||||
*
|
||||
* <p>In a multithreaded process, notifications are always sent on the thread
|
||||
* that they are posted from.</p>
|
||||
*
|
||||
* <p>Use the [NSDistributedNotificationCenter] for interprocess
|
||||
* communications on the same machine.</p>
|
||||
*/
|
||||
@implementation NSNotificationCenter
|
||||
|
||||
/* The default instance, most often the only one created.
|
||||
|
@ -564,6 +582,11 @@ static NSNotificationCenter *default_center = nil;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default notification center being used for this task (process).
|
||||
* This is used for all notifications posted by the Base library unless
|
||||
* otherwise noted.
|
||||
*/
|
||||
+ (NSNotificationCenter*) defaultCenter
|
||||
{
|
||||
return default_center;
|
||||
|
@ -599,6 +622,21 @@ static NSNotificationCenter *default_center = nil;
|
|||
|
||||
/* Adding new observers. */
|
||||
|
||||
/**
|
||||
* <p>Registers observer to receive notifications with the name
|
||||
* notificationName and/or containing object (one or both of these two must be
|
||||
* non-nil; nil acts like a wildcard). When a notification of name name
|
||||
* containing object is posted, observer receives a selector message with this
|
||||
* notification as the argument. The notification center waits for the
|
||||
* observer to finish processing the message, then informs the next registree
|
||||
* matching the notification, and after all of this is done, control returns
|
||||
* to the poster of the notification. Therefore the processing in the
|
||||
* selector implementation should be short.</p>
|
||||
*
|
||||
* <p>The notification center does not retain observer or object. Therefore,
|
||||
* you should always send removeObserver: or removeObserver:name:object: to
|
||||
* the notification center before releasing these objects.</p>
|
||||
*/
|
||||
- (void) addObserver: (id)observer
|
||||
selector: (SEL)selector
|
||||
name: (NSString*)name
|
||||
|
@ -710,6 +748,14 @@ static NSNotificationCenter *default_center = nil;
|
|||
unlockNCTable(TABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deregisters observer for notifications matching name and/or object. If
|
||||
* either or both is nil, they act like wildcards. The observer may still
|
||||
* remain registered for other notifications; use -removeObserver: to remove
|
||||
* it from all. If observer is nil, the effect is to remove all registrees
|
||||
* for the specified notifications, unless both observer and name are nil, in
|
||||
* which case nothing is done.
|
||||
*/
|
||||
- (void) removeObserver: (id)observer
|
||||
name: (NSString*)name
|
||||
object: (id)object
|
||||
|
@ -866,9 +912,10 @@ static NSNotificationCenter *default_center = nil;
|
|||
unlockNCTable(TABLE);
|
||||
}
|
||||
|
||||
/* Remove all records pertaining to OBSERVER. For instance, this
|
||||
should be called before the OBSERVER is -dealloc'ed. */
|
||||
|
||||
/**
|
||||
* Deregisters observer from all notifications. This should be called before
|
||||
* the observer is deallocated.
|
||||
*/
|
||||
- (void) removeObserver: (id)observer
|
||||
{
|
||||
if (observer == nil)
|
||||
|
|
|
@ -284,8 +284,22 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
forModes: (NSArray*)modes;
|
||||
@end
|
||||
|
||||
/**
|
||||
* This class supports asynchronous posting of [NSNotification]s to an
|
||||
* [NSNotificationCenter]. The method to add a notification to the queue
|
||||
* returns immediately. The queue will periodically post its oldest
|
||||
* notification to the notification center. In a multithreaded process,
|
||||
* notifications are always sent on the thread that they are posted from.
|
||||
*/
|
||||
@implementation NSNotificationQueue
|
||||
|
||||
|
||||
/**
|
||||
* Returns the default notification queue for use in this thread. It will
|
||||
* always post notifications to the default notification center (for the
|
||||
* entire task, which may have multiple threads and therefore multiple
|
||||
* notification queues).
|
||||
*/
|
||||
+ (NSNotificationQueue*) defaultQueue
|
||||
{
|
||||
NotificationQueueList *list;
|
||||
|
@ -309,6 +323,10 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
[NSNotificationCenter defaultCenter]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a new instance to post notifications to the given
|
||||
* notificationCenter (instead of the default).
|
||||
*/
|
||||
- (id) initWithNotificationCenter: (NSNotificationCenter*)notificationCenter
|
||||
{
|
||||
_zone = [self zone];
|
||||
|
@ -361,6 +379,17 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
|
||||
/* Inserting and Removing Notifications From a Queue */
|
||||
|
||||
/**
|
||||
* Immediately remove all notifications from queue matching notification on
|
||||
* name and/or object as specified by coalesce mask, which is an OR
|
||||
* ('<code>|</code>') of the options
|
||||
* <code>NSNotificationCoalescingOnName</code>,
|
||||
* <code>NSNotificationCoalescingOnSender</code> (object), and
|
||||
* <code>NSNotificationNoCoalescing</code> (match only the given instance
|
||||
* exactly). If both of the first options are specified, notifications must
|
||||
* match on both attributes (not just either one). Removed notifications are
|
||||
* <em>not</em> posted.
|
||||
*/
|
||||
- (void) dequeueNotificationsMatching: (NSNotification*)notification
|
||||
coalesceMask: (unsigned int)coalesceMask
|
||||
{
|
||||
|
@ -378,6 +407,7 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
for (item = _asapQueue->tail; item; item = next)
|
||||
{
|
||||
next = item->next;
|
||||
//PENDING: should object comparison be '==' instead of isEqual?!
|
||||
if ((object == item->object) && [name isEqual: item->name])
|
||||
{
|
||||
remove_from_queue(_asapQueue, item, _zone);
|
||||
|
@ -447,6 +477,12 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets notification to be posted to notification center at time dependent on
|
||||
* postingStyle, which may be either <code>NSPostNow</code> (synchronous post),
|
||||
* <code>NSPostASAP</code> (post soon), or <code>NSPostWhenIdle</code> (post
|
||||
* when runloop is idle).
|
||||
*/
|
||||
- (void) enqueueNotification: (NSNotification*)notification
|
||||
postingStyle: (NSPostingStyle)postingStyle
|
||||
{
|
||||
|
@ -457,6 +493,17 @@ add_to_queue(NSNotificationQueueList *queue, NSNotification *notification,
|
|||
forModes: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets notification to be posted to notification center at time dependent on
|
||||
* postingStyle, which may be either <code>NSPostNow</code> (synchronous
|
||||
* post), <code>NSPostASAP</code> (post soon), or <code>NSPostWhenIdle</code>
|
||||
* (post when runloop is idle). coalesceMask determines whether this
|
||||
* notification should be considered same as other ones already on the queue,
|
||||
* in which case they are removed through a call to
|
||||
* -dequeueNotificationsMatching:coalesceMask: . The modes argument
|
||||
* determines which [NSRunLoop] mode notification may be posted in (nil means
|
||||
* all modes).
|
||||
*/
|
||||
- (void) enqueueNotification: (NSNotification*)notification
|
||||
postingStyle: (NSPostingStyle)postingStyle
|
||||
coalesceMask: (unsigned int)coalesceMask
|
||||
|
|
|
@ -803,50 +803,11 @@ static Class doubleNumberClass;
|
|||
return NSCopyObject(self, 0, zone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of this number using a non-localised
|
||||
* conversion (decimal point is '.' irrespective of the locale).
|
||||
*/
|
||||
- (NSString*) description
|
||||
{
|
||||
return [self descriptionWithLocale: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Produces a string representation of the number. For a boolean
|
||||
* this will be either 'true' or 'false'. For other numbers the
|
||||
* format is produced using the initWithFormat:locale:... method
|
||||
* of NSString, and the format depends on the type of number as
|
||||
* follows -
|
||||
* </p>
|
||||
* <deflist>
|
||||
* <term>char</term>
|
||||
* <desc>%i</desc>
|
||||
* <term> short</term>
|
||||
* <desc>%hi</desc>
|
||||
* <term> int</term>
|
||||
* <desc>%i</desc>
|
||||
* <term> long</term>
|
||||
* <desc>%li</desc>
|
||||
* <term> long long</term>
|
||||
* <desc>%lli</desc>
|
||||
* <term> unsigned char</term>
|
||||
* <desc>%u</desc>
|
||||
* <term> unsigned short</term>
|
||||
* <desc>%hu</desc>
|
||||
* <term> unsigned int</term>
|
||||
* <desc>%u</desc>
|
||||
* <term> unsigned long</term>
|
||||
* <desc>%lu</desc>
|
||||
* <term> unsigned long long</term>
|
||||
* <desc>%llu</desc>
|
||||
* <term> float</term>
|
||||
* <desc>%0.7g</desc>
|
||||
* <term> double</term>
|
||||
* <desc>%0.16g</desc>
|
||||
* </deflist>
|
||||
*/
|
||||
- (NSString*) descriptionWithLocale: (NSDictionary*)locale
|
||||
{
|
||||
NSString *result = nil;
|
||||
|
|
|
@ -366,6 +366,7 @@
|
|||
_thousandSeparator = 0;
|
||||
}
|
||||
|
||||
//FIXME - not implemented !?
|
||||
- (NSString*) stringForObjectValue: (id)anObject
|
||||
{
|
||||
if (nil == anObject)
|
||||
|
|
|
@ -781,7 +781,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
/**
|
||||
* <p>
|
||||
* <code>NSObject</code> is the root class (a root class is
|
||||
* a class with no superclass) of the gnustep base library
|
||||
* a class with no superclass) of the GNUstep base library
|
||||
* class hierarchy, so all classes normally inherit from
|
||||
* <code>NSObject</code>. There is an exception though:
|
||||
* <code>NSProxy</code> (which is used for remote messaging)
|
||||
|
@ -792,16 +792,16 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* your own classes should inherit (directly or indirectly)
|
||||
* from <code>NSObject</code> (or in special cases from
|
||||
* <code>NSProxy</code>). <code>NSObject</code> provides
|
||||
* the basic common functionality shared by all gnustep
|
||||
* the basic common functionality shared by all GNUstep
|
||||
* classes and objects.
|
||||
* </p>
|
||||
* <p>
|
||||
* The essential methods which must be implemented by all
|
||||
* classes for their instances to be usable within gnustep
|
||||
* classes for their instances to be usable within GNUstep
|
||||
* are declared in a separate protocol, which is the
|
||||
* <code>NSObject</code> protocol. Both
|
||||
* <code>NSObject</code> and <code>NSProxy</code> conform to
|
||||
* this protocol, which means all objects in a gnustep
|
||||
* this protocol, which means all objects in a GNUstep
|
||||
* application will conform to this protocol (btw, if you
|
||||
* don't find a method of <code>NSObject</code> you are
|
||||
* looking for in this documentation, make sure you also
|
||||
|
@ -813,7 +813,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* implement a new root class. If you do, you need to make
|
||||
* sure that your root class conforms (at least) to the
|
||||
* <code>NSObject</code> protocol, otherwise it will not
|
||||
* interact correctly with the gnustep framework. Said
|
||||
* interact correctly with the GNUstep framework. Said
|
||||
* that, I must note that I have never seen a case in which
|
||||
* a new root class is needed.
|
||||
* </p>
|
||||
|
@ -848,12 +848,22 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
}
|
||||
|
||||
#if GS_WITH_GC
|
||||
/**
|
||||
* A utility method used when garbage collection is enabled. Can be ignored.
|
||||
*/
|
||||
+ (BOOL) requiresTypedMemory
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This message is sent to a class once just before it is used for the first
|
||||
* time. If class has a superclass, its implementation of +initialize is
|
||||
* called first. You can implement +initialize in your own class if you need
|
||||
* to. NSObject's implementation handles essential root object and base
|
||||
* library initialization.
|
||||
*/
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSObject class])
|
||||
|
@ -1194,7 +1204,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* If you have allocated the memory using a non-standard mechanism, you
|
||||
* will not call the superclass (NSObject) implementation of the method
|
||||
* as you will need to handle the deallocation specially.<br />
|
||||
* In some circumstances, an object may wish to prevent itsself from
|
||||
* In some circumstances, an object may wish to prevent itself from
|
||||
* being deallocated, it can do this simply be refraining from calling
|
||||
* the superclass implementation.
|
||||
* </p>
|
||||
|
@ -1204,6 +1214,9 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
NSDeallocateObject (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is an anachronism. Do not use it.
|
||||
*/
|
||||
- (id) free
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
|
@ -1229,7 +1242,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the super class from which the recevier was derived.
|
||||
* Returns the super class from which the receiver was derived.
|
||||
*/
|
||||
+ (Class) superclass
|
||||
{
|
||||
|
@ -1237,7 +1250,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the super class from which the receviers class was derived.
|
||||
* Returns the super class from which the receivers class was derived.
|
||||
*/
|
||||
- (Class) superclass
|
||||
{
|
||||
|
@ -1399,7 +1412,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
/*
|
||||
* If there are protocols that this class conforms to,
|
||||
* the method may be listed in a protocol with more
|
||||
* detailed type information than in the class itsself
|
||||
* detailed type information than in the class itself
|
||||
* and we must therefore use the information from the
|
||||
* protocol.
|
||||
* This is because protocols also carry information
|
||||
|
@ -1526,26 +1539,61 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
return self;
|
||||
}
|
||||
|
||||
// FIXME - should this be added (as in OS X) now that we have NSKeyedArchiver?
|
||||
// - (Class) classForKeyedArchiver
|
||||
// {
|
||||
// return [self classForArchiver];
|
||||
// }
|
||||
|
||||
/**
|
||||
* Override to substitute class when an instance is being archived by an
|
||||
* [NSArchiver]. Default implementation returns -classForCoder.
|
||||
*/
|
||||
- (Class) classForArchiver
|
||||
{
|
||||
return [self classForCoder];
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to substitute class when an instance is being serialized by an
|
||||
* [NSCoder]. Default implementation returns <code>[self class]</code> (no
|
||||
* substitution).
|
||||
*/
|
||||
- (Class) classForCoder
|
||||
{
|
||||
return [self class];
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to substitute class when an instance is being serialized by an
|
||||
* [NSPortCoder]. Default implementation returns -classForCoder .
|
||||
*/
|
||||
- (Class) classForPortCoder
|
||||
{
|
||||
return [self classForCoder];
|
||||
}
|
||||
|
||||
// FIXME - should this be added (as in OS X) now that we have NSKeyedArchiver?
|
||||
// - (id) replacedmentObjectForKeyedArchiver: (NSKeyedArchiver *)keyedArchiver
|
||||
// {
|
||||
// return [self replacementObjectForCoder: (NSArchiver *)keyedArchiver];
|
||||
// }
|
||||
|
||||
/**
|
||||
* Override to substitute another object for this instance when being archived
|
||||
* by given [NSArchiver]. Default implementation returns
|
||||
* -replacementObjectForCoder:.
|
||||
*/
|
||||
- (id) replacementObjectForArchiver: (NSArchiver*)anArchiver
|
||||
{
|
||||
return [self replacementObjectForCoder: (NSCoder*)anArchiver];
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to substitute another object for this instance when being
|
||||
* serialized by given [NSCoder]. Default implementation returns
|
||||
* <code>self</code>.
|
||||
*/
|
||||
- (id) replacementObjectForCoder: (NSCoder*)anEncoder
|
||||
{
|
||||
return self;
|
||||
|
@ -1943,7 +1991,9 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the version number of the receiving class.
|
||||
* Returns the version number of the receiving class. This will default to
|
||||
* a number assigned by the Objective C compiler if [NSObject -setVersion] has
|
||||
* not been called.
|
||||
*/
|
||||
+ (int) version
|
||||
{
|
||||
|
@ -1951,7 +2001,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the version number of the receiving class.
|
||||
* Sets the version number of the receiving class. Should be nonnegative.
|
||||
*/
|
||||
+ (id) setVersion: (int)aVersion
|
||||
{
|
||||
|
@ -1966,10 +2016,16 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
@end
|
||||
|
||||
|
||||
/**
|
||||
* Methods for compatibility with the NEXTSTEP (pre-OpenStep) 'Object' class.
|
||||
*/
|
||||
@implementation NSObject (NEXTSTEP)
|
||||
|
||||
/* NEXTSTEP Object class compatibility */
|
||||
|
||||
/**
|
||||
* Logs a message. <em>Deprecated.</em> Use NSLog() in new code.
|
||||
*/
|
||||
- (id) error: (const char *)aString, ...
|
||||
{
|
||||
#define FMT "error: %s (%s)\n%s\n"
|
||||
|
@ -2088,6 +2144,10 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Some non-standard extensions mainly needed for backwards compatibility
|
||||
* and internal utility reasons.
|
||||
*/
|
||||
@implementation NSObject (GNUstep)
|
||||
|
||||
/* GNU Object class compatibility */
|
||||
|
@ -2263,24 +2323,37 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
return class_get_version (self);
|
||||
}
|
||||
|
||||
// These are used to write or read the instance variables
|
||||
// declared in this particular part of the object. Subclasses
|
||||
// should extend these, by calling [super read/write: aStream]
|
||||
// before doing their own archiving. These methods are private, in
|
||||
// the sense that they should only be called from subclasses.
|
||||
//NOTE: original comments included the following excerpt, however it is
|
||||
// probably not relevant now since the implementations are stubbed out.
|
||||
// Subclasses should extend these, by calling
|
||||
// [super read/write: aStream] before doing their own archiving. These
|
||||
// methods are private, in the sense that they should only be called from
|
||||
// subclasses.
|
||||
|
||||
/**
|
||||
* Originally used to read the instance variables declared in this
|
||||
* particular part of the object from a stream. Currently stubbed out.
|
||||
*/
|
||||
- (id) read: (TypedStream*)aStream
|
||||
{
|
||||
// [super read: aStream];
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Originally used to write the instance variables declared in this
|
||||
* particular part of the object to a stream. Currently stubbed out.
|
||||
*/
|
||||
- (id) write: (TypedStream*)aStream
|
||||
{
|
||||
// [super write: aStream];
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Originally used before [NSCoder] and related classes existed. Currently
|
||||
* stubbed out.
|
||||
*/
|
||||
- (id) awake
|
||||
{
|
||||
// [super awake];
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
|
||||
@implementation NSPort
|
||||
|
||||
/**
|
||||
* Exception raised if a timeout occurs during a port send or receive
|
||||
* operation.
|
||||
*/
|
||||
NSString * const NSPortTimeoutException = @"NSPortTimeoutException";
|
||||
|
||||
Class NSPort_abstract_class;
|
||||
|
|
|
@ -145,9 +145,17 @@ Please report the error to bug-gnustep@gnu.org.\n\n"
|
|||
}
|
||||
@end
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*** NSProcessInfo implementation
|
||||
*************************************************************************/
|
||||
|
||||
/**
|
||||
* Instances of this class encapsulate information on the current process.
|
||||
* For example, you can get the arguments, environment variables, host name,
|
||||
* or process name. There is only one instance per process, for obvious
|
||||
* reasons, and it may be obtained through the +processInfo method.
|
||||
*/
|
||||
@implementation NSProcessInfo
|
||||
/*************************************************************************
|
||||
*** Static global vars
|
||||
|
@ -912,6 +920,10 @@ int main(int argc, char *argv[], char *env[])
|
|||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Provides GNUstep-specific methods for controlled debug logging (a GNUstep
|
||||
* facility) and an internal/developer-related method.
|
||||
*/
|
||||
@implementation NSProcessInfo (GNUstep)
|
||||
|
||||
static BOOL debugTemporarilyDisabled = NO;
|
||||
|
|
|
@ -33,6 +33,23 @@
|
|||
#include "Foundation/NSInvocation.h"
|
||||
#include "Foundation/NSMethodSignature.h"
|
||||
|
||||
/**
|
||||
* The NSProtocolChecker and NSProxy classes provide message filtering and
|
||||
* forwarding capabilities. If you wish to ensure at runtime that a given
|
||||
* object will only be sent messages in a certain protocol, you create an
|
||||
* <code>NSProtocolChecker</code> instance with the protocol and the object as
|
||||
* arguments-
|
||||
|
||||
<example>
|
||||
id versatileObject = [[ClassWithManyMethods alloc] init];
|
||||
id narrowObject = [NSProtocolChecker protocolCheckerWithTarget: versatileObject
|
||||
protocol: @protocol(SomeSpecificProtocol)];
|
||||
return narrowObject;
|
||||
</example>
|
||||
|
||||
* This is often used in conjunction with distributed objects to expose only a
|
||||
* subset of an objects methods to remote processes
|
||||
*/
|
||||
@implementation NSProtocolChecker
|
||||
|
||||
/**
|
||||
|
@ -95,9 +112,10 @@
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Forwards any message to the delegate if the method is declared in
|
||||
* the checker's protocol; otherwise raises an NSInvalidArgumentException.
|
||||
* the checker's protocol; otherwise raises an
|
||||
* <code>NSInvalidArgumentException</code>.
|
||||
*/
|
||||
- (void) forwardInvocation: (NSInvocation*)anInvocation
|
||||
{
|
||||
|
@ -150,7 +168,7 @@
|
|||
* delegate. Thus, the checker can be vended in lieu of anObject to
|
||||
* restrict the messages that can be sent to anObject. If any method
|
||||
* in the protocol returns anObject, the checker will replace the returned
|
||||
* value with itsself rather than the target object.<br />
|
||||
* value with itself rather than the target object.<br />
|
||||
* Returns the new instance.
|
||||
*/
|
||||
- (id) initWithTarget: (NSObject*)anObject protocol: (Protocol*)aProtocol
|
||||
|
@ -216,7 +234,7 @@
|
|||
/*
|
||||
* If there are protocols that this class conforms to,
|
||||
* the method may be listed in a protocol with more
|
||||
* detailed type information than in the class itsself
|
||||
* detailed type information than in the class itself
|
||||
* and we must therefore use the information from the
|
||||
* protocol.
|
||||
* This is because protocols also carry information
|
||||
|
|
|
@ -47,12 +47,17 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
#endif
|
||||
|
||||
/**
|
||||
* The NSProxy class provides a basic implementation of a class whose
|
||||
* <p>The NSProxy class provides a basic implementation of a class whose
|
||||
* instances are used to <em>stand in</em> for other objects.<br />
|
||||
* The class provides the most basic methods of NSObject, and expects
|
||||
* messages for other methods to be forwarded to the <em>real</em>
|
||||
* object represented by the proxy. You must subclass NSProxy to
|
||||
* implement -forwardInvocation: to these <em>real</em> objects.
|
||||
* implement -forwardInvocation: to these <em>real</em> objects.</p>
|
||||
*
|
||||
* <p>Note that <code>NSProxy</code> is a different sort of class than others
|
||||
* in the GNUstep Base library in that it is the only example of a root class
|
||||
* besides [NSObject]. Thus, it defines its own <code><em>isa</em></code>
|
||||
* variable and implements the <code>NSObject</code> protocol.</p>
|
||||
*/
|
||||
@implementation NSProxy
|
||||
|
||||
|
@ -74,7 +79,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the receiver
|
||||
* Returns the receiver.
|
||||
*/
|
||||
+ (id) autorelease
|
||||
{
|
||||
|
@ -82,7 +87,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the receiver
|
||||
* Returns the receiver.
|
||||
*/
|
||||
+ (Class) class
|
||||
{
|
||||
|
@ -186,7 +191,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the superclass of the receiver
|
||||
* Returns the superclass of the receiver.
|
||||
*/
|
||||
+ (Class) superclass
|
||||
{
|
||||
|
@ -271,7 +276,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
}
|
||||
|
||||
/** <override-subclass />
|
||||
* Raises an NSInvalidArgumentException
|
||||
* Raises an <code>NSInvalidArgumentException</code>.
|
||||
*/
|
||||
- (void) forwardInvocation: (NSInvocation*)anInvocation
|
||||
{
|
||||
|
@ -300,7 +305,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests for pointer equality with anObject
|
||||
* Tests for pointer equality with anObject.
|
||||
*/
|
||||
- (BOOL) isEqual: (id)anObject
|
||||
{
|
||||
|
@ -350,7 +355,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns YES
|
||||
* Returns YES.
|
||||
*/
|
||||
- (BOOL) isProxy
|
||||
{
|
||||
|
@ -536,7 +541,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the superclass of the receivers class.
|
||||
* Returns the superclass of the receiver's class.
|
||||
*/
|
||||
- (Class) superclass
|
||||
{
|
||||
|
|
|
@ -1181,7 +1181,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
|
||||
@implementation NSObject (TimedPerformers)
|
||||
|
||||
/**
|
||||
/*
|
||||
* Cancels any perform operations set up for the specified target
|
||||
* in the current run loop.
|
||||
*/
|
||||
|
@ -1210,7 +1210,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Cancels any perform operations set up for the specified target
|
||||
* in the current loop, but only if the value of aSelector and argument
|
||||
* with which the performs were set up match those supplied.<br />
|
||||
|
@ -1589,6 +1589,23 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* <p><code>NSRunLoop</code> instances handle various utility tasks that must
|
||||
* be performed repetitively in an application, such as processing input
|
||||
* events, listening for distributed objects communications, firing
|
||||
* [NSTimer]s, and sending notifications and other messages
|
||||
* asynchronously.</p>
|
||||
*
|
||||
* <p>In general, there is one run loop per thread in an application, which
|
||||
* may always be obtained through the <code>+currentRunLoop</code> method,
|
||||
* however unless you are using the AppKit and the [NSApplication] class, the
|
||||
* run loop will not be started unless you explicitly send it a
|
||||
* <code>-run</code> message.</p>
|
||||
*
|
||||
* <p>At any given point, a run loop operates in a single <em>mode</em>, usually
|
||||
* <code>NSDefaultRunLoopMode</code>. Other options include
|
||||
* <code>NSConnectionReplyMode</code>, and certain modes used by the AppKit.</p>
|
||||
*/
|
||||
@implementation NSRunLoop
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -1607,6 +1624,9 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the run loop instance for the current thread.
|
||||
*/
|
||||
+ (NSRunLoop*) currentRunLoop
|
||||
{
|
||||
extern NSRunLoop *GSRunLoopForThread();
|
||||
|
@ -2038,11 +2058,21 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
return YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the loop in <code>NSDefaultRunLoopMode</code> by repeated calls to
|
||||
* -runMode:beforeDate: while there are still input sources. Exits when no
|
||||
* more input sources remain.
|
||||
*/
|
||||
- (void) run
|
||||
{
|
||||
[self runUntilDate: theFuture];
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the loop in <code>NSDefaultRunLoopMode</code> by repeated calls to
|
||||
* -runMode:beforeDate: while there are still input sources. Exits when no
|
||||
* more input sources remain, or date is reached, whichever occurs first.
|
||||
*/
|
||||
- (void) runUntilDate: (NSDate*)date
|
||||
{
|
||||
double ti = [date timeIntervalSinceNow];
|
||||
|
@ -2061,8 +2091,15 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* OpenStep-compatibility methods for [NSRunLoop]. These methods are also
|
||||
* all in OS X.
|
||||
*/
|
||||
@implementation NSRunLoop (OPENSTEP)
|
||||
|
||||
/**
|
||||
* Adds port to be monitored in given mode.
|
||||
*/
|
||||
- (void) addPort: (NSPort*)port
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
|
@ -2146,6 +2183,10 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
NSEndMapTableEnumeration(&enumerator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure event processing for acting as a server process for distributed
|
||||
* objects. (In the current implementation this is a no-op.)
|
||||
*/
|
||||
- (void) configureAsServer
|
||||
{
|
||||
/* Nothing to do here */
|
||||
|
@ -2218,6 +2259,10 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes port to be monitored from given mode.
|
||||
* Ports are also removed if they are detected to be invalid.
|
||||
*/
|
||||
- (void) removePort: (NSPort*)port
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
|
|
|
@ -52,9 +52,9 @@
|
|||
|
||||
/**
|
||||
* <p>
|
||||
* The NSScanner class cluster (currently a single class in GNUstep)
|
||||
* provides a mechanism to parse the contents of a string into number
|
||||
* and string values by making a sequence of scan operations to
|
||||
* The <code>NSScanner</code> class cluster (currently a single class in
|
||||
* GNUstep) provides a mechanism to parse the contents of a string into
|
||||
* number and string values by making a sequence of scan operations to
|
||||
* step through the string retrieving successive items.
|
||||
* </p>
|
||||
* <p>
|
||||
|
|
|
@ -40,6 +40,11 @@
|
|||
@class GSSet;
|
||||
@class GSMutableSet;
|
||||
|
||||
/**
|
||||
* <code>NSSet</code> maintains an unordered collection of unique objects
|
||||
* (according to [NSObject -isEqual]). When a duplicate object is added
|
||||
* to the set, it replaces its old copy.
|
||||
*/
|
||||
@implementation NSSet
|
||||
|
||||
static Class NSSet_abstract_class;
|
||||
|
@ -70,23 +75,35 @@ static Class NSMutableSet_concrete_class;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* New autoreleased empty set.
|
||||
*/
|
||||
+ (id) set
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()] init]);
|
||||
}
|
||||
|
||||
/**
|
||||
* New set containing (unique elements of) objects.
|
||||
*/
|
||||
+ (id) setWithArray: (NSArray*)objects
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithArray: objects]);
|
||||
}
|
||||
|
||||
/**
|
||||
* New set containing single object anObject.
|
||||
*/
|
||||
+ (id) setWithObject: anObject
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: &anObject count: 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* New set containing (unique elements of) objects.
|
||||
*/
|
||||
+ (id) setWithObjects: (id*)objects
|
||||
count: (unsigned)count
|
||||
{
|
||||
|
@ -94,6 +111,9 @@ static Class NSMutableSet_concrete_class;
|
|||
initWithObjects: objects count: count]);
|
||||
}
|
||||
|
||||
/**
|
||||
* New set with objects in given nil-terminated list.
|
||||
*/
|
||||
+ (id) setWithObjects: firstObject, ...
|
||||
{
|
||||
id set;
|
||||
|
@ -104,6 +124,9 @@ static Class NSMutableSet_concrete_class;
|
|||
return AUTORELEASE(set);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
*/
|
||||
+ (id) setWithSet: (NSSet*)aSet
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
|
@ -248,7 +271,9 @@ static Class NSMutableSet_concrete_class;
|
|||
return self;
|
||||
}
|
||||
|
||||
/* <init />
|
||||
/**
|
||||
* Initialize to contain (unique elements of) objects.
|
||||
* <init />
|
||||
*/
|
||||
- (id) initWithObjects: (id*)objects
|
||||
count: (unsigned)count
|
||||
|
@ -257,6 +282,9 @@ static Class NSMutableSet_concrete_class;
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If anObject is in set, return it (the copy in the set).
|
||||
*/
|
||||
- (id) member: (id)anObject
|
||||
{
|
||||
return [self subclassResponsibility: _cmd];
|
||||
|
@ -277,11 +305,17 @@ static Class NSMutableSet_concrete_class;
|
|||
return [copy initWithSet: self copyItems: NO];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return enumerator over objects in set. Order is undefined.
|
||||
*/
|
||||
- (NSEnumerator*) objectEnumerator
|
||||
{
|
||||
return [self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with (unique elements of) objects in given nil-terminated list.
|
||||
*/
|
||||
- (id) initWithObjects: firstObject, ...
|
||||
{
|
||||
GS_USEIDLIST(firstObject,
|
||||
|
@ -343,11 +377,17 @@ static Class NSMutableSet_concrete_class;
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize with same items as other (items not copied).
|
||||
*/
|
||||
- (id) initWithSet: (NSSet*)other
|
||||
{
|
||||
return [self initWithSet: other copyItems: NO];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of all objects in set. Order is undefined.
|
||||
*/
|
||||
- (NSArray*) allObjects
|
||||
{
|
||||
id e = [self objectEnumerator];
|
||||
|
@ -362,6 +402,9 @@ static Class NSMutableSet_concrete_class;
|
|||
initWithObjects: k count: c]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an arbitrary object from set, or nil if this is empty set.
|
||||
*/
|
||||
- (id) anyObject
|
||||
{
|
||||
if ([self count] == 0)
|
||||
|
@ -373,6 +416,10 @@ static Class NSMutableSet_concrete_class;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether set contains an object equal to this one according
|
||||
* to [NSObject -isEqual:].
|
||||
*/
|
||||
- (BOOL) containsObject: (id)anObject
|
||||
{
|
||||
return (([self member: anObject]) ? YES : NO);
|
||||
|
@ -383,6 +430,10 @@ static Class NSMutableSet_concrete_class;
|
|||
return [self count];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send each object given message (with no arguments).
|
||||
* Identical to [-makeObjectsPerformSelector:].
|
||||
*/
|
||||
- (void) makeObjectsPerform: (SEL)aSelector
|
||||
{
|
||||
id o, e = [self objectEnumerator];
|
||||
|
@ -391,6 +442,10 @@ static Class NSMutableSet_concrete_class;
|
|||
[o performSelector: aSelector];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send each object given message (with no arguments).
|
||||
* Identical to [-makeObjectsPerform:].
|
||||
*/
|
||||
- (void) makeObjectsPerformSelector: (SEL)aSelector
|
||||
{
|
||||
id o, e = [self objectEnumerator];
|
||||
|
@ -399,6 +454,10 @@ static Class NSMutableSet_concrete_class;
|
|||
[o performSelector: aSelector];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send each object given message with given argument.
|
||||
* Identical to [-makeObjectsPerform:withObject:].
|
||||
*/
|
||||
- (void) makeObjectsPerformSelector: (SEL)aSelector withObject: argument
|
||||
{
|
||||
id o, e = [self objectEnumerator];
|
||||
|
@ -407,6 +466,10 @@ static Class NSMutableSet_concrete_class;
|
|||
[o performSelector: aSelector withObject: argument];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send each object given message with given argument.
|
||||
* Identical to [-makeObjectsPerformSelector:withObject:].
|
||||
*/
|
||||
- (void) makeObjectsPerform: (SEL)aSelector withObject: argument
|
||||
{
|
||||
id o, e = [self objectEnumerator];
|
||||
|
@ -415,6 +478,9 @@ static Class NSMutableSet_concrete_class;
|
|||
[o performSelector: aSelector withObject: argument];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether set intersection with otherSet is non-empty.
|
||||
*/
|
||||
- (BOOL) intersectsSet: (NSSet*) otherSet
|
||||
{
|
||||
id o = nil, e = nil;
|
||||
|
@ -433,6 +499,9 @@ static Class NSMutableSet_concrete_class;
|
|||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether subset of otherSet.
|
||||
*/
|
||||
- (BOOL) isSubsetOfSet: (NSSet*) otherSet
|
||||
{
|
||||
id o = nil, e = nil;
|
||||
|
@ -468,6 +537,9 @@ static Class NSMutableSet_concrete_class;
|
|||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether each set is subset of the other.
|
||||
*/
|
||||
- (BOOL) isEqualToSet: (NSSet*)other
|
||||
{
|
||||
if ([self count] != [other count])
|
||||
|
@ -484,11 +556,17 @@ static Class NSMutableSet_concrete_class;
|
|||
return YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns listing of objects in set.
|
||||
*/
|
||||
- (NSString*) description
|
||||
{
|
||||
return [self descriptionWithLocale: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns listing of objects in set.
|
||||
*/
|
||||
- (NSString*) descriptionWithLocale: (NSDictionary*)locale
|
||||
{
|
||||
return [[self allObjects] descriptionWithLocale: locale];
|
||||
|
@ -496,6 +574,10 @@ static Class NSMutableSet_concrete_class;
|
|||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* Mutable version of [NSSet].
|
||||
*/
|
||||
@implementation NSMutableSet
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -505,6 +587,9 @@ static Class NSMutableSet_concrete_class;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* New autoreleased instance with given capacity.
|
||||
*/
|
||||
+ (id) setWithCapacity: (unsigned)numItems
|
||||
{
|
||||
return AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
|
@ -661,6 +746,7 @@ static Class NSMutableSet_concrete_class;
|
|||
}
|
||||
|
||||
/**
|
||||
|
||||
* Adds all the objects from other to the receiver.
|
||||
*/
|
||||
- (void) unionSet: (NSSet*) other
|
||||
|
|
|
@ -1977,7 +1977,7 @@ static unsigned wordAlign;
|
|||
header = [components objectAtIndex: 0];
|
||||
/*
|
||||
* The Item header contains the item type and the length of the
|
||||
* data in the item (excluding the item header itsself).
|
||||
* data in the item (excluding the item header itself).
|
||||
*/
|
||||
hLength = [header length];
|
||||
l = hLength - sizeof(GSPortItemHeader);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -429,7 +429,7 @@ gnustep_base_thread_callback(void)
|
|||
* has been carefully designed so that the internals of the base
|
||||
* library do not use threading (except for methods which explicitly
|
||||
* deal with threads of course) so that you can write applications
|
||||
* without threading. Non-threaded applications re more efficient
|
||||
* without threading. Non-threaded applications are more efficient
|
||||
* (no locking is required) and are easier to debug during development.
|
||||
*/
|
||||
@implementation NSThread
|
||||
|
@ -471,8 +471,15 @@ gnustep_base_thread_callback(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a new thread - use this method rather than alloc-init
|
||||
*/
|
||||
* <p>Create a new thread - use this method rather than alloc-init. The new
|
||||
* thread will begin executing the message given by aSelector, aTarget, and
|
||||
* anArgument. This should have no return value, and must set up an
|
||||
* autorelease pool if retain/release memory management is used. It should
|
||||
* free this pool before it finishes execution.</p>
|
||||
*
|
||||
* <p><strong>Note</strong>, unlike in Cocoa (and perhaps OpenStep), the
|
||||
* thread will <em>not</em> exit when the method finishes execution. You must
|
||||
* call [Thread +exit] yourself (from the thread) to terminate it.</p> */
|
||||
+ (void) detachNewThreadSelector: (SEL)aSelector
|
||||
toTarget: (id)aTarget
|
||||
withObject: (id)anArgument
|
||||
|
|
|
@ -942,7 +942,7 @@ static NSMapTable *absolutes = 0;
|
|||
@implementation NSTimeZone
|
||||
|
||||
/**
|
||||
* DEPRICATED.
|
||||
* DEPRECATED.
|
||||
*/
|
||||
+ (NSDictionary*) abbreviationDictionary
|
||||
{
|
||||
|
@ -1563,7 +1563,7 @@ static NSMapTable *absolutes = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* DEPRICATED: see NSTimeZoneDetail
|
||||
* DEPRECATED: see NSTimeZoneDetail
|
||||
*/
|
||||
- (NSArray*) timeZoneDetailArray
|
||||
{
|
||||
|
@ -1571,7 +1571,7 @@ static NSMapTable *absolutes = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* DEPRICATED: see NSTimeZoneDetail
|
||||
* DEPRECATED: see NSTimeZoneDetail
|
||||
*/
|
||||
- (NSTimeZoneDetail*) timeZoneDetailForDate: (NSDate*)date
|
||||
{
|
||||
|
@ -1604,7 +1604,7 @@ static NSMapTable *absolutes = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* DEPRICATED: Class is no longer used.
|
||||
* DEPRECATED: Class is no longer used.
|
||||
*/
|
||||
- (BOOL) isDaylightSavingTimeZone
|
||||
{
|
||||
|
@ -1613,7 +1613,7 @@ static NSMapTable *absolutes = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* DEPRICATED: Class is no longer used.
|
||||
* DEPRECATED: Class is no longer used.
|
||||
*/
|
||||
- (NSString*) timeZoneAbbreviation
|
||||
{
|
||||
|
@ -1621,7 +1621,7 @@ static NSMapTable *absolutes = 0;
|
|||
}
|
||||
|
||||
/**
|
||||
* DEPRICATED: Class is no longer used.
|
||||
* DEPRECATED: Class is no longer used.
|
||||
*/
|
||||
- (int) timeZoneSecondsFromGMT
|
||||
{
|
||||
|
|
|
@ -36,6 +36,14 @@
|
|||
@class NSGDate;
|
||||
static Class NSDate_class;
|
||||
|
||||
/**
|
||||
* An <code>NSTimer</code> provides a way to send a message at some time in
|
||||
* the future, possibly repeating every time a fixed interval has passed. To
|
||||
* use a timer, you can either create one that will automatically be added to
|
||||
* the run loop in the current thread (using the -addTimer:forMode: method),
|
||||
* or you can create it without adding it then add it to an [NSRunLoop]
|
||||
* explicitly later.
|
||||
*/
|
||||
@implementation NSTimer
|
||||
|
||||
+ (void) initialize
|
||||
|
|
|
@ -1607,8 +1607,9 @@ static unsigned urlAlign;
|
|||
|
||||
/**
|
||||
* An informal protocol to which clients may conform if they wish to be
|
||||
* notified of the progress in loading a URL for them. The default
|
||||
* implementations of these methods do nothing.
|
||||
* notified of the progress in loading a URL for them. NSURL conforms to
|
||||
* this protocol but all methods are implemented as no-ops. See also
|
||||
* the [NSURLHandleClient] protocol.
|
||||
*/
|
||||
@implementation NSObject (NSURLClient)
|
||||
|
||||
|
|
|
@ -294,8 +294,8 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
@end
|
||||
|
||||
/**
|
||||
* This class reconstructs objects from an archive.<br />
|
||||
* <strong>Re-using the archiver</strong><br />
|
||||
* <p>This class reconstructs objects from an archive.</p><br />
|
||||
* <strong>Re-using the archiver</strong>
|
||||
* <p>
|
||||
* The -resetUnarchiverWithData:atIndex: method lets you re-use
|
||||
* the archive to decode a new data object or, in conjunction
|
||||
|
@ -303,9 +303,9 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
* position in the archive), decode a second archive that exists
|
||||
* in the data object after the first one.
|
||||
* </p>
|
||||
* <strong>Subclassing with different input format.</strong><br />
|
||||
* NSUnarchiver normally reads directly from an NSData object using
|
||||
* the methods -
|
||||
* <strong>Subclassing with different input format.</strong><br /><br />
|
||||
* <code>NSUnarchiver</code> normally reads directly from an [NSData]
|
||||
* object using the methods -
|
||||
* <deflist>
|
||||
* <term>-deserializeTypeTag:andCrossRef:atCursor:</term>
|
||||
* <desc>
|
||||
|
@ -317,7 +317,7 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
* Also decode a crossreference number either to identify the
|
||||
* following item, or to refer to a previously encoded item.
|
||||
* Objects, Classes, Selectors, CStrings and Pointer items
|
||||
* have crossreference encoding, other types do not.
|
||||
* have crossreference encoding, other types do not.<br />
|
||||
* </desc>
|
||||
* <term>[NSData-deserializeDataAt:ofObjCType:atCursor:context:]</term>
|
||||
* <desc>
|
||||
|
@ -325,18 +325,18 @@ mapClassName(NSUnarchiverObjectInfo *info)
|
|||
* </desc>
|
||||
* </deflist>
|
||||
* <p>
|
||||
* And uses other NSData methods to read the archive header information
|
||||
* from within the method:
|
||||
* <code>NSUnarchiver</code> normally uses other [NSData] methods to read
|
||||
* the archive header information from within the method:
|
||||
* [-deserializeHeaderAt:version:classes:objects:pointers:]
|
||||
* to read a fixed size header including archiver version
|
||||
* (obtained by [self systemVersion]) and crossreference
|
||||
* (obtained by <code>[self systemVersion]</code>) and crossreference
|
||||
* table sizes.
|
||||
* </p>
|
||||
* <p>
|
||||
* To subclass NSUnarchiver, you must implement your own versions of the
|
||||
* four methods above, and override the 'directDataAccess' method to
|
||||
* return NO so that the archiver knows to use your serialization
|
||||
* methods rather than those in the NSData object.
|
||||
* To subclass <code>NSUnarchiver</code>, you must implement your own
|
||||
* versions of the four methods above, and override the 'directDataAccess'
|
||||
* method to return NO so that the archiver knows to use your serialization
|
||||
* methods rather than those in the [NSData] object.
|
||||
* </p>
|
||||
*/
|
||||
@implementation NSUnarchiver
|
||||
|
@ -356,6 +356,10 @@ static Class NSDataMallocClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an NSUnarchiver to read from anObject and returns result of sending
|
||||
* [NSCoder -decodeObject] to it.
|
||||
*/
|
||||
+ (id) unarchiveObjectWithData: (NSData*)anObject
|
||||
{
|
||||
NSUnarchiver *unarchiver;
|
||||
|
@ -378,6 +382,10 @@ static Class NSDataMallocClass;
|
|||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an NSUnarchiver to read from path and returns result of sending
|
||||
* [NSCoder -decodeObject] to it.
|
||||
*/
|
||||
+ (id) unarchiveObjectWithFile: (NSString*)path
|
||||
{
|
||||
NSData *d = [NSDataMallocClass dataWithContentsOfFile: path];
|
||||
|
@ -406,6 +414,9 @@ static Class NSDataMallocClass;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up to read objects from data buffer anObject.
|
||||
*/
|
||||
- (id) initForReadingWithData: (NSData*)anObject
|
||||
{
|
||||
if (anObject == nil)
|
||||
|
@ -1090,26 +1101,43 @@ static Class NSDataMallocClass;
|
|||
return [NSData data];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether have currently read through all of data buffer or file
|
||||
* this unarchiver was initialized with.
|
||||
*/
|
||||
- (BOOL) isAtEnd
|
||||
{
|
||||
return (cursor >= [data length]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns zone unarchived objects will be allocated from.
|
||||
*/
|
||||
- (NSZone*) objectZone
|
||||
{
|
||||
return zone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets zone unarchived objects will be allocated from.
|
||||
*/
|
||||
- (void) setObjectZone: (NSZone*)aZone
|
||||
{
|
||||
zone = aZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns system version archive was encoded by.
|
||||
*/
|
||||
- (unsigned) systemVersion
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns class name unarchivers will use to instantiate encoded objects
|
||||
* when they report their class name as nameInArchive.
|
||||
*/
|
||||
+ (NSString*) classNameDecodedForArchiveClassName: (NSString*)nameInArchive
|
||||
{
|
||||
NSUnarchiverClassInfo *info = [clsDict objectForKey: nameInArchive];
|
||||
|
@ -1127,6 +1155,11 @@ static Class NSDataMallocClass;
|
|||
return nameInArchive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets class name unarchivers will use to instantiate encoded objects
|
||||
* when they report their class name as nameInArchive. This can be used
|
||||
* to support backwards compatibility across class name changes.
|
||||
*/
|
||||
+ (void) decodeClassName: (NSString*)nameInArchive
|
||||
asClassName: (NSString*)trueName
|
||||
{
|
||||
|
@ -1152,6 +1185,10 @@ static Class NSDataMallocClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns class name this unarchiver uses to instantiate encoded objects
|
||||
* when they report their class name as nameInArchive.
|
||||
*/
|
||||
- (NSString*) classNameDecodedForArchiveClassName: (NSString*)nameInArchive
|
||||
{
|
||||
NSUnarchiverObjectInfo *info = [objDict objectForKey: nameInArchive];
|
||||
|
@ -1170,6 +1207,11 @@ static Class NSDataMallocClass;
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set class name this unarchiver uses to instantiate encoded objects
|
||||
* when they report their class name as nameInArchive. This can be used
|
||||
* to provide backward compatibility across class name changes.
|
||||
*/
|
||||
- (void) decodeClassName: (NSString*)nameInArchive
|
||||
asClassName: (NSString*)trueName
|
||||
{
|
||||
|
@ -1195,6 +1237,10 @@ static Class NSDataMallocClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unarchiver to replace anObject with replacement whenever it is
|
||||
* found decoded from the archive.
|
||||
*/
|
||||
- (void) replaceObject: (id)anObject withObject: (id)replacement
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -1230,15 +1276,24 @@ static Class NSDataMallocClass;
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Catagory for compatibility with old GNUstep encoding.
|
||||
*/
|
||||
@implementation NSUnarchiver (GNUstep)
|
||||
|
||||
/* Re-using the unarchiver */
|
||||
|
||||
/**
|
||||
* Return current position within archive byte array.
|
||||
*/
|
||||
- (unsigned) cursor
|
||||
{
|
||||
return cursor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare for reuse of the unarchiver to unpack a new archive, specified in
|
||||
* anObject, starting at pos. Reads archive header.
|
||||
*/
|
||||
- (void) resetUnarchiverWithData: (NSData*)anObject
|
||||
atIndex: (unsigned)pos
|
||||
{
|
||||
|
@ -1312,6 +1367,9 @@ static Class NSDataMallocClass;
|
|||
[objSave removeAllObjects];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads in header for GNUstep archive format.
|
||||
*/
|
||||
- (void) deserializeHeaderAt: (unsigned*)pos
|
||||
version: (unsigned*)v
|
||||
classes: (unsigned*)c
|
||||
|
@ -1337,6 +1395,9 @@ static Class NSDataMallocClass;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns YES.
|
||||
*/
|
||||
- (BOOL) directDataAccess
|
||||
{
|
||||
return YES;
|
||||
|
|
|
@ -191,8 +191,16 @@ NSString *NSUndoManagerWillUndoChangeNotification =
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* The main part for the NSUndoManager implementation.
|
||||
/**
|
||||
* NSUndoManager provides a general mechanism supporting implementation of
|
||||
* user action "undo" in applications. Essentially, it allows you to store
|
||||
* sequences of messages and receivers that need to be invoked to undo or
|
||||
* redo an action. The various methods in this class provide for grouping
|
||||
* of sets of actions, execution of undo or redo actions, and tuning behavior
|
||||
* parameters such as the size of the undo stack. Each application entity
|
||||
* with its own editing history (e.g., a document) should have its own undo
|
||||
* manager instance. Obtain an instance through a simple
|
||||
* <code>[[NSUndoManager alloc] init]</code> message.
|
||||
*/
|
||||
@implementation NSUndoManager
|
||||
|
||||
|
|
|
@ -73,7 +73,10 @@ NSString *NSConnectionReplyMode = @"NSConnectionReplyMode";
|
|||
|
||||
|
||||
|
||||
/* Exception handler */
|
||||
/**
|
||||
* Last-resort exception handler, a function taking an NSException and
|
||||
* returning void. Set with NSSetUncaughtExceptionHandler().
|
||||
*/
|
||||
NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
|
||||
|
||||
/* NSBundle */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue