|
1 | 1 | /** |
2 | | - * Copyright (c) 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com> |
3 | | - * @author Michael Robinson @codeofinterest <mike@pagesofinterest.net> |
4 | | - * |
5 | | - * Dual licensed under the MIT and GPL licenses. |
6 | | - */ |
| 2 | + * This code is auto-generated; unless you know what you're doing, do not modify! |
| 3 | + **/ |
7 | 4 |
|
8 | | -#ifndef BLOB_H |
9 | | -#define BLOB_H |
| 5 | +#ifndef GITBLOB_H |
| 6 | +#define GITBLOB_H |
10 | 7 |
|
11 | 8 | #include <v8.h> |
12 | 9 | #include <node.h> |
13 | | -#include <string.h> |
| 10 | +#include <string> |
14 | 11 |
|
15 | 12 | #include "git2.h" |
16 | 13 |
|
17 | | -#include "repo.h" |
18 | | -#include "oid.h" |
19 | | - |
20 | | -using namespace v8; |
21 | 14 | using namespace node; |
| 15 | +using namespace v8; |
22 | 16 |
|
23 | | -/** |
24 | | - * Wrapper for libgit2 git_blob. |
25 | | - */ |
26 | 17 | class GitBlob : public ObjectWrap { |
27 | 18 | public: |
28 | 19 |
|
29 | 20 | static Persistent<Function> constructor_template; |
| 21 | + static void Initialize (Handle<v8::Object> target); |
30 | 22 |
|
31 | | - static void Initialize(Handle<Object> target); |
32 | | - |
33 | | - git_blob* GetValue(); |
34 | | - void SetValue(git_blob* blob); |
| 23 | + git_blob *GetValue(); |
35 | 24 |
|
36 | | - protected: |
37 | | - GitBlob() {}; |
38 | | - ~GitBlob() {}; |
| 25 | + private: |
| 26 | + GitBlob(git_blob *raw); |
| 27 | + ~GitBlob(); |
39 | 28 |
|
40 | 29 | static Handle<Value> New(const Arguments& args); |
41 | | - static Handle<Value> Free(const Arguments& args); |
42 | 30 |
|
43 | 31 | static Handle<Value> Lookup(const Arguments& args); |
44 | 32 | static void LookupWork(uv_work_t* req); |
45 | 33 | static void LookupAfterWork(uv_work_t* req); |
46 | 34 |
|
47 | | - static Handle<Value> RawContent(const Arguments& args); |
48 | | - static void RawContentWork(uv_work_t* req); |
49 | | - static void RawContentAfterWork(uv_work_t* req); |
50 | | - |
| 35 | + struct LookupBaton { |
| 36 | + uv_work_t request; |
| 37 | + const git_error* error; |
| 38 | + git_blob *out; |
| 39 | + git_repository * repo; |
| 40 | + const git_oid * id; |
| 41 | + Persistent<Function> callback; |
| 42 | + }; |
| 43 | + static Handle<Value> Oid(const Arguments& args); |
| 44 | + static Handle<Value> Content(const Arguments& args); |
| 45 | + static Handle<Value> Size(const Arguments& args); |
51 | 46 | static Handle<Value> CreateFromFile(const Arguments& args); |
52 | 47 | static void CreateFromFileWork(uv_work_t* req); |
53 | 48 | static void CreateFromFileAfterWork(uv_work_t* req); |
54 | 49 |
|
| 50 | + struct CreateFromFileBaton { |
| 51 | + uv_work_t request; |
| 52 | + const git_error* error; |
| 53 | + git_oid * id; |
| 54 | + git_repository * repo; |
| 55 | + const char * path; |
| 56 | + Persistent<Function> callback; |
| 57 | + }; |
55 | 58 | static Handle<Value> CreateFromBuffer(const Arguments& args); |
56 | 59 | static void CreateFromBufferWork(uv_work_t* req); |
57 | 60 | static void CreateFromBufferAfterWork(uv_work_t* req); |
58 | 61 |
|
59 | | - private: |
60 | | - |
61 | | - git_blob* blob; |
62 | | - |
63 | | - struct LookupBaton { |
| 62 | + struct CreateFromBufferBaton { |
64 | 63 | uv_work_t request; |
65 | 64 | const git_error* error; |
66 | | - |
67 | | - GitBlob* blob; |
68 | | - git_blob* rawBlob; |
69 | | - git_repository* rawRepo; |
70 | | - git_oid rawOid; |
71 | | - |
| 65 | + git_oid * oid; |
| 66 | + git_repository * repo; |
| 67 | + const void * buffer; |
| 68 | + size_t len; |
72 | 69 | Persistent<Function> callback; |
73 | 70 | }; |
74 | | - |
75 | | - struct RawContentBaton { |
76 | | - uv_work_t request; |
77 | | - |
78 | | - GitBlob* blob; |
79 | | - git_blob* rawBlob; |
80 | | - std::string rawContent; |
81 | | - int rawSize; |
82 | | - |
83 | | - Persistent<Function> callback; |
84 | | - }; |
85 | | - |
86 | | - struct CreateFromFileBaton { |
87 | | - uv_work_t request; |
88 | | - const git_error* error; |
89 | | - |
90 | | - GitBlob* blob; |
91 | | - git_blob* rawBlob; |
92 | | - git_repository* rawRepo; |
93 | | - std::string path; |
94 | | - |
95 | | - Persistent<Function> callback; |
96 | | - }; |
97 | | - |
98 | | - struct CreateFromBufferBaton { |
99 | | - uv_work_t request; |
100 | | - const git_error* error; |
101 | | - |
102 | | - GitBlob* blob; |
103 | | - git_blob* rawBlob; |
104 | | - git_repository* rawRepo; |
105 | | - const void* data; |
106 | | - size_t dataLength; |
107 | | - |
108 | | - Persistent<Function> callback; |
109 | | - }; |
| 71 | + static Handle<Value> IsBinary(const Arguments& args); |
| 72 | + git_blob *raw; |
110 | 73 | }; |
111 | 74 |
|
112 | 75 | #endif |
0 commit comments