FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/src/diff_range.cc at master · JohnnySheffield/nodegit · GitHub
JohnnySheffield
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
src
/
diff_range.cc
Copy path
More file actions
More file actions
Latest commit
History
History
History
112 lines (82 loc) · 2.65 KB
Breadcrumbs
nodegit
/
src
/
diff_range.cc
Copy path
File metadata and controls
112 lines (82 loc) · 2.65 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*
*
* This code is auto-generated; unless you know what you're doing, do not modify!
*
*/
#
include
<
v8.h
>
#
include
<
node.h
>
#
include
<
string.h
>
#
include
"
git2.h
"
#
include
"
../include/functions/copy.h
"
#
include
"
../include/diff_range.h
"
using
namespace
v8
;
using
namespace
node
;
GitDiffRange::GitDiffRange
(git_diff_range *raw) {
this
->
raw
= raw;
}
GitDiffRange::~GitDiffRange
() {
free
(
this
->
raw
);
}
void
GitDiffRange::Initialize
(Handle<v8::Object> target) {
NanScope
();
Local<FunctionTemplate> tpl =
FunctionTemplate::New
(New);
tpl->
InstanceTemplate
()->
SetInternalFieldCount
(
1
);
tpl->
SetClassName
(
NanSymbol
(
"
DiffRange
"
));
NODE_SET_PROTOTYPE_METHOD
(tpl,
"
oldStart
"
, OldStart);
NODE_SET_PROTOTYPE_METHOD
(tpl,
"
oldLines
"
, OldLines);
NODE_SET_PROTOTYPE_METHOD
(tpl,
"
newStart
"
, NewStart);
NODE_SET_PROTOTYPE_METHOD
(tpl,
"
newLines
"
, NewLines);
NanAssignPersistent
(FunctionTemplate, constructor_template, tpl);
target->
Set
(
String::NewSymbol
(
"
DiffRange
"
), tpl->
GetFunction
());
}
NAN_METHOD
(GitDiffRange::New) {
NanScope
();
if
(args.
Length
() ==
0
|| !args[
0
]->
IsExternal
()) {
return
NanThrowError
(
String::New
(
"
git_diff_range is required.
"
));
}
GitDiffRange* object =
new
GitDiffRange
((git_diff_range *)
External::Cast
(*args[
0
])->
Value
());
object->
Wrap
(args.
This
());
NanReturnValue
(args.
This
());
}
Handle<Value>
GitDiffRange::New
(
void
*raw) {
NanScope
();
Handle<Value> argv[
1
] = {
External::New
((
void
*)raw) };
Local<Object> instance;
Local<FunctionTemplate> constructorHandle =
NanPersistentToLocal
(constructor_template);
instance = constructorHandle->
GetFunction
()->
NewInstance
(
1
, argv);
return
scope.
Close
(instance);
}
git_diff_range *
GitDiffRange::GetValue
() {
return
this
->
raw
;
}
NAN_METHOD
(GitDiffRange::OldStart) {
NanScope
();
Handle<Value> to;
int
old_start =
ObjectWrap::Unwrap<GitDiffRange>(args.
This
())->
GetValue
()->
old_start
;
to =
Integer::New
(old_start);
NanReturnValue
(to);
}
NAN_METHOD
(GitDiffRange::OldLines) {
NanScope
();
Handle<Value> to;
int
old_lines =
ObjectWrap::Unwrap<GitDiffRange>(args.
This
())->
GetValue
()->
old_lines
;
to =
Integer::New
(old_lines);
NanReturnValue
(to);
}
NAN_METHOD
(GitDiffRange::NewStart) {
NanScope
();
Handle<Value> to;
int
new_start =
ObjectWrap::Unwrap<GitDiffRange>(args.
This
())->
GetValue
()->
new_start
;
to =
Integer::New
(new_start);
NanReturnValue
(to);
}
NAN_METHOD
(GitDiffRange::NewLines) {
NanScope
();
Handle<Value> to;
int
new_lines =
ObjectWrap::Unwrap<GitDiffRange>(args.
This
())->
GetValue
()->
new_lines
;
to =
Integer::New
(new_lines);
NanReturnValue
(to);
}
Persistent<FunctionTemplate> GitDiffRange::constructor_template;
Back
|
FazBrowse Home
|
New Git URL