Detect the presence of libdispatch and, if available, use it for collection

enumeration methods that take blocks as arguments. This allows us to implement
the NSEnumerationConcurrent option of those methods with minimal effort.

The searching methods on NSIndexSet and all the sorting methods are still
missing.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35010 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Niels Grewe 2012-03-27 17:05:19 +00:00
parent 95e88e9a7e
commit fa47f6da10
15 changed files with 22804 additions and 4578 deletions

View file

@ -3,19 +3,19 @@
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Created: Feb 2004
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
@ -23,11 +23,12 @@
AutogsdocSource: NSIndexSet.m
*/
*/
#ifndef _NSIndexSet_h_GNUSTEP_BASE_INCLUDE
#define _NSIndexSet_h_GNUSTEP_BASE_INCLUDE
#import <GNUstepBase/GSVersionMacros.h>
#import <GNUstepBase/GSBlocks.h>
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
@ -89,13 +90,28 @@ extern "C" {
*/
- (NSUInteger) count;
#if OS_API_VERSION(100500,GS_API_LATEST)
#if OS_API_VERSION(100500,GS_API_LATEST)
/** Not implemented
* Returns the number of indexes set within the specified range.
*/
- (NSUInteger) countOfIndexesInRange: (NSRange)range;
#endif
#if OS_API_VERSION(100600,GS_API_LATEST)
DEFINE_BLOCK_TYPE(GSIndexSetEnumerationBlock, void, NSUInteger, BOOL*);
- (void)enumerateIndexesInRange: (NSRange)range
options: (NSEnumerationOptions)opts
usingBlock: (GSIndexSetEnumerationBlock)aBlock;
/**
* Enumerate all indices in the set by applying a block to them.
*/
- (void)enumerateIndexesUsingBlock: (GSIndexSetEnumerationBlock)aBlock;
- (void)enumerateIndexesWithOptions: (NSEnumerationOptions)opts
usingBlock: (GSIndexSetEnumerationBlock)aBlock;
#endif
/**
* Returns the first index value in the receiver or NSNotFound if the
* receiver is empty.
@ -222,7 +238,7 @@ extern "C" {
* anIndex.
*/
- (void) shiftIndexesStartingAtIndex: (NSUInteger)anIndex
by: (NSInteger)amount;
by: (NSInteger)amount;
@end