/work/fwupd-remote-struct.c
Line | Count | Source |
1 | | /* |
2 | | * This file is auto-generated, do not modify! |
3 | | * |
4 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
5 | | */ |
6 | | |
7 | | #include "config.h" |
8 | | |
9 | | #include <glib.h> |
10 | | |
11 | | #include "fwupd-remote-struct.h" |
12 | | |
13 | | #ifdef G_LOG_DOMAIN |
14 | | #undef G_LOG_DOMAIN |
15 | | #endif |
16 | | #define G_LOG_DOMAIN "FuStruct" |
17 | | |
18 | | /** |
19 | | * fwupd_remote_kind_to_string: |
20 | | * @val: value, e.g. %FWUPD_REMOTE_KIND_DOWNLOAD |
21 | | * |
22 | | * Converts an enumerated value to a string. |
23 | | * |
24 | | * Returns: identifier string |
25 | | * |
26 | | * Since: 0.9.6 |
27 | | **/ |
28 | | const gchar * |
29 | | fwupd_remote_kind_to_string(FwupdRemoteKind val) |
30 | 0 | { |
31 | 0 | if (val == FWUPD_REMOTE_KIND_DOWNLOAD) |
32 | 0 | return "download"; |
33 | 0 | if (val == FWUPD_REMOTE_KIND_LOCAL) |
34 | 0 | return "local"; |
35 | 0 | if (val == FWUPD_REMOTE_KIND_DIRECTORY) |
36 | 0 | return "directory"; |
37 | 0 | return NULL; |
38 | 0 | } |
39 | | /** |
40 | | * fwupd_remote_kind_from_string: |
41 | | * @val: (nullable): a string, e.g. `download` |
42 | | * |
43 | | * Converts a string to an enumerated value. |
44 | | * |
45 | | * Returns: enumerated value |
46 | | * |
47 | | * Since: 0.9.6 |
48 | | **/ |
49 | | FwupdRemoteKind |
50 | | fwupd_remote_kind_from_string(const gchar *val) |
51 | 0 | { |
52 | 0 | if (g_strcmp0(val, "download") == 0) |
53 | 0 | return FWUPD_REMOTE_KIND_DOWNLOAD; |
54 | 0 | if (g_strcmp0(val, "local") == 0) |
55 | 0 | return FWUPD_REMOTE_KIND_LOCAL; |
56 | 0 | if (g_strcmp0(val, "directory") == 0) |
57 | 0 | return FWUPD_REMOTE_KIND_DIRECTORY; |
58 | 0 | return FWUPD_REMOTE_KIND_UNKNOWN; |
59 | 0 | } |
60 | | |
61 | | /** |
62 | | * fwupd_remote_flag_to_string: |
63 | | * @val: value, e.g. %FWUPD_REMOTE_FLAG_ENABLED |
64 | | * |
65 | | * Converts an enumerated value to a string. |
66 | | * |
67 | | * Returns: identifier string |
68 | | * |
69 | | * Since: 1.9.4 |
70 | | **/ |
71 | | const gchar * |
72 | | fwupd_remote_flag_to_string(FwupdRemoteFlags val) |
73 | 0 | { |
74 | 0 | if (val == FWUPD_REMOTE_FLAG_NONE) |
75 | 0 | return "none"; |
76 | 0 | if (val == FWUPD_REMOTE_FLAG_ENABLED) |
77 | 0 | return "enabled"; |
78 | 0 | if (val == FWUPD_REMOTE_FLAG_APPROVAL_REQUIRED) |
79 | 0 | return "approval-required"; |
80 | 0 | if (val == FWUPD_REMOTE_FLAG_AUTOMATIC_REPORTS) |
81 | 0 | return "automatic-reports"; |
82 | 0 | if (val == FWUPD_REMOTE_FLAG_AUTOMATIC_SECURITY_REPORTS) |
83 | 0 | return "automatic-security-reports"; |
84 | 0 | if (val == FWUPD_REMOTE_FLAG_ALLOW_P2P_METADATA) |
85 | 0 | return "allow-p2p-metadata"; |
86 | 0 | if (val == FWUPD_REMOTE_FLAG_ALLOW_P2P_FIRMWARE) |
87 | 0 | return "allow-p2p-firmware"; |
88 | 0 | if (val == FWUPD_REMOTE_FLAG_NO_PHASED_UPDATES) |
89 | 0 | return "no-phased-updates"; |
90 | 0 | return NULL; |
91 | 0 | } |
92 | | /** |
93 | | * fwupd_remote_flag_from_string: |
94 | | * @val: (nullable): a string, e.g. `enabled` |
95 | | * |
96 | | * Converts a string to an enumerated value. |
97 | | * |
98 | | * Returns: enumerated value |
99 | | * |
100 | | * Since: 1.9.4 |
101 | | **/ |
102 | | FwupdRemoteFlags |
103 | | fwupd_remote_flag_from_string(const gchar *val) |
104 | 0 | { |
105 | 0 | if (g_strcmp0(val, "none") == 0) |
106 | 0 | return FWUPD_REMOTE_FLAG_NONE; |
107 | 0 | if (g_strcmp0(val, "enabled") == 0) |
108 | 0 | return FWUPD_REMOTE_FLAG_ENABLED; |
109 | 0 | if (g_strcmp0(val, "approval-required") == 0) |
110 | 0 | return FWUPD_REMOTE_FLAG_APPROVAL_REQUIRED; |
111 | 0 | if (g_strcmp0(val, "automatic-reports") == 0) |
112 | 0 | return FWUPD_REMOTE_FLAG_AUTOMATIC_REPORTS; |
113 | 0 | if (g_strcmp0(val, "automatic-security-reports") == 0) |
114 | 0 | return FWUPD_REMOTE_FLAG_AUTOMATIC_SECURITY_REPORTS; |
115 | 0 | if (g_strcmp0(val, "allow-p2p-metadata") == 0) |
116 | 0 | return FWUPD_REMOTE_FLAG_ALLOW_P2P_METADATA; |
117 | 0 | if (g_strcmp0(val, "allow-p2p-firmware") == 0) |
118 | 0 | return FWUPD_REMOTE_FLAG_ALLOW_P2P_FIRMWARE; |
119 | 0 | if (g_strcmp0(val, "no-phased-updates") == 0) |
120 | 0 | return FWUPD_REMOTE_FLAG_NO_PHASED_UPDATES; |
121 | 0 | return FWUPD_REMOTE_FLAG_NONE; |
122 | 0 | } |