OSDN Git Service

c4fbb300c421ce25f612079c914fa299fd33afcc
[tortoisegit/TortoiseGitJp.git] / ext / gitdll / gitdll.h
1 // The following ifdef block is the standard way of creating macros which make exporting \r
2 // from a DLL simpler. All files within this DLL are compiled with the GITDLL_EXPORTS\r
3 // symbol defined on the command line. this symbol should not be defined on any project\r
4 // that uses this DLL. This way any other project whose source files include this file see \r
5 // GITDLL_API functions as being imported from a DLL, whereas this DLL sees symbols\r
6 // defined with this macro as being exported.\r
7 #ifndef __GITDLL__\r
8 #define __GITDLL__\r
9 \r
10 #ifdef __cplusplus\r
11 #define EXTERN extern "C"\r
12 #else\r
13 #define EXTERN\r
14 #endif\r
15 \r
16 #ifdef GITDLL_EXPORTS\r
17 #define GITDLL_API EXTERN __declspec(dllexport) \r
18 #else\r
19 #define GITDLL_API EXTERN __declspec(dllimport) \r
20 #endif\r
21 \r
22 #if 0\r
23 // This class is exported from the gitdll.dll\r
24 class GITDLL_API Cgitdll {\r
25 public:\r
26         Cgitdll(void);\r
27         // TODO: add your methods here.\r
28 };\r
29 #endif\r
30 \r
31 #define GIT_HASH_SIZE 20\r
32 \r
33 typedef unsigned char GIT_HASH[GIT_HASH_SIZE];\r
34 \r
35 typedef unsigned int  GIT_HANDLE;\r
36 typedef unsigned int  GIT_LOG;\r
37 \r
38 typedef unsigned int GIT_DIFF;\r
39 typedef unsigned int GIT_FILE;\r
40 typedef unsigned int GIT_COMMIT_LIST;\r
41 \r
42 struct GIT_COMMIT_AUTHOR\r
43 {\r
44         char *Name;\r
45         int       NameSize;\r
46         char *Email;\r
47         int       EmailSize;\r
48         int       Date;\r
49         int   TimeZone;\r
50         \r
51 };\r
52 typedef struct GIT_COMMIT_DATA\r
53 {\r
54         GIT_HASH m_hash;\r
55         struct GIT_COMMIT_AUTHOR m_Author;\r
56         struct GIT_COMMIT_AUTHOR m_Committer;\r
57         char *   m_Subject;\r
58         int              m_SubjectSize;\r
59         char *   m_Body;\r
60         int              m_BodySize;\r
61         void *   m_pGitCommit; /** internal used */\r
62         char *   m_Encode;\r
63         int              m_EncodeSize;\r
64 \r
65 } GIT_COMMIT;\r
66 \r
67 \r
68 GITDLL_API int ngitdll;\r
69 \r
70 GITDLL_API int fngitdll(void);\r
71 /**\r
72  *      Get Git Last Error string. \r
73  */\r
74 GITDLL_API char * get_git_last_error();\r
75 /**\r
76  *      Get hash value. \r
77  *      @param  name    [IN] Reference name, such as HEAD, master, ...\r
78  *      @param  sha1    [OUT] char[20] hash value. Caller prepare char[20] buffer.\r
79  *      @return                 0       success. \r
80  */\r
81 GITDLL_API int git_get_sha1(const char *name, GIT_HASH sha1);\r
82 /**\r
83  *      Init git dll\r
84  *  @remark, this function must be call before other function. \r
85  *      @return                 0       success\r
86  */\r
87 GITDLL_API int git_init();\r
88 \r
89 GITDLL_API int git_open_log(GIT_LOG * handle, char * arg);\r
90 GITDLL_API int git_get_log_firstcommit(GIT_LOG handle);\r
91 GITDLL_API int git_get_log_estimate_commit_count(GIT_LOG handle);\r
92 \r
93 /**\r
94  *      Get Next Commit\r
95  *  @param handle       [IN]handle  Get handle from git_open_log\r
96  *      @param commit   [OUT]commit     Caller need prepare buffer for this call\r
97  *  @return                     0       success\r
98  *      @remark                 Caller need call git_free_commit to free internal buffer after use it;\r
99  */\r
100 GITDLL_API int git_get_log_nextcommit(GIT_LOG handle, GIT_COMMIT *commit);\r
101 \r
102 GITDLL_API int git_close_log(GIT_LOG handle);\r
103 \r
104 /**\r
105  *      Get Commit information from commit hash\r
106  *      @param  commit  [OUT] output commit information\r
107  *  @param      hash    [in] hash \r
108  *      @return         0       success\r
109  */\r
110 GITDLL_API int git_get_commit_from_hash(GIT_COMMIT *commit, GIT_HASH hash);\r
111 GITDLL_API int git_parse_commit(GIT_COMMIT *commit);\r
112 \r
113 GITDLL_API int git_get_commit_first_parent(GIT_COMMIT *commit,GIT_COMMIT_LIST *list);\r
114 GITDLL_API int git_get_commit_next_parent(GIT_COMMIT_LIST *list, GIT_HASH hash);\r
115 \r
116 GITDLL_API int git_free_commit(GIT_COMMIT *commit);\r
117 \r
118 GITDLL_API int git_open_diff(GIT_DIFF *diff, char * arg);\r
119 GITDLL_API int git_diff(GIT_DIFF diff, GIT_HASH hash1,GIT_HASH hash2, GIT_FILE * file, int *count);\r
120 GITDLL_API int git_root_diff(GIT_DIFF diff, GIT_HASH hash,GIT_FILE *file, int *count);\r
121 GITDLL_API int git_diff_flush(GIT_DIFF diff);\r
122 GITDLL_API int git_close_diff(GIT_DIFF diff);\r
123 \r
124 \r
125 GITDLL_API int git_get_diff_file(GIT_DIFF diff,GIT_FILE file, int i,char **newname, char **oldname,  int *mode, int *IsBin, int *inc, int *dec);\r
126 \r
127 #endif