/*
 * This file is auto-generated, do not modify!
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include "config.h"

#include <glib.h>

#include "fu-compressor-struct.h"

#ifdef G_LOG_DOMAIN
  #undef G_LOG_DOMAIN
#endif
#define G_LOG_DOMAIN "FuStruct"

/**
 * fu_compressor_format_to_string:
 * @val: value, e.g. %FU_COMPRESSOR_FORMAT_ZLIB
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_compressor_format_to_string(FuCompressorFormat val)
{
    if (val == FU_COMPRESSOR_FORMAT_RAW)
        return "raw";
    if (val == FU_COMPRESSOR_FORMAT_ZLIB)
        return "zlib";
    if (val == FU_COMPRESSOR_FORMAT_GZIP)
        return "gzip";
    return NULL;
}
/**
 * fu_compressor_format_from_string:
 * @val: (nullable): a string, e.g. `zlib`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 **/
FuCompressorFormat
fu_compressor_format_from_string(const gchar *val)
{
    if (g_strcmp0(val, "raw") == 0)
        return FU_COMPRESSOR_FORMAT_RAW;
    if (g_strcmp0(val, "zlib") == 0)
        return FU_COMPRESSOR_FORMAT_ZLIB;
    if (g_strcmp0(val, "gzip") == 0)
        return FU_COMPRESSOR_FORMAT_GZIP;
    return FU_COMPRESSOR_FORMAT_RAW;
}
