// This is a generated file, modify: generate/templates/templates/class_content.cc

#include <nan.h>
#include <string.h>

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

#include "../include/nodegit.h"
#include "../include/lock_master.h"
#include "../include/functions/copy.h"
#include "../include/diff_line.h"
#include "nodegit_wrapper.cc"

 
#include <iostream>

using namespace std;
using namespace v8;
using namespace node;

  GitDiffLine::~GitDiffLine() {
    // this will cause an error if you have a non-self-freeing object that also needs
    // to save values. Since the object that will eventually free the object has no
    // way of knowing to free these values.
   }

  void GitDiffLine::InitializeComponent(v8::Local<v8::Object> target, nodegit::Context *nodegitContext) {
    Nan::HandleScope scope;

    v8::Local<v8::External> nodegitExternal = Nan::New<v8::External>(nodegitContext);
    v8::Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(JSNewFunction, nodegitExternal);

    tpl->InstanceTemplate()->SetInternalFieldCount(1);
    tpl->SetClassName(Nan::New("DiffLine").ToLocalChecked());

         Nan::SetPrototypeMethod(tpl, "origin", Origin, nodegitExternal);
         Nan::SetPrototypeMethod(tpl, "oldLineno", OldLineno, nodegitExternal);
         Nan::SetPrototypeMethod(tpl, "newLineno", NewLineno, nodegitExternal);
         Nan::SetPrototypeMethod(tpl, "numLines", NumLines, nodegitExternal);
         Nan::SetPrototypeMethod(tpl, "contentLen", ContentLen, nodegitExternal);
         Nan::SetPrototypeMethod(tpl, "contentOffset", ContentOffset, nodegitExternal);
         Nan::SetPrototypeMethod(tpl, "content", Content, nodegitExternal);
  
    InitializeTemplate(tpl);

    v8::Local<Function> constructor_template = Nan::GetFunction(tpl).ToLocalChecked();
    nodegitContext->SaveToPersistent("GitDiffLine::Template", constructor_template);
    Nan::Set(target, Nan::New("DiffLine").ToLocalChecked(), constructor_template);
  }

      // start field block
    NAN_METHOD(GitDiffLine::Origin) {
      v8::Local<v8::Value> to;

            int
           origin =
          Nan::ObjectWrap::Unwrap<GitDiffLine>(info.This())->GetValue()->origin;
 // start convert_to_v8 block
     to = Nan::New<Number>( origin);
  // end convert_to_v8 block
      info.GetReturnValue().Set(to);
    }
    // end field block
     // start field block
    NAN_METHOD(GitDiffLine::OldLineno) {
      v8::Local<v8::Value> to;

            int
           old_lineno =
          Nan::ObjectWrap::Unwrap<GitDiffLine>(info.This())->GetValue()->old_lineno;
 // start convert_to_v8 block
     to = Nan::New<Number>( old_lineno);
  // end convert_to_v8 block
      info.GetReturnValue().Set(to);
    }
    // end field block
     // start field block
    NAN_METHOD(GitDiffLine::NewLineno) {
      v8::Local<v8::Value> to;

            int
           new_lineno =
          Nan::ObjectWrap::Unwrap<GitDiffLine>(info.This())->GetValue()->new_lineno;
 // start convert_to_v8 block
     to = Nan::New<Number>( new_lineno);
  // end convert_to_v8 block
      info.GetReturnValue().Set(to);
    }
    // end field block
     // start field block
    NAN_METHOD(GitDiffLine::NumLines) {
      v8::Local<v8::Value> to;

            int
           num_lines =
          Nan::ObjectWrap::Unwrap<GitDiffLine>(info.This())->GetValue()->num_lines;
 // start convert_to_v8 block
     to = Nan::New<Number>( num_lines);
  // end convert_to_v8 block
      info.GetReturnValue().Set(to);
    }
    // end field block
     // start field block
    NAN_METHOD(GitDiffLine::ContentLen) {
      v8::Local<v8::Value> to;

            size_t
           content_len =
          Nan::ObjectWrap::Unwrap<GitDiffLine>(info.This())->GetValue()->content_len;
 // start convert_to_v8 block
     to = Nan::New<Number>( content_len);
  // end convert_to_v8 block
      info.GetReturnValue().Set(to);
    }
    // end field block
     // start field block
    NAN_METHOD(GitDiffLine::ContentOffset) {
      v8::Local<v8::Value> to;

            git_off_t
           content_offset =
          Nan::ObjectWrap::Unwrap<GitDiffLine>(info.This())->GetValue()->content_offset;
 // start convert_to_v8 block
     to = Nan::New<Number>( content_offset);
  // end convert_to_v8 block
      info.GetReturnValue().Set(to);
    }
    // end field block
     // start field block
    NAN_METHOD(GitDiffLine::Content) {
      v8::Local<v8::Value> to;

            const char *
           content =
          Nan::ObjectWrap::Unwrap<GitDiffLine>(info.This())->GetValue()->content;
 // start convert_to_v8 block
  if (content){
       to = Nan::New<v8::String>(content).ToLocalChecked();
   }
  else {
    to = Nan::Null();
  }

  // end convert_to_v8 block
      info.GetReturnValue().Set(to);
    }
    // end field block
  // force base class template instantiation, to make sure we get all the
// methods, statics, etc.
template class NodeGitWrapper<GitDiffLineTraits>;
 