* Headers/Foundation/NSArray.h,

* Source/NSArray.m: Move -setValue:forKey: from NSMutableArray
  to NSArray.
Patch by Marcian Lytwyn <marcian.lytwyn@advcsi.com>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37464 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2013-12-13 21:01:22 +00:00
parent d770d1eeae
commit 1c6738c660
3 changed files with 26 additions and 21 deletions

View file

@ -1,3 +1,10 @@
2013-12-13 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Foundation/NSArray.h,
* Source/NSArray.m: Move -setValue:forKey: from NSMutableArray to
NSArray.
Patch by Marcian Lytwyn <marcian.lytwyn@advcsi.com>.
2013-12-07 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/Additions/Unicode.m (GSPrivateDefaultCStringEncoding):

View file

@ -152,6 +152,7 @@ typedef NSUInteger NSBinarySearchingOptions;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (BOOL) writeToURL: (NSURL*)url atomically: (BOOL)useAuxiliaryFile;
- (id) valueForKey: (NSString*)key;
- (void) setValue: (id)value forKey: (NSString*)key;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
@ -377,9 +378,6 @@ DEFINE_BLOCK_TYPE(GSPredicateBlock, BOOL, id, NSUInteger, BOOL*);
- (void) sortWithOptions: (NSSortOptions)options
usingComparator: (NSComparator)comparator;
#endif
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (void) setValue: (id)value forKey: (NSString*)key;
#endif
/**
* Set method called by the compiler with array subscripting.
*/

View file

@ -1731,6 +1731,24 @@ compare(id elem1, id elem2, void* context)
return result;
}
/**
* Call setValue:forKey: on each of the receiver's items
* with the value and key.
*/
- (void) setValue: (id)value forKey: (NSString*)key
{
unsigned i;
unsigned count = [self count];
volatile id object = nil;
for (i = 0; i < count; i++)
{
object = [self objectAtIndex: i];
[object setValue: value
forKey: key];
}
}
- (void) enumerateObjectsUsingBlock: (GSEnumeratorBlock)aBlock
{
[self enumerateObjectsWithOptions: 0 usingBlock: aBlock];
@ -2552,24 +2570,6 @@ compare(id elem1, id elem2, void* context)
{
[self sortWithOptions: 0 usingComparator: comparator];
}
/**
* Call setValue:forKey: on each of the receiver's items
* with the value and key.
*/
- (void) setValue: (id)value forKey: (NSString*)key
{
unsigned i;
unsigned count = [self count];
volatile id object = nil;
for (i = 0; i < count; i++)
{
object = [self objectAtIndex: i];
[object setValue: value
forKey: key];
}
}
@end
@implementation NSArrayEnumerator