/work/fu-compressor-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-compressor-struct.h" |
12 | | |
13 | | #ifdef G_LOG_DOMAIN |
14 | | #undef G_LOG_DOMAIN |
15 | | #endif |
16 | | #define G_LOG_DOMAIN "FuStruct" |
17 | | |
18 | | /** |
19 | | * fu_compressor_format_to_string: |
20 | | * @val: value, e.g. %FU_COMPRESSOR_FORMAT_ZLIB |
21 | | * |
22 | | * Converts an enumerated value to a string. |
23 | | * |
24 | | * Returns: identifier string |
25 | | **/ |
26 | | const gchar * |
27 | | fu_compressor_format_to_string(FuCompressorFormat val) |
28 | 0 | { |
29 | 0 | if (val == FU_COMPRESSOR_FORMAT_RAW) |
30 | 0 | return "raw"; |
31 | 0 | if (val == FU_COMPRESSOR_FORMAT_ZLIB) |
32 | 0 | return "zlib"; |
33 | 0 | if (val == FU_COMPRESSOR_FORMAT_GZIP) |
34 | 0 | return "gzip"; |
35 | 0 | return NULL; |
36 | 0 | } |
37 | | /** |
38 | | * fu_compressor_format_from_string: |
39 | | * @val: (nullable): a string, e.g. `zlib` |
40 | | * |
41 | | * Converts a string to an enumerated value. |
42 | | * |
43 | | * Returns: enumerated value |
44 | | **/ |
45 | | FuCompressorFormat |
46 | | fu_compressor_format_from_string(const gchar *val) |
47 | 0 | { |
48 | 0 | if (g_strcmp0(val, "raw") == 0) |
49 | 0 | return FU_COMPRESSOR_FORMAT_RAW; |
50 | 0 | if (g_strcmp0(val, "zlib") == 0) |
51 | 0 | return FU_COMPRESSOR_FORMAT_ZLIB; |
52 | 0 | if (g_strcmp0(val, "gzip") == 0) |
53 | 0 | return FU_COMPRESSOR_FORMAT_GZIP; |
54 | 0 | return FU_COMPRESSOR_FORMAT_RAW; |
55 | 0 | } |