// This is a generated file, modify: generate/templates/class.cc.
#include <nan.h>
#include <string.h>

extern "C" {
#include <git2.h>
}

#include "../include/functions/copy.h"
#include "../include/diff_options.h"

#include "../include/diff.h"
#include "../include/types.h"

using namespace v8;
using namespace node;

GitDiffOptions::GitDiffOptions(git_diff_options *raw) {
  this->raw = raw;
}

GitDiffOptions::~GitDiffOptions() {
  }

void GitDiffOptions::Initialize(Handle<v8::Object> target) {
  NanScope();

  Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);

  tpl->InstanceTemplate()->SetInternalFieldCount(1);
  tpl->SetClassName(NanNew<String>("DiffOptions"));

  
        NODE_SET_PROTOTYPE_METHOD(tpl, "version", Version);
            NODE_SET_PROTOTYPE_METHOD(tpl, "flags", Flags);
            NODE_SET_PROTOTYPE_METHOD(tpl, "ignoreSubmodules", IgnoreSubmodules);
            NODE_SET_PROTOTYPE_METHOD(tpl, "contextLines", ContextLines);
            NODE_SET_PROTOTYPE_METHOD(tpl, "interhunkLines", InterhunkLines);
            NODE_SET_PROTOTYPE_METHOD(tpl, "maxSize", MaxSize);
            NODE_SET_PROTOTYPE_METHOD(tpl, "oldPrefix", OldPrefix);
            NODE_SET_PROTOTYPE_METHOD(tpl, "newPrefix", NewPrefix);
      
  Local<Function> _constructor_template = tpl->GetFunction();
  NanAssignPersistent(constructor_template, _constructor_template);
  target->Set(NanNew<String>("DiffOptions"), _constructor_template);
}

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

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

  NanReturnValue(args.This());
}

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

git_diff_options *GitDiffOptions::GetValue() {
  return this->raw;
}


  
NAN_METHOD(GitDiffOptions::Version) {
  NanScope();
  Handle<Value> to;

  unsigned int version =
    ObjectWrap::Unwrap<GitDiffOptions>(args.This())->GetValue()->version;

    to = NanNew<Number>(version);
    NanReturnValue(to);
}
    
NAN_METHOD(GitDiffOptions::Flags) {
  NanScope();
  Handle<Value> to;

  uint32_t flags =
    ObjectWrap::Unwrap<GitDiffOptions>(args.This())->GetValue()->flags;

    to = NanNew<Number>(flags);
    NanReturnValue(to);
}
    
NAN_METHOD(GitDiffOptions::IgnoreSubmodules) {
  NanScope();
  Handle<Value> to;

  git_submodule_ignore_t ignore_submodules =
    ObjectWrap::Unwrap<GitDiffOptions>(args.This())->GetValue()->ignore_submodules;

    to = NanNew<Number>(ignore_submodules);
    NanReturnValue(to);
}
    
NAN_METHOD(GitDiffOptions::ContextLines) {
  NanScope();
  Handle<Value> to;

  uint16_t context_lines =
    ObjectWrap::Unwrap<GitDiffOptions>(args.This())->GetValue()->context_lines;

    to = NanNew<Integer>(context_lines);
    NanReturnValue(to);
}
    
NAN_METHOD(GitDiffOptions::InterhunkLines) {
  NanScope();
  Handle<Value> to;

  uint16_t interhunk_lines =
    ObjectWrap::Unwrap<GitDiffOptions>(args.This())->GetValue()->interhunk_lines;

    to = NanNew<Integer>(interhunk_lines);
    NanReturnValue(to);
}
    
NAN_METHOD(GitDiffOptions::MaxSize) {
  NanScope();
  Handle<Value> to;

  git_off_t max_size =
    ObjectWrap::Unwrap<GitDiffOptions>(args.This())->GetValue()->max_size;

    to = NanNew<Number>(max_size);
    NanReturnValue(to);
}
    
NAN_METHOD(GitDiffOptions::OldPrefix) {
  NanScope();
  Handle<Value> to;

  const char * old_prefix =
    ObjectWrap::Unwrap<GitDiffOptions>(args.This())->GetValue()->old_prefix;

    to = NanNew<String>(old_prefix);
  
    NanReturnValue(to);
}
    
NAN_METHOD(GitDiffOptions::NewPrefix) {
  NanScope();
  Handle<Value> to;

  const char * new_prefix =
    ObjectWrap::Unwrap<GitDiffOptions>(args.This())->GetValue()->new_prefix;

    to = NanNew<String>(new_prefix);
  
    NanReturnValue(to);
}
  
Persistent<Function> GitDiffOptions::constructor_template;
