Debian Codegraph @

src/lib/util/template.h

raw symbols SCIP
1 /*
2 Authors:
3 Pavel Březina <[email protected]>
4
5 Copyright (C) 2018 Red Hat
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _TEMPLATE_H_
22 #define _TEMPLATE_H_cxx . . $ `src/lib/util/template.h:22:9`!
23
24 #include <sys/stat.h>
25
26 #include "common/errno_t.h"cxx . . $ `<file>/src/common/errno_t.h`/
27
28 /**
29 * Generate output from a template.
30 *
31 * @param template Template.
32 * @param features Features to enable.
33 *
34 * @return Generated content or NULL on error.
35 */
36 char *
37 template_generatecxx . . $ template_generate(e6b3452e8157deef).(const char *template,
38 const char **features);
39
40 /**
41 * Find all features available within the @template and return them in
42 * NULL-terminated array.
43 *
44 * @param template Template.
45 *
46 * @return List of features in NULL-terminated array or NULL on error.
47 */
48 char **
49 template_list_featurescxx . . $ template_list_features(9945f7050fb66ac).(const char *template);
50
51 /**
52 * Write generated file preamble together with its content to a file.
53 * If the file does not exist, it is created, otherwise its content
54 * is truncated. The file mode is set to @mode.
55 *
56 * @param filepath Path to the file.
57 * @param content Content to write.
58 * @param mode Mode to create the file with.
59 *
60 * @return EOK on success, other errno code on error.
61 */
62 errno_tcxx . . $ errno_t#
63 template_writecxx . . $ template_write(54fb1e1f0004e0cf).(const char *filepath,
64 const char *content,
65 mode_tcxx . . $ mode_t# mode);
66
67 /**
68 * Write generated file preamble together with its content to a temporary file.
69 * The temporary file name is returned in @_tmpfile.
70 * The file mode is set to @mode.
71 *
72 * @param filepath Path to the file.
73 * @param content Content to write.
74 * @param mode Mode to create the file with.
75 * @param _tmpfile Name of created temporary file.
76 *
77 * @return EOK on success, other errno code on error.
78 */
79 errno_tcxx . . $ errno_t#
80 template_write_temporarycxx . . $ template_write_temporary(5071347881743dfd).(const char *filepath,
81 const char *content,
82 mode_tcxx . . $ mode_t# mode,
83 char **_tmpfile);
84
85 /**
86 * Validate previously generated and written file content.
87 *
88 * @return True if the content was not modified, false otherwise.
89 */
90 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
91 template_validate_written_contentcxx . . $ template_validate_written_content(b7a7aa4a824b7595).(const char *file_content,
92 const char *expected);
93
94 #endif /* _TEMPLATE_H_ */