Archived
1
This repository has been archived on 2022-08-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mathpad/MathPad/NSIndexPath+MPAdditions.h
2014-09-08 22:43:20 +02:00

44 lines
1.6 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// NSIndexPath+MPRemoveFirstIndex.h
// MathPad
//
// Created by Kim Wittenburg on 23.04.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
@interface NSIndexPath (MPAdditions)
- (NSUInteger)firstIndex;
- (NSUInteger)lastIndex;
- (NSIndexPath *)indexPathByReplacingLastIndexWithIndex:(NSUInteger)index;
/*!
@method indexPathByRemovingFirstIndex
@brief Provides an index path with the indexes in the receiving index path, excluding the first one.
@discussion Returns an empty NSIndexPath instance if the receiving index paths length is 1 or less.
@return A new index path with the receiving index paths indexes, excluding the first one.
*/
- (NSIndexPath *)indexPathByRemovingFirstIndex;
/*!
@method indexPathByPreceedingIndex:
@brief Provides an index path with the given index followed by the indexes of the receiver.
@discussion If the receiver does not contain any indexes the given index is the only index contained in the returned index path.
@param index The index new index preceeding all others
@return A new index path with all the receiver's indexes preceeded by @c index.
*/
- (NSIndexPath *)indexPathByPreceedingIndex:(NSUInteger)index;
- (NSIndexPath *)indexPathByIncrementingLastIndex;
- (NSIndexPath *)indexPathByDecrementingLastIndex;
- (NSIndexPath *)indexPathByRemovingIndexesFrom:(NSUInteger)length; // use length indexes from the receiver, exception if too much
- (NSIndexPath *)indexPathByRemovingIndexesTo:(NSUInteger)length; // number of indexes from the beginning to exclude
- (NSIndexPath *)commonIndexPathWith:(NSIndexPath *)indexPath;
@end