/**
* This code is auto-generated; unless you know what you're doing, do not modify!
**/
#include
#include
#include
#include "git2.h"
#include "../include/functions/copy.h"
#include "../include/diff_file.h"
#include "../include/oid.h"
using namespace v8;
using namespace node;
GitDiffFile::GitDiffFile(git_diff_file *raw) {
this->raw = raw;
}
GitDiffFile::~GitDiffFile() {
free(this->raw);
}
void GitDiffFile::Initialize(Handle target) {
HandleScope scope;
Local tpl = FunctionTemplate::New(New);
tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(String::NewSymbol("DiffFile"));
NODE_SET_PROTOTYPE_METHOD(tpl, "oid", Oid);
NODE_SET_PROTOTYPE_METHOD(tpl, "path", Path);
NODE_SET_PROTOTYPE_METHOD(tpl, "size", Size);
NODE_SET_PROTOTYPE_METHOD(tpl, "flags", Flags);
NODE_SET_PROTOTYPE_METHOD(tpl, "mode", Mode);
constructor_template = Persistent::New(tpl->GetFunction());
target->Set(String::NewSymbol("DiffFile"), constructor_template);
}
Handle GitDiffFile::New(const Arguments& args) {
HandleScope scope;
if (args.Length() == 0 || !args[0]->IsExternal()) {
return ThrowException(Exception::Error(String::New("git_diff_file is required.")));
}
GitDiffFile* object = new GitDiffFile((git_diff_file *) External::Unwrap(args[0]));
object->Wrap(args.This());
return scope.Close(args.This());
}
Handle GitDiffFile::New(void *raw) {
HandleScope scope;
Handle argv[1] = { External::New((void *)raw) };
return scope.Close(GitDiffFile::constructor_template->NewInstance(1, argv));
}
git_diff_file *GitDiffFile::GetValue() {
return this->raw;
}
Handle GitDiffFile::Oid(const Arguments& args) {
HandleScope scope;
Handle to;
git_oid *oid =
&ObjectWrap::Unwrap(args.This())->GetValue()->oid;
if (oid != NULL) {
oid = (git_oid *)git_oid_dup(oid);
}
if (oid != NULL) {
to = GitOid::New((void *)oid);
} else {
to = Null();
}
return scope.Close(to);
}
Handle GitDiffFile::Path(const Arguments& args) {
HandleScope scope;
Handle to;
const char * path =
ObjectWrap::Unwrap(args.This())->GetValue()->path;
to = String::New(path);
return scope.Close(to);
}
Handle GitDiffFile::Size(const Arguments& args) {
HandleScope scope;
Handle to;
git_off_t size =
ObjectWrap::Unwrap(args.This())->GetValue()->size;
to = Integer::New(size);
return scope.Close(to);
}
Handle GitDiffFile::Flags(const Arguments& args) {
HandleScope scope;
Handle to;
uint32_t flags =
ObjectWrap::Unwrap(args.This())->GetValue()->flags;
to = Integer::New(flags);
return scope.Close(to);
}
Handle GitDiffFile::Mode(const Arguments& args) {
HandleScope scope;
Handle to;
uint16_t mode =
ObjectWrap::Unwrap(args.This())->GetValue()->mode;
to = Integer::New(mode);
return scope.Close(to);
}
Persistent GitDiffFile::constructor_template;