-
Notifications
You must be signed in to change notification settings - Fork 284
Expand file tree
/
Copy pathGTDiffLine.h
More file actions
59 lines (46 loc) · 1.72 KB
/
GTDiffLine.h
File metadata and controls
59 lines (46 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// GTDiffLine.h
// ObjectiveGitFramework
//
// Created by Danny Greg on 20/12/2012.
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <git2/diff.h>
/// A character representing the origin of a given line.
///
/// See diff.h for individual documentation.
typedef NS_ENUM(char, GTDiffLineOrigin) {
GTDiffLineOriginContext = GIT_DIFF_LINE_CONTEXT,
GTDiffLineOriginAddition = GIT_DIFF_LINE_ADDITION,
GTDiffLineOriginDeletion = GIT_DIFF_LINE_DELETION,
GTDiffLineOriginNoEOFNewlineContext = GIT_DIFF_LINE_CONTEXT_EOFNL,
GTDiffLineOriginAddEOFNewLine = GIT_DIFF_LINE_ADD_EOFNL,
GTDiffLineOriginDeleteEOFNewLine = GIT_DIFF_LINE_DEL_EOFNL,
};
NS_ASSUME_NONNULL_BEGIN
/// Represents an individual line in a diff hunk.
@interface GTDiffLine : NSObject
/// The content string of the line.
@property (nonatomic, readonly, copy) NSString *content;
/// The line number of this line in the left side of the diff.
///
/// -1 if the line is an addition.
@property (nonatomic, readonly) NSInteger oldLineNumber;
/// The line number of this line in the right side of the diff.
///
/// -1 if the line is a deletion.
@property (nonatomic, readonly) NSInteger newLineNumber;
/// The origin of the line, see the enum above for possible values.
@property (nonatomic, readonly) GTDiffLineOrigin origin;
/// The number of newlines appearing in `-content`.
@property (nonatomic, readonly) NSInteger lineCount;
- (instancetype)init NS_UNAVAILABLE;
/// Designated initialiser.
///
/// line - The diff line to wrap. May not be NULL.
///
/// Returns a diff line, or nil if an error occurs.
- (nullable instancetype)initWithGitLine:(const git_diff_line *)line NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END