2006-02-12 19:02:58 +00:00
|
|
|
/** Interface for NSIndexPath for GNUStep
|
|
|
|
Copyright (C) 2006 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
|
|
|
Created: Feb 2006
|
|
|
|
|
|
|
|
This file is part of the GNUstep Base Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-09-14 11:36:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2006-02-12 19:02:58 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-08 10:38:33 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2007-09-14 11:36:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2006-02-12 19:02:58 +00:00
|
|
|
License along with this library; if not, write to the Free
|
2006-10-31 07:05:46 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
AutogsdocSource: NSIndexPath.m
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NSIndexPath_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define _NSIndexPath_h_GNUSTEP_BASE_INCLUDE
|
2006-10-31 07:05:46 +00:00
|
|
|
#import <GNUstepBase/GSVersionMacros.h>
|
2006-02-12 19:02:58 +00:00
|
|
|
|
2006-10-31 07:05:46 +00:00
|
|
|
#import <Foundation/NSObject.h>
|
2006-02-12 19:02:58 +00:00
|
|
|
|
2006-09-13 10:20:49 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-09-12 07:37:00 +00:00
|
|
|
#if OS_API_VERSION(100400,GS_API_LATEST) && GS_API_VERSION( 10200,GS_API_LATEST)
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instances of this class represent a series of indexes into a hierarchy
|
|
|
|
* of arrays.<br />
|
|
|
|
* Each instance is a unique shared object.
|
|
|
|
*/
|
|
|
|
@interface NSIndexPath : NSObject <NSCopying, NSCoding>
|
|
|
|
{
|
2010-02-14 10:48:10 +00:00
|
|
|
#if GS_EXPOSE(NSIndexPath)
|
|
|
|
@private
|
2009-02-23 20:42:32 +00:00
|
|
|
NSUInteger _hash;
|
|
|
|
NSUInteger _length;
|
|
|
|
NSUInteger *_indexes;
|
2010-03-02 09:51:12 +00:00
|
|
|
#endif
|
2011-02-14 06:37:45 +00:00
|
|
|
#if !GS_NONFRAGILE
|
|
|
|
/* Pointer to private additional data used to avoid breaking ABI
|
|
|
|
* when we don't have the non-fragile ABI available.
|
|
|
|
*/
|
|
|
|
void *_reserved;
|
|
|
|
#endif
|
2006-02-12 19:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a path containing the single value anIndex.
|
|
|
|
*/
|
2009-02-23 20:42:32 +00:00
|
|
|
+ (id) indexPathWithIndex: (NSUInteger)anIndex;
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a path containing all the indexes in the supplied array.
|
|
|
|
*/
|
2009-02-23 20:42:32 +00:00
|
|
|
+ (id) indexPathWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length;
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Compares other with the receiver.<br />
|
|
|
|
* Returns NSOrderedSame if the two are identical.<br />
|
|
|
|
* Returns NSOrderedAscending if other is less than the receiver in a
|
|
|
|
* depth-wise comparison.<br />
|
|
|
|
* Returns NSOrderedDescending otherwise.
|
|
|
|
*/
|
|
|
|
- (NSComparisonResult) compare: (NSIndexPath*)other;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies all index values from the receiver into aBuffer.
|
|
|
|
*/
|
2009-02-23 20:42:32 +00:00
|
|
|
- (void) getIndexes: (NSUInteger*)aBuffer;
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
/**
|
2006-08-13 09:17:53 +00:00
|
|
|
* Return the index at the specified position or NSNotFound if there
|
|
|
|
* is no index at the specified position.
|
2006-02-12 19:02:58 +00:00
|
|
|
*/
|
2009-02-23 20:42:32 +00:00
|
|
|
- (NSUInteger) indexAtPosition: (NSUInteger)position;
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return path formed by adding anIndex to the receiver.
|
|
|
|
*/
|
2009-02-23 20:42:32 +00:00
|
|
|
- (NSIndexPath *) indexPathByAddingIndex: (NSUInteger)anIndex;
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return path formed by removing the last index from the receiver.
|
|
|
|
*/
|
|
|
|
- (NSIndexPath *) indexPathByRemovingLastIndex;
|
|
|
|
|
|
|
|
/** <init />
|
|
|
|
* Returns the shared instance containing the specified index, creating it
|
|
|
|
* and destroying the receiver if necessary.
|
|
|
|
*/
|
2009-02-23 20:42:32 +00:00
|
|
|
- (id) initWithIndex: (NSUInteger)anIndex;
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
/** <init />
|
|
|
|
* Returns the shared instance containing the specified index array,
|
|
|
|
* creating it and destroying the receiver if necessary.
|
|
|
|
*/
|
2009-02-23 20:42:32 +00:00
|
|
|
- (id) initWithIndexes: (NSUInteger*)indexes length: (NSUInteger)length;
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the number of index values present in the receiver.
|
|
|
|
*/
|
2009-02-23 20:42:32 +00:00
|
|
|
- (NSUInteger) length;
|
2006-02-12 19:02:58 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2006-09-13 10:20:49 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-02-12 19:02:58 +00:00
|
|
|
#endif
|