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/MPRangePath.h
Kim Wittenburg 60760b8b3d Internal Redesign:
- Combined MPExpression and MPMutableExpression
- Abstracted children of MPExpression into MPExpressionElement protocol
- Abstracted most of MPExpressionLayout and MPFunctionLayout into common superclass MPLayout
2014-08-11 13:57:48 +02:00

52 lines
1.3 KiB
Objective-C

//
// MPRange.h
// MathPad
//
// Created by Kim Wittenburg on 18.04.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
@import Foundation;
#import "MPExpression.h"
@class MPRangePath, MPExpression;
@interface MPRangePath : NSObject <NSCopying, NSCoding>
#pragma mark Creation Methods
- (instancetype)init;
- (instancetype)initWithLocation:(NSIndexPath *)location
length:(NSUInteger)length;
- (instancetype)initWithRange:(NSRange)aRange;
+ (instancetype)emptyRangePath;
+ (instancetype)rangePathWithLocation:(NSIndexPath *)location
length:(NSUInteger)length;
+ (instancetype)rangePathWithRange:(NSRange)aRange;
#pragma mark Properties
@property (nonatomic, strong) NSIndexPath *location;
@property (nonatomic) NSUInteger length;
- (NSIndexPath *)maxRangePath;
- (NSRange)rangeAtLastIndex;
#pragma mark Working with Ranges
- (BOOL)containsRangePath:(MPRangePath *)aRangePath;
- (BOOL)containsLocation:(NSIndexPath *)location;
- (BOOL)isEqual:(id)object;
- (BOOL)isEqualToRangePath:(MPRangePath *)aRangePath;
@end
@interface MPExpression (MPRangeExtension)
- (MPExpression *)subexpressionWithRangePath:(MPRangePath *)aRangePath; // If location points to expression (in function) nil is returned
@end