forked from paulfitz/daff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCellInfo.hx
134 lines (118 loc) · 3.03 KB
/
CellInfo.hx
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// -*- mode:java; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
#if !TOPLEVEL
package coopy;
#end
/**
*
* Interpretation of a cell in a diff, produced by `DiffRender.renderCell`.
* Useful for custom views of a diff.
*
*/
@:expose
class CellInfo {
/**
*
* The cell value "as is".
*
*/
public var raw : Dynamic;
/**
*
* The cell value in text form.
*
*/
public var value : String;
/**
*
* The cell value in text form, with some special characters rendered
* prettier (e.g. `->` is converted to an appropriate glyph, and
* certain spaces in diffs are converted to a visible space glyph)
*
*/
public var pretty_value : String;
/**
*
* The type of activity going on in the cell: "move", "add", "remove",
* "modify", "conflict", "header", "spec"
*
* + "move" means a row/column that has moved
* + "add" means a row/column that has been inserted
* + "remove" means a row/column that has been deleted
* + "modify" means a cell that has been changed
* + "conflict" means a cell that has been changed in a conflicting way
* + "header" means part of a row giving column names
* + "spec" means part of a row specifying column changes
*
*/
public var category : String;
/**
*
* The type of activity going on in the cell, based only on
* knowledge of what row it is in.
*
*/
public var category_given_tr : String;
/**
*
* Any separator found in the cell.
*
*/
public var separator : String;
/**
*
* Any separator found in the cell, made pretty using a glyph.
*
*/
public var pretty_separator : String;
/**
*
* True if there is an update in the cell, the cell contains
* two values, an `lvalue` (before) and an `rvalue` (after)
*
*/
public var updated : Bool;
/**
*
* True if there is a conflicting update in the cell, the cell
* contains three values, a `pvalue` (common ancestor/parent),
* an `lvalue` (local change) and an `rvalue` (remote change)
*
*/
public var conflicted : Bool;
/**
*
* Parent cell value if applicable.
*
*/
public var pvalue : String;
/**
*
* Local/reference cell value if applicable.
*
*/
public var lvalue : String;
/**
*
* Remote/changed cell value if applicable.
*
*/
public var rvalue : String;
/**
*
* If this is a change in a property of the table rather than
* the data in the table itself, this field names that property.
*
*/
public var meta : String;
public function new() : Void {}
/**
*
* Give a summary of the information contained for debugging purposes.
*
*/
public function toString() : String {
if (!updated) return value;
if (!conflicted) return lvalue + "::" + rvalue;
return pvalue + "||" + lvalue + "::" + rvalue;
}
}