summaryrefslogtreecommitdiff
path: root/libnm-core/nm-utils.h
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-06-04 15:05:33 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-07-24 14:02:59 +0200
commit8be981479366f8caeb494471742e5c801a52cfa2 (patch)
tree2cdf54ed59b4378f971e2036949f1baf7c4c8024 /libnm-core/nm-utils.h
parentea58caef36a0c46517c8b2b9ae1beb86288b58af (diff)
downloadNetworkManager-8be981479366f8caeb494471742e5c801a52cfa2.tar.gz
libnm-core: add enum conversion utilities
Add functions nm_utils_enum_to_str() and nm_utils_enum_from_str() which can be used to perform conversions between enum values and strings, passing the GType automatically generated for every enum by glib-mkenums.
Diffstat (limited to 'libnm-core/nm-utils.h')
-rw-r--r--libnm-core/nm-utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h
index 727f000568..c9a01d6e6e 100644
--- a/libnm-core/nm-utils.h
+++ b/libnm-core/nm-utils.h
@@ -190,6 +190,12 @@ int nm_utils_bond_mode_string_to_int (const char *mode);
NM_AVAILABLE_IN_1_2
const char *nm_utils_bond_mode_int_to_string (int mode);
+NM_AVAILABLE_IN_1_2
+char *nm_utils_enum_to_str (GType type, int value);
+
+NM_AVAILABLE_IN_1_2
+gboolean nm_utils_enum_from_str (GType type, const char *str, int *out_value, char **err_token);
+
G_END_DECLS
#endif /* __NM_UTILS_H__ */