[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/nodegit/nodegit/v0.0.2/src/commit.h [Back]  [Original]

/*
Copyright (c) 2011, Tim Branyen @tbranyen 
*/

#ifndef COMMIT_H
#define COMMIT_H

#include 
#include 
#include 

#include "../vendor/libgit2/include/git2.h"

#include "reference.h"
#include "repo.h"
#include "oid.h"
#include "tree.h"

using namespace node;
using namespace v8;

/**
 * Class wrapper for libgit2 git_commit
 */
class Commit : public EventEmitter {
  public:
    /**
     * v8::FunctionTemplate used to create Node.js constructor
     */
    static Persistent constructor_template;

    /**
     * Used to intialize the EventEmitter from Node.js
     *
     * @param target v8::Object the Node.js module object
     */
    static void Initialize (Handle target);

    git_commit* GetValue();
    void SetValue(git_commit* commit);
    int Lookup(git_repository* repo, git_oid* oid);
    int New(git_repository *repo);
    const git_oid* Id();
    const char* MessageShort();
    const char* Message();
    time_t Time();
    int TimeOffset();
    const git_signature* Committer();
    const git_signature* Author();
    const git_tree* Tree();
    unsigned int ParentCount();
    git_commit* Parent(int pos);

  protected:
    Commit() {}
    ~Commit() {}

    static Handle New(const Arguments& args);

    static Handle Lookup(const Arguments& args);
    static int EIO_Lookup(eio_req *req);
    static int EIO_AfterLookup(eio_req *req);

    static Handle Id(const Arguments& args);
    static Handle MessageShort(const Arguments& args);
    static Handle Message(const Arguments& args);
    static Handle Time(const Arguments& args);
    static Handle TimeOffset(const Arguments& args);
    static Handle Committer(const Arguments& args);
    static Handle Author(const Arguments& args);

    static Handle Tree(const Arguments& args);
    static int EIO_Tree(eio_req* req);
    static int EIO_AfterTree(eio_req* req);

    static Handle ParentCount(const Arguments& args);
    static Handle Parent(const Arguments& args);

  private:
    git_commit *commit;

    struct lookup_request {
      Commit* commit;
      Repo* repo;
      Oid* oid;
      int err;
      Persistent callback;
    };

    //struct tree_request {
    //  Commit* commit;
    //  Tree* tree;
    //  Persistent callback;
    //};
};

#endif

Web Proxy Viewer  |  New URL  |  Original Page