Coverage Report

Created: 2026-12-01 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/fu-common-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 "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
const gchar *
28
fu_power_state_to_string(FuPowerState val)
29
0
{
30
0
    if (val == FU_POWER_STATE_AC)
31
0
        return "ac";
32
0
    if (val == FU_POWER_STATE_BATTERY)
33
0
        return "battery";
34
0
    return NULL;
35
0
}
36
37
/**
38
 * fu_lid_state_to_string:
39
 * @val: value, e.g. %FU_LID_STATE_OPEN
40
 *
41
 * Converts an enumerated value to a string.
42
 *
43
 * Returns: identifier string
44
 **/
45
const gchar *
46
fu_lid_state_to_string(FuLidState val)
47
0
{
48
0
    if (val == FU_LID_STATE_OPEN)
49
0
        return "open";
50
0
    if (val == FU_LID_STATE_CLOSED)
51
0
        return "closed";
52
0
    return NULL;
53
0
}
54
55
/**
56
 * fu_display_state_to_string:
57
 * @val: value, e.g. %FU_DISPLAY_STATE_CONNECTED
58
 *
59
 * Converts an enumerated value to a string.
60
 *
61
 * Returns: identifier string
62
 **/
63
const gchar *
64
fu_display_state_to_string(FuDisplayState val)
65
0
{
66
0
    if (val == FU_DISPLAY_STATE_CONNECTED)
67
0
        return "connected";
68
0
    if (val == FU_DISPLAY_STATE_DISCONNECTED)
69
0
        return "disconnected";
70
0
    return NULL;
71
0
}
72
/**
73
 * fu_display_state_from_string:
74
 * @val: (nullable): a string, e.g. `connected`
75
 *
76
 * Converts a string to an enumerated value.
77
 *
78
 * Returns: enumerated value
79
 **/
80
FuDisplayState
81
fu_display_state_from_string(const gchar *val)
82
0
{
83
0
    if (g_strcmp0(val, "connected") == 0)
84
0
        return FU_DISPLAY_STATE_CONNECTED;
85
0
    if (g_strcmp0(val, "disconnected") == 0)
86
0
        return FU_DISPLAY_STATE_DISCONNECTED;
87
0
    return FU_DISPLAY_STATE_UNKNOWN;
88
0
}