2020-09-29 16:42:22 +02:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2019-09-25 13:13:40 +02:00
|
|
|
/*
|
2019-10-01 09:20:35 +02:00
|
|
|
* Copyright (C) 2017 Red Hat, Inc.
|
2017-03-29 18:40:32 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __NM_ENUM_UTILS_H__
|
|
|
|
|
#define __NM_ENUM_UTILS_H__
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-29 18:56:01 +02:00
|
|
|
typedef struct _NMUtilsEnumValueInfo {
|
2020-09-28 16:03:33 +02:00
|
|
|
/* currently, this is only used for _nm_utils_enum_from_str_full() to
|
2020-09-28 14:50:01 +02:00
|
|
|
* declare additional aliases for values. */
|
2020-09-28 16:03:33 +02:00
|
|
|
const char *nick;
|
|
|
|
|
int value;
|
2017-03-29 18:56:01 +02:00
|
|
|
} NMUtilsEnumValueInfo;
|
|
|
|
|
|
2020-09-28 16:03:33 +02:00
|
|
|
char * _nm_utils_enum_to_str_full(GType type,
|
|
|
|
|
int value,
|
|
|
|
|
const char * sep,
|
|
|
|
|
const NMUtilsEnumValueInfo *value_infos);
|
|
|
|
|
gboolean _nm_utils_enum_from_str_full(GType type,
|
|
|
|
|
const char * str,
|
|
|
|
|
int * out_value,
|
|
|
|
|
char ** err_token,
|
|
|
|
|
const NMUtilsEnumValueInfo *value_infos);
|
2017-03-29 18:56:01 +02:00
|
|
|
|
2020-09-28 16:03:33 +02:00
|
|
|
const char **_nm_utils_enum_get_values(GType type, int from, int to);
|
2017-03-29 18:40:32 +02:00
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#endif /* __NM_ENUM_UTILS_H__ */
|