]>
Commit | Line | Data |
---|---|---|
eae0bfdc PP |
1 | /* |
2 | * Copyright (C) the libgit2 contributors. All rights reserved. | |
3 | * | |
4 | * This file is part of libgit2, distributed under the GNU GPL v2 with | |
5 | * a Linking Exception. For full terms see the included COPYING file. | |
6 | */ | |
7 | #ifndef INCLUDE_config_parse_h__ | |
8 | #define INCLUDE_config_parse_h__ | |
9 | ||
10 | #include "common.h" | |
11 | #include "array.h" | |
12 | #include "oid.h" | |
13 | #include "parse.h" | |
14 | ||
ac3d33df JK |
15 | extern const char *git_config_escapes; |
16 | extern const char *git_config_escaped; | |
eae0bfdc PP |
17 | |
18 | typedef struct config_file { | |
19 | git_oid checksum; | |
20 | char *path; | |
21 | git_array_t(struct config_file) includes; | |
22 | } git_config_file; | |
23 | ||
24 | typedef struct { | |
25 | struct config_file *file; | |
26 | git_parse_ctx ctx; | |
27 | } git_config_parser; | |
28 | ||
29 | typedef int (*git_config_parser_section_cb)( | |
30 | git_config_parser *parser, | |
31 | const char *current_section, | |
32 | const char *line, | |
33 | size_t line_len, | |
34 | void *data); | |
35 | ||
36 | typedef int (*git_config_parser_variable_cb)( | |
37 | git_config_parser *parser, | |
38 | const char *current_section, | |
ac3d33df JK |
39 | const char *var_name, |
40 | const char *var_value, | |
eae0bfdc PP |
41 | const char *line, |
42 | size_t line_len, | |
43 | void *data); | |
44 | ||
45 | typedef int (*git_config_parser_comment_cb)( | |
46 | git_config_parser *parser, | |
47 | const char *line, | |
48 | size_t line_len, | |
49 | void *data); | |
50 | ||
51 | typedef int (*git_config_parser_eof_cb)( | |
52 | git_config_parser *parser, | |
53 | const char *current_section, | |
54 | void *data); | |
55 | ||
56 | int git_config_parse( | |
57 | git_config_parser *parser, | |
58 | git_config_parser_section_cb on_section, | |
59 | git_config_parser_variable_cb on_variable, | |
60 | git_config_parser_comment_cb on_comment, | |
61 | git_config_parser_eof_cb on_eof, | |
62 | void *data); | |
63 | ||
64 | #endif |