mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 13:07:02 +00:00
XcodeCapp 4.0 is a major release of our beloved tool. In a nutshell it: - allows to manage multiple projects simultaneously - allows to follow operations and cancel them - has a per project Error and Warning reporting - supports capp_env as you can define additional paths and objj include path per project - much more things
44 lines
947 B
Objective-C
44 lines
947 B
Objective-C
//
|
|
// NSMutableArray+moveIndexes.m
|
|
// XcodeCapp
|
|
//
|
|
// Created by Antoine Mercadal on 6/2/15.
|
|
// Copyright (c) 2015 cappuccino-project. All rights reserved.
|
|
//
|
|
|
|
#import "NSMutableArray+moveIndexes.h"
|
|
|
|
@implementation NSMutableArray (MoveIndexes)
|
|
|
|
- (void)moveIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)insertIndex
|
|
{
|
|
NSUInteger aboveCount = 0;
|
|
id object;
|
|
NSUInteger removeIndex;
|
|
|
|
NSUInteger index = [indexes lastIndex];
|
|
|
|
while (index != NSNotFound)
|
|
{
|
|
if (index >= insertIndex)
|
|
{
|
|
removeIndex = index + aboveCount;
|
|
aboveCount ++;
|
|
}
|
|
else
|
|
{
|
|
removeIndex = index;
|
|
insertIndex --;
|
|
}
|
|
|
|
object = self[removeIndex];
|
|
|
|
[self removeObjectAtIndex:removeIndex];
|
|
[self insertObject:object atIndex:insertIndex];
|
|
|
|
index = [indexes indexLessThanIndex:index];
|
|
}
|
|
}
|
|
|
|
@end
|