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

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


#include "../include/functions/copy.h"
#include "../include/macros.h"
#include "../include/transfer_progress.h"

 
#include <iostream>

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

  GitTransferProgress::GitTransferProgress(git_transfer_progress *raw, bool selfFreeing) {
    this->raw = raw;
    this->selfFreeing = selfFreeing;
  }

  GitTransferProgress::~GitTransferProgress() {
   }

  void GitTransferProgress::InitializeComponent(Handle<v8::Object> target) {
    NanScope();

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

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

         NODE_SET_PROTOTYPE_METHOD(tpl, "totalObjects", TotalObjects);
         NODE_SET_PROTOTYPE_METHOD(tpl, "indexedObjects", IndexedObjects);
         NODE_SET_PROTOTYPE_METHOD(tpl, "receivedObjects", ReceivedObjects);
         NODE_SET_PROTOTYPE_METHOD(tpl, "localObjects", LocalObjects);
         NODE_SET_PROTOTYPE_METHOD(tpl, "totalDeltas", TotalDeltas);
         NODE_SET_PROTOTYPE_METHOD(tpl, "indexedDeltas", IndexedDeltas);
         NODE_SET_PROTOTYPE_METHOD(tpl, "receivedBytes", ReceivedBytes);
  
    Local<Function> _constructor_template = tpl->GetFunction();
    NanAssignPersistent(constructor_template, _constructor_template);
    target->Set(NanNew<String>("TransferProgress"), _constructor_template);
  }

  NAN_METHOD(GitTransferProgress::JSNewFunction) {
    NanScope();

    if (args.Length() == 0 || !args[0]->IsExternal()) {
         return NanThrowError("A new GitTransferProgress cannot be instantiated.");
     }

    GitTransferProgress* object = new GitTransferProgress(static_cast<git_transfer_progress *>(Handle<External>::Cast(args[0])->Value()), args[1]->BooleanValue());
    object->Wrap(args.This());

    NanReturnValue(args.This());
  }

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

  git_transfer_progress *GitTransferProgress::GetValue() {
    return this->raw;
  }

  git_transfer_progress **GitTransferProgress::GetRefValue() {
    return &this->raw;
  }

      NAN_METHOD(GitTransferProgress::TotalObjects) {
      NanScope();
      Handle<Value> to;

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

// start convert_to_v8 block
     to = NanNew<Number>(total_objects);
  // end convert_to_v8 block
      NanReturnValue(to);
    }
     NAN_METHOD(GitTransferProgress::IndexedObjects) {
      NanScope();
      Handle<Value> to;

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

// start convert_to_v8 block
     to = NanNew<Number>(indexed_objects);
  // end convert_to_v8 block
      NanReturnValue(to);
    }
     NAN_METHOD(GitTransferProgress::ReceivedObjects) {
      NanScope();
      Handle<Value> to;

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

// start convert_to_v8 block
     to = NanNew<Number>(received_objects);
  // end convert_to_v8 block
      NanReturnValue(to);
    }
     NAN_METHOD(GitTransferProgress::LocalObjects) {
      NanScope();
      Handle<Value> to;

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

// start convert_to_v8 block
     to = NanNew<Number>(local_objects);
  // end convert_to_v8 block
      NanReturnValue(to);
    }
     NAN_METHOD(GitTransferProgress::TotalDeltas) {
      NanScope();
      Handle<Value> to;

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

// start convert_to_v8 block
     to = NanNew<Number>(total_deltas);
  // end convert_to_v8 block
      NanReturnValue(to);
    }
     NAN_METHOD(GitTransferProgress::IndexedDeltas) {
      NanScope();
      Handle<Value> to;

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

// start convert_to_v8 block
     to = NanNew<Number>(indexed_deltas);
  // end convert_to_v8 block
      NanReturnValue(to);
    }
     NAN_METHOD(GitTransferProgress::ReceivedBytes) {
      NanScope();
      Handle<Value> to;

      size_t  received_bytes =
 ObjectWrap::Unwrap<GitTransferProgress>(args.This())->GetValue()->received_bytes;

// start convert_to_v8 block
     to = NanNew<Number>(received_bytes);
  // end convert_to_v8 block
      NanReturnValue(to);
    }
    Persistent<Function> GitTransferProgress::constructor_template;
 