comment cleanups to improve documentation output

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20094 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
arobert 2004-09-19 23:24:36 +00:00
parent 726fb433c5
commit 9d1be23476
7 changed files with 218 additions and 189 deletions

View file

@ -80,8 +80,9 @@
- (void) encodeDataObject: (NSData*)data;
/**
* Encodes a generic object. This will usually result in an [NSCoding
* -encodeWithCoder:] message being sent to anObject so it can encode itself.
* Encodes a generic object. This will usually result in an
* [(NSCoding)-encodeWithCoder:] message being sent to anObject so it
* can encode itself.
*/
- (void) encodeObject: (id)anObject;
@ -150,7 +151,7 @@
/**
* Decodes a generic object. Usually the class will be read from the
* archive, an object will be created through an <code>alloc</code> call,
* then that class will be sent an [NSCoding -initWithCoder:] message.
* then that class will be sent an [(NSCoding)-initWithCoder:] message.
*/
- (id) decodeObject;

View file

@ -124,7 +124,7 @@ GS_EXPORT NSString * const NSFileHandleReadToEndOfFileCompletionNotification;
/**
* Dictionary key for [NSFileHandle] notifications used to access an
* [NSDataItem] containing received data.
* [NSData] object containing received data.
*/
GS_EXPORT NSString * const NSFileHandleNotificationDataItem;

View file

@ -33,24 +33,217 @@
#ifndef STRICT_OPENSTEP
/** An exception for an unknown key in [NSObject(NSKeyValueCoding)]. */
GS_EXPORT NSString* const NSUnknownKeyException;
/**
* <p>This describes an informal protocol for <em>key-value coding</em>, a
* mechanism whereby the fields of an object may be accessed and set using
* generic methods in conjunction with string keys rather than field-specific
* methods. Key-based access loses compile-time validity checking, but can be
* convenient in certain kinds of situations.</p>
*
* <p>The basic methods are implemented as a category of the [NSObject] class,
* but other classes override those default implementations to perform more
* specific operations.</p>
*/
@interface NSObject (NSKeyValueCoding)
/**
* Controls whether the NSKeyValueCoding methods may attempt to
* access instance variables directly.
* NSObject's implementation returns YES.
*/
+ (BOOL) accessInstanceVariablesDirectly;
/**
* Controls whether -storedValueForKey: and -takeStoredValue:forKey: may use
* the stored accessor mechanism. If not the calls get redirected to
* -valueForKey: and -takeValue:forKey: effectively changing the search order
* of private/public accessor methods and instance variables.
* NSObject's implementation returns YES.
*/
+ (BOOL) useStoredAccessor;
/**
* Invoked when -valueForKey: / -storedValueForKey: are called with a key,
* which can't be associated with an accessor method or instance variable.
* Subclasses may override this method to add custom handling. NSObject
* raises an NSUnknownKeyException, with a userInfo dictionary containing
* NSTargetObjectUserInfoKey with the receiver an NSUnknownUserInfoKey with
* the supplied key entries.
*/
- (id) handleQueryWithUnboundKey: (NSString*)aKey;
/**
* Invoked when -takeValue:forKey: / -takeStoredValue:forKey: are called with
* a key which can't be associated with an accessor method or instance
* variable. Subclasses may override this method to add custom handling.
* NSObject raises an NSUnknownKeyException, with a userInfo dictionary
* containing NSTargetObjectUserInfoKey with the receiver an
* NSUnknownUserInfoKey with the supplied key entries.
*/
- (void) handleTakeValue: (id)anObject forUnboundKey: (NSString*)aKey;
/**
* Returns the value associated with the supplied key as an object.
* Scalar attributes are converted to corresponding objects.
* Uses private accessors in favor of the public ones, if the receiver's
* class allows +useStoredAccessor. Otherwise this method invokes
* -valueForKey:.
* The search order is:<br/>
* Private accessor methods:
* <list>
* <item>_getKey</item>
* <item>_key</item>
* </list>
* If the receiver's class allows +accessInstanceVariablesDirectly
* it continues with instance variables:
* <list>
* <item>_key</item>
* <item>key</item>
* </list>
* Public accessor methods:
* <list>
* <item>getKey</item>
* <item>key</item>
* </list>
* Invokes -handleQueryWithUnboundKey: if no accessor mechanism can be
* found and raises NSInvalidArgumentException if the accesor method takes
* takes any arguments or the type is unsupported (e.g. structs).
*/
- (id) storedValueForKey: (NSString*)aKey;
/**
* Sets the value associated with the supplied in the receiver.
* The object is converted to the scalar attribute where applicable.
* Uses the private accessors in favor of the public ones, if the
* receiver's class allows +useStoredAccessor .
* Otherwise this method invokes -takeValue:forKey: .
* The search order is:<br/>
* Private accessor methods:
* <list>
* <item>_setKey:</item>
* </list>
* If the receiver's class allows accessInstanceVariablesDirectly
* it continues with instance variables:
* <list>
* <item>_key</item>
* <item>key</item>
* </list>
* Public accessor methods:
* <list>
* <item>setKey:</item>
* </list>
* Invokes -handleTakeValue:forUnboundKey:
* if no accessor mechanism can be found
* and raises NSInvalidArgumentException if the accesor method doesn't take
* exactly one argument or the type is unsupported (e.g. structs).
* If the receiver expects a scalar value and the value supplied
* is the NSNull instance or nil, this method invokes
* -unableToSetNilForKey: .
*/
- (void) takeStoredValue: (id)anObject forKey: (NSString*)aKey;
/**
* Iterates over the dictionary invoking -takeStoredValue:forKey:
* on the receiver for each key-value pair, converting NSNull to nil.
*/
- (void) takeStoredValuesFromDictionary: (NSDictionary*)aDictionary;
/**
* Sets the value if the attribute associated with the key in the receiver.
* The object is converted to a scalar attribute where applicable.
* Uses the public accessors in favor of the private ones.
* The search order is:<br/>
* Accessor methods:
* <list>
* <item>setKey:</item>
* <item>_setKey:</item>
* </list>
* If the receiver's class allows +accessInstanceVariablesDirectly
* it continues with instance variables:
* <list>
* <item>key</item>
* <item>_key</item>
* </list>
* Invokes -handleTakeValue:forUnboundKey:
* if no accessor mechanism can be found
* and raises NSInvalidArgumentException if the accesor method doesn't take
* exactly one argument or the type is unsupported (e.g. structs).
* If the receiver expects a scalar value and the value supplied
* is the NSNull instance or nil, this method invokes
* -unableToSetNilForKey: .
*/
- (void) takeValue: (id)anObject forKey: (NSString*)aKey;
/**
* Retrieves the object returned by invoking -valueForKey:
* on the receiver with the first key component supplied by the key path.
* Then invokes -takeValue:forKeyPath: recursively on the
* returned object with rest of the key path.
* The key components are delimated by '.'.
* If the key path doesn't contain any '.', this method simply
* invokes -takeValue:forKey:.
*/
- (void) takeValue: (id)anObject forKeyPath: (NSString*)aKey;
/**
* Iterates over the dictionary invoking -takeValue:forKey:
* on the receiver for each key-value pair, converting NSNull to nil.
*/
- (void) takeValuesFromDictionary: (NSDictionary*)aDictionary;
/**
* This method is invoked by the NSKeyValueCoding mechanism when an attempt
* is made to set an null value for a scalar attribute. This implementation
* raises an NSInvalidArgument exception. Subclasses my override this method
* to do custom handling. (E.g. setting the value to the equivalent of 0.)
*/
- (void) unableToSetNilForKey: (NSString*)aKey;
/**
* Returns the value associated with the supplied key as an object.
* Scalar attributes are converted to corresponding objects.
* The value-NSKeyValueCoding use the public accessors
* in favor of the private ones.
* The search order is:<br/>
* Accessor methods:
* <list>
* <item>getKey</item>
* <item>key</item>
* <item>_getKey</item>
* <item>_key</item>
* </list>
* If the receiver's class allows +accessInstanceVariablesDirectly
* it continues with instance variables:
* <list>
* <item>key</item>
* <item>_key</item>
* </list>
* Invokes -handleQueryWithUnboundKey:
* if no accessor mechanism can be found
* and raises NSInvalidArgumentException if the accesor method takes
* any arguments or the type is unsupported (e.g. structs).
*/
- (id) valueForKey: (NSString*)aKey;
/**
* Retuns the object returned by invoking -valueForKeyPath:
* recursively on the object returned by invoking -valueForKey:
* on the receiver with the first key component supplied by the key path.
* The key components are delimated by '.'.
* If the key path doesn't contain any '.', this method simply
* invokes -valueForKey: .
*/
- (id) valueForKeyPath: (NSString*)aKey;
/**
* Iterates over the array sending the receiver -valueForKey:
* for each object in the array and inserting the result in a dictionary.
* All nil values returned by -valueForKey: are replaced by the
* NSNull instance in the dictionary.
*/
- (NSDictionary*) valuesForKeys: (NSArray*)keys;
@end

View file

@ -19,6 +19,9 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
AutogsdocSource: NSObject.m
AutogsdocSource: Additions/GSCategories.m
*/
#ifndef __NSObject_h_GNUSTEP_BASE_INCLUDE

View file

@ -119,7 +119,7 @@
/**
* <p>
* If the supplied object (or one equal to it as determined by
* the [-isEqual:] method) is already present in the set, the
* the [NSObject-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.

View file

@ -37,47 +37,22 @@
#include "Foundation/NSKeyValueCoding.h"
#include "Foundation/NSNull.h"
/** An exception for an unknown key */
NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
/**
* This describes an informal protocol for key-value coding.
* The basic methods are implemented as a category of the NSObject class,
* but other classes override those default implementations to perform
* more specific operations.
*/
@implementation NSObject (KeyValueCoding)
@implementation NSObject(KeyValueCoding)
/**
* Controls whether the NSKeyValueCoding methods may attempt to
* access instance variables directly.
* NSObject's implementation returns YES.
*/
+ (BOOL) accessInstanceVariablesDirectly
{
return YES;
}
/**
* Controls whether [NSObject-storedValueForKey:] and
* [NSObject-takeStoredValueForKey:] may use the stored accessor mechainsm.
* If not the calls get redirected to [NSObject-valueForKey:] and
* [NSObject-takeValueForKey:] effectively changing the search order
* of private/public accessor methods and instance variables.
*/
+ (BOOL) useStoredAccessor
{
return YES;
}
/**
* Invoked when [NSObject-valueForKey:]/[NSObject-storedValueForKey:] are
* called with a key, which can't be associated with an accessor method or
* instance variable. Subclasses may override this method to add custom
* handling. NSObject raises an NSUnknownKeyException, with a userInfo
* dictionary containing NSTargetObjectUserInfoKey with the receiver
* an NSUnknownUserInfoKey with the supplied key entries.
*/
- (id) handleQueryWithUnboundKey: (NSString*)aKey
{
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
@ -93,15 +68,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
return nil;
}
/**
* Invoked when
* [NSObject-takeValue:forKey:]/[NSObject-takeStoredValue:forKey:] are
* called with a key which can't be associated with an accessor method or
* instance variable. Subclasses may override this method to add custom
* handling. NSObject raises an NSUnknownKeyException, with a userInfo
* dictionary containing NSTargetObjectUserInfoKey with the receiver
* an NSUnknownUserInfoKey with the supplied key entries.
*/
- (void) handleTakeValue: (id)anObject forUnboundKey: (NSString*)aKey
{
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
@ -116,35 +83,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
[exp raise];
}
/**
* Returns the value associated with the supplied key as an object.
* Scalar attributes are converted to corresponding objects.
* The storedValue-NSKeyValueCoding use the private accessors
* in favor of the public ones, if the receiver's class allows
* [NSObject+useStoredAccessor]. Otherwise this method invokes
* [NSObject-valueForKey:].
* The search order is:<\br>
* Private accessor methods:
* <list>
* <item>_getKey</item>
* <item>_key</item>
* </list>
* If the receiver's class allows [NSObject+accessInstanceVariablesDirectly]
* it continues with instance variables:
* <list>
* <item>_key</item>
* <item>key</item>
* </list>
* Public accessor methods:
* <list>
* <item>getKey</item>
* <item>key</item>
* </list>
* Invokes [NSObject-handleQueryWithUnboundKey:]
* if no accessor mechanism can be found
* and raises NSInvalidArgumentException if the accesor method takes
* any arguments or the type is unsupported (e.g. structs).
*/
- (id) storedValueForKey: (NSString*)aKey
{
unsigned size;
@ -223,36 +162,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
}
}
/**
* Sets the value associated with the supplied in the receiver.
* The object is converted to the scalar attribute where applicable.
* The storedValue-NSKeyValueCoding use the private accessors
* in favor of the public ones, if the receiver's class allows
* [NSObject+useStoredAccessor.]
* Otherwise this method invokes [NSObject-takeValue:forKey:].
* The search order is:<\br>
* Private accessor methods:
* <list>
* <item>_setKey:</item>
* </list>
* If the receiver's class allows [NSObject+accessInstanceVariablesDirectly]
* it continues with instance variables:
* <list>
* <item>_key</item>
* <item>key</item>
* </list>
* Public accessor methods:
* <list>
* <item>setKey:</item>
* </list>
* Invokes [NSObject-handleTakeValue:forUnboundKey:]
* if no accessor mechanism can be found
* and raises NSInvalidArgumentException if the accesor method doesn't take
* exactly one argument or the type is unsupported (e.g. structs).
* If the receiver expects a scalar value and the value supplied
* is the NSNull instance or nil, this method invokes
* [NSObject-unableToSetNilForKey:].
*/
- (void) takeStoredValue: (id)anObject forKey: (NSString*)aKey
{
unsigned size;
@ -322,10 +232,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
}
}
/**
* Iterates over the dictionary invoking [NSObject-takeStoredValue:forKey:]
* on the receiver for each key-value pair, converting NSNull to nil.
*/
- (void) takeStoredValuesFromDictionary: (NSDictionary*)aDictionary
{
NSEnumerator *enumerator = [aDictionary keyEnumerator];
@ -344,31 +251,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
}
}
/**
* Sets the value if the attribute associated with the key in the receiver.
* The object is converted to a scalar attribute where applicable.
* The value-NSKeyValueCoding use the public accessors
* in favor of the private ones.
* The search order is:<\br>
* Accessor methods:
* <list>
* <item>setKey:</item>
* <item>_setKey:</item>
* </list>
* If the receiver's class allows [NSObject+accessInstanceVariablesDirectly]
* it continues with instance variables:
* <list>
* <item>key</item>
* <item>_key</item>
* </list>
* Invokes [NSObject-handleTakeValue:forUnboundKey:]
* if no accessor mechanism can be found
* and raises NSInvalidArgumentException if the accesor method doesn't take
* exactly one argument or the type is unsupported (e.g. structs).
* If the receiver expects a scalar value and the value supplied
* is the NSNull instance or nil, this method invokes
* [NSObject-unableToSetNilForKey:].
*/
- (void) takeValue: (id)anObject forKey: (NSString*)aKey
{
unsigned size;
@ -425,15 +308,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
}
}
/**
* Retrieves the object returned by invoking [NSObject-valueForKey:]
* on the receiver with the first key component supplied by the key path.
* Then invokes [NSObject-takeValue:forKeyPath:] recursively on the
* returned object with rest of the key path.
* The key components are delimated by '.'.
* If the key path doesn't contain any '.', this method simply
* invokes [NSObject-takeValue:forKey:].
*/
- (void) takeValue: (id)anObject forKeyPath: (NSString*)aKey
{
NSRange r = [aKey rangeOfString: @"."];
@ -451,10 +326,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
}
}
/**
* Iterates over the dictionary invoking [NSObject-takeValue:forKey:]
* on the receiver for each key-value pair, converting NSNull to nil.
*/
- (void) takeValuesFromDictionary: (NSDictionary*)aDictionary
{
NSEnumerator *enumerator = [aDictionary keyEnumerator];
@ -473,12 +345,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
}
}
/**
* This method is invoked by the NSKeyValueCoding mechanism when an attempt
* is made to set an null value for a scalar attribute. This implementation
* raises an NSInvalidArgument exception. Subclasses my override this method
* to do custom handling. (E.g. setting the value to the equivalent of 0.)
*/
- (void) unableToSetNilForKey: (NSString*)aKey
{
[NSException raise: NSInvalidArgumentException
@ -486,30 +353,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
NSStringFromSelector(_cmd), NSStringFromClass([self class]), self, aKey];
}
/**
* Returns the value associated with the supplied key as an object.
* Scalar attributes are converted to corresponding objects.
* The value-NSKeyValueCoding use the public accessors
* in favor of the privat ones.
* The search order is:<\br>
* Accessor methods:
* <list>
* <item>getKey</item>
* <item>key</item>
* <item>_getKey</item>
* <item>_key</item>
* </list>
* If the receiver's class allows accessInstanceVariablesDirectly
* it continues with instance variables:
* <list>
* <item>key</item>
* <item>_key</item>
* </list>
* Invokes [NSObject-handleQueryWithUnboundKey:]
* if no accessor mechanism can be found
* and raises NSInvalidArgumentException if the accesor method takes
* any arguments or the type is unsupported (e.g. structs).
*/
- (id) valueForKey: (NSString*)aKey
{
unsigned size;
@ -578,14 +422,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
}
}
/**
* Retuns the object returned by invoking [NSObject-valueForKeyPath:]
* recursively on the object returned by invoking [NSObject-valueForKey:]
* on the receiver with the first key component supplied by the key path.
* The key components are delimated by '.'.
* If the key path doesn't contain any '.', this method simply
* invokes [NSObject-valueForKey:].
*/
- (id) valueForKeyPath: (NSString*)aKey
{
NSRange r = [aKey rangeOfString: @"."];
@ -605,12 +442,7 @@ NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
return o;
}
/**
* Iterates over the array sending the receiver [NSObject-valueForKey:]
* for each object in the array and inserting the result in a dictionary.
* All nil values returned by [NSObject-valueForKey:] are replaced by the
* NSNull instance in the dictionary.
*/
- (NSDictionary*) valuesForKeys: (NSArray*)keys
{
NSMutableDictionary *dict;

View file

@ -43,7 +43,7 @@
/**
* <code>NSSet</code> maintains an unordered collection of unique objects
* (according to [NSObject -isEqual]). When a duplicate object is added
* (according to [NSObject-isEqual:]). When a duplicate object is added
* to the set, it replaces its old copy.
*/
@implementation NSSet
@ -454,7 +454,7 @@ static Class NSMutableSet_concrete_class;
/**
* Return whether set contains an object equal to this one according
* to [NSObject -isEqual:].
* to [NSObject-isEqual:].
*/
- (BOOL) containsObject: (id)anObject
{