about summary refs log tree commit diff
path: root/shared/nm-glib-aux/nm-enum-utils.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-04-21 21:09:51 +0200
committerMichael Biebl <biebl@debian.org>2019-04-21 21:09:51 +0200
commit85563b7fc7ec2cd21e38debb9b28db342e2e8e7c (patch)
treecce7b0b02d28fae2df9fdf2c1804cacd1500f2d7 /shared/nm-glib-aux/nm-enum-utils.h
parent9a6dcbf895f9da01768e64b73cec88c16157d91e (diff)
New upstream version 1.18.0 upstream/1.18.0
Diffstat (limited to 'shared/nm-glib-aux/nm-enum-utils.h')
-rw-r--r--shared/nm-glib-aux/nm-enum-utils.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-enum-utils.h b/shared/nm-glib-aux/nm-enum-utils.h
new file mode 100644
index 00000000..1827fdf4
--- /dev/null
+++ b/shared/nm-glib-aux/nm-enum-utils.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * (C) Copyright 2017 Red Hat, Inc.
+ */
+
+#ifndef __NM_ENUM_UTILS_H__
+#define __NM_ENUM_UTILS_H__
+
+/*****************************************************************************/
+
+typedef struct _NMUtilsEnumValueInfo {
+	/* currently, this is only used for _nm_utils_enum_from_str_full() to
+	 * declare additional aliases for values. */
+	const char *nick;
+	int value;
+} NMUtilsEnumValueInfo;
+
+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);
+
+const char **_nm_utils_enum_get_values (GType type, int from, int to);
+
+/*****************************************************************************/
+
+#endif /* __NM_ENUM_UTILS_H__ */