Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: binding.gyp coffee/gitteh.coffee src/gitteh.cc src/repository.cc
- Loading branch information
Showing
7 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "index.h" | ||
|
||
namespace gitteh { | ||
static Persistent<String> class_symbol; | ||
|
||
Persistent<FunctionTemplate> Index::constructor_template; | ||
|
||
Index::Index(git_index *index) : index_(index) { | ||
|
||
} | ||
|
||
Index::~Index() { | ||
|
||
} | ||
|
||
void Index::Init(Handle<Object> module) { | ||
HandleScope scope; | ||
|
||
class_symbol = NODE_PSYMBOL("NativeIndex"); | ||
|
||
Local<FunctionTemplate> t = FunctionTemplate::New(New); | ||
constructor_template = Persistent<FunctionTemplate>::New(t); | ||
constructor_template->SetClassName(class_symbol); | ||
t->InstanceTemplate()->SetInternalFieldCount(1); | ||
|
||
module->Set(class_symbol, constructor_template->GetFunction()); | ||
} | ||
|
||
Handle<Value> Index::New(const Arguments &args) { | ||
HandleScope scope; | ||
REQ_EXT_ARG(0, indexArg); | ||
Handle<Object> me = args.This(); | ||
|
||
git_index *rawIndex = static_cast<git_index*>(indexArg->Value()); | ||
Index *index = new Index(rawIndex); | ||
index->Wrap(me); | ||
|
||
return scope.Close(me); | ||
} | ||
}; // namespace gitteh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef GITTEH_INDEX_H | ||
#define GITTEH_INDEX_H | ||
|
||
#include "gitteh.h" | ||
|
||
namespace gitteh { | ||
class IndexBaton; | ||
class Index : public ObjectWrap { | ||
public: | ||
static Persistent<FunctionTemplate> constructor_template; | ||
|
||
friend class IndexBaton; | ||
|
||
Index(git_index*); | ||
~Index(); | ||
static void Init(Handle<Object>); | ||
protected: | ||
static Handle<Value> New(const Arguments&); | ||
private: | ||
git_index *index_; | ||
}; | ||
|
||
} // namespace gitteh | ||
|
||
#endif // GITTEH_INDEX_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters