[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/nodegit/nodegit/v0.1.4/src/diff_range.cc [Back]  [Original]

/**
 * This code is auto-generated; unless you know what you're doing, do not modify!
 **/
#include 
#include 

#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 target) {
  NanScope();

  Local tpl = NanNew(New);

  tpl->InstanceTemplate()->SetInternalFieldCount(1);
  tpl->SetClassName(NanNew("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);

  Local _constructor_template = tpl->GetFunction();
  NanAssignPersistent(constructor_template, _constructor_template);
  target->Set(NanNew("DiffRange"), _constructor_template);
}

NAN_METHOD(GitDiffRange::New) {
  NanScope();

  if (args.Length() == 0 || !args[0]->IsExternal()) {
    return NanThrowError("git_diff_range is required.");
  }
  GitDiffRange* object = new GitDiffRange(static_cast(Handle::Cast(args[0])->Value()));
  object->Wrap(args.This());

  NanReturnValue(args.This());
}

Handle GitDiffRange::New(void *raw) {
  NanEscapableScope();
  Handle argv[1] = { NanNew((void *)raw) };
  return NanEscapeScope(NanNew(GitDiffRange::constructor_template)->NewInstance(1, argv));
}

git_diff_range *GitDiffRange::GetValue() {
  return this->raw;
}


NAN_METHOD(GitDiffRange::OldStart) {
  NanScope();
    Handle to;

  int old_start =
    ObjectWrap::Unwrap(args.This())->GetValue()->old_start;

    to = NanNew(old_start);
  NanReturnValue(to);
}

NAN_METHOD(GitDiffRange::OldLines) {
  NanScope();
    Handle to;

  int old_lines =
    ObjectWrap::Unwrap(args.This())->GetValue()->old_lines;

    to = NanNew(old_lines);
  NanReturnValue(to);
}

NAN_METHOD(GitDiffRange::NewStart) {
  NanScope();
    Handle to;

  int new_start =
    ObjectWrap::Unwrap(args.This())->GetValue()->new_start;

    to = NanNew(new_start);
  NanReturnValue(to);
}

NAN_METHOD(GitDiffRange::NewLines) {
  NanScope();
    Handle to;

  int new_lines =
    ObjectWrap::Unwrap(args.This())->GetValue()->new_lines;

    to = NanNew(new_lines);
  NanReturnValue(to);
}

Persistent GitDiffRange::constructor_template;

Web Proxy Viewer  |  New URL  |  Original Page