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 "fu-common-struct.h" |
12 | | |
13 | | #ifdef G_LOG_DOMAIN |
14 | | #undef G_LOG_DOMAIN |
15 | | #endif |
16 | | #define G_LOG_DOMAIN "FuStruct" |
17 | | |
18 | | |
19 | | /** |
20 | | * fu_power_state_to_string: |
21 | | * @val: value, e.g. %FU_POWER_STATE_AC |
22 | | * |
23 | | * Converts an enumerated value to a string. |
24 | | * |
25 | | * Returns: identifier string |
26 | | * |
27 | | * Since: 1.8.11 |
28 | | **/ |
29 | | const gchar * |
30 | | fu_power_state_to_string(FuPowerState val) |
31 | 0 | { |
32 | 0 | if (val == FU_POWER_STATE_AC) |
33 | 0 | return "ac"; |
34 | 0 | if (val == FU_POWER_STATE_BATTERY) |
35 | 0 | return "battery"; |
36 | 0 | return NULL; |
37 | 0 | } |
38 | | |
39 | | /** |
40 | | * fu_lid_state_to_string: |
41 | | * @val: value, e.g. %FU_LID_STATE_OPEN |
42 | | * |
43 | | * Converts an enumerated value to a string. |
44 | | * |
45 | | * Returns: identifier string |
46 | | * |
47 | | * Since: 1.7.4 |
48 | | **/ |
49 | | const gchar * |
50 | | fu_lid_state_to_string(FuLidState val) |
51 | 0 | { |
52 | 0 | if (val == FU_LID_STATE_OPEN) |
53 | 0 | return "open"; |
54 | 0 | if (val == FU_LID_STATE_CLOSED) |
55 | 0 | return "closed"; |
56 | 0 | return NULL; |
57 | 0 | } |
58 | | |
59 | | /** |
60 | | * fu_display_state_to_string: |
61 | | * @val: value, e.g. %FU_DISPLAY_STATE_CONNECTED |
62 | | * |
63 | | * Converts an enumerated value to a string. |
64 | | * |
65 | | * Returns: identifier string |
66 | | * |
67 | | * Since: 1.9.6 |
68 | | **/ |
69 | | const gchar * |
70 | | fu_display_state_to_string(FuDisplayState val) |
71 | 0 | { |
72 | 0 | if (val == FU_DISPLAY_STATE_CONNECTED) |
73 | 0 | return "connected"; |
74 | 0 | if (val == FU_DISPLAY_STATE_DISCONNECTED) |
75 | 0 | return "disconnected"; |
76 | 0 | return NULL; |
77 | 0 | } |
78 | | /** |
79 | | * fu_display_state_from_string: |
80 | | * @val: (nullable): a string, e.g. `connected` |
81 | | * |
82 | | * Converts a string to an enumerated value. |
83 | | * |
84 | | * Returns: enumerated value |
85 | | * |
86 | | * Since: 1.9.6 |
87 | | **/ |
88 | | FuDisplayState |
89 | | fu_display_state_from_string(const gchar *val) |
90 | 0 | { |
91 | 0 | if (g_strcmp0(val, "connected") == 0) |
92 | 0 | return FU_DISPLAY_STATE_CONNECTED; |
93 | 0 | if (g_strcmp0(val, "disconnected") == 0) |
94 | 0 | return FU_DISPLAY_STATE_DISCONNECTED; |
95 | 0 | return FU_DISPLAY_STATE_UNKNOWN; |
96 | 0 | } |