Debian Codegraph @

src/cli/presets.h

raw symbols SCIP
1 /*
2 Authors:
3 Pavel Březina <[email protected]>
4
5 Copyright (C) 2024 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 _PRESETS_H_
22 #define _PRESETS_H_cxx . . $ `src/cli/presets.h:22:9`!
23
24 #include <stdbool.h>
25 #include "common/common.h"cxx . . $ `<file>/src/common/common.h`/
26
27 /**
28 * Preset profile information.
29 */
30 struct cli_presetcxx . . $ cli_preset# {
31 const char *namecxx . . $ cli_preset#name.; /* Preset name (e.g., "@system-default") */
32 const char *descriptioncxx . . $ cli_preset#description.; /* Human-readable description */
33 const char *config_pathcxx . . $ cli_preset#config_path.; /* Path to configuration file */
34 };
35
36 /**
37 * Check if a profile identifier is a preset.
38 *
39 * @param profile_id Profile identifier to check.
40 * @return true if it's a preset (starts with '@'), false otherwise.
41 */
42 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
43 cli_preset_is_presetcxx . . $ cli_preset_is_preset(c5f7da30cbc0f4e9).(const char *profile_id);
44
45 /**
46 * Find preset by name.
47 *
48 * @param name Preset name (e.g., "@system-default").
49 * @return Pointer to preset structure or NULL if not found.
50 */
51 const struct cli_presetcxx . . $ cli_preset#*
52 cli_preset_findcxx . . $ cli_preset_find(2fcd4ad798ac1b8c).(const char *name);
53
54 /**
55 * Resolve a preset to its profile identifier and features.
56 *
57 * Reads the preset configuration file and parses it to extract
58 * the profile identifier and features. If additional_features are provided,
59 * they are merged with preset features (duplicates removed).
60 *
61 * @param preset_name Preset name (e.g., "@system-default").
62 * @param additional_features Additional features to merge with preset features, or NULL.
63 * @param _profile_id Resolved profile identifier (must be freed).
64 * @param _features NULL-terminated array of merged features (must be
65 * freed with string_array_free), or NULL if not
66 * requested.
67 * @return EOK on success, error code on failure.
68 */
69 errno_tcxx . . $ errno_t#
70 cli_preset_resolvecxx . . $ cli_preset_resolve(c8377c9f8d72bd4b).(const char *preset_name,
71 const char **additional_features,
72 char **_profile_id,
73 char ***_features);
74
75 /**
76 * Get maximum length of preset names.
77 *
78 * @return Maximum length of all preset names, 0 if no presets.
79 */
80 int
81 cli_preset_max_name_lengthcxx . . $ cli_preset_max_name_length(b126dc7c1de90089).(void);
82
83 /**
84 * Get list of available presets.
85 *
86 * Returns an array of only the presets whose configuration files exist.
87 * The array is terminated by an entry with NULL name.
88 *
89 * Caller must free the returned array with @cli_preset_list_free.
90 *
91 * @return Array of available presets (caller must free),
92 * or NULL on allocation failure.
93 */
94 struct cli_presetcxx . . $ cli_preset#*
95 cli_preset_listcxx . . $ cli_preset_list(923eb9540c629223).(void);
96
97 /**
98 * Free preset list returned by cli_preset_list().
99 *
100 * @param list Preset list to free (can be NULL).
101 */
102 void
103 cli_preset_list_freecxx . . $ cli_preset_list_free(8ed6e3eef1294f83).(struct cli_presetcxx . . $ cli_preset# *list);
104
105 #endif /* _PRESETS_H_ */