1 /* 2 * libosinfo: an object with a set of parameters 3 * 4 * Copyright (C) 2009-2020 Red Hat, Inc. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library. If not, see 18 * <http://www.gnu.org/licenses/>. 19 */ 20 21 #include <glib-object.h> 22 23 #ifndef __OSINFO_ENTITY_H__ 24 # define __OSINFO_ENTITY_H__ 25 26 # include "osinfo/osinfo_macros.h" 27 28 # define OSINFO_TYPE_ENTITY (osinfo_entity_get_type ()) 29 OSINFO_DECLARE_TYPE_WITH_PRIVATE_AND_CLASS(OsinfoEntity, 30 osinfo_entity, 31 OSINFO, 32 ENTITY, 33 GObject) 34 35 # define OSINFO_ENTITY_PROP_ID "id" 36 37 const gchar *osinfo_entity_get_id(OsinfoEntity *entity); 38 39 GList *osinfo_entity_get_param_keys(OsinfoEntity *entity); 40 const gchar *osinfo_entity_get_param_value(OsinfoEntity *entity, const gchar *key); 41 gboolean osinfo_entity_get_param_value_boolean(OsinfoEntity *entity, const gchar *key); 42 gboolean osinfo_entity_get_param_value_boolean_with_default(OsinfoEntity *entity, 43 const char *key, 44 gboolean default_value); 45 gint osinfo_entity_get_param_value_enum(OsinfoEntity *entity, 46 const char *key, 47 GType enum_type, 48 gint default_value); 49 gint64 osinfo_entity_get_param_value_int64(OsinfoEntity *entity, const gchar *key); 50 gint64 osinfo_entity_get_param_value_int64_with_default(OsinfoEntity *entity, 51 const gchar *key, 52 gint64 default_value); 53 GList *osinfo_entity_get_param_value_list(OsinfoEntity *entity, const gchar *key); 54 void osinfo_entity_set_param(OsinfoEntity *entity, const gchar *key, const gchar *value); 55 void osinfo_entity_set_param_boolean(OsinfoEntity *entity, const gchar *key, gboolean value); 56 void osinfo_entity_set_param_int64(OsinfoEntity *entity, const gchar *key, gint64 value); 57 void osinfo_entity_set_param_enum(OsinfoEntity *entity, const gchar *key, gint value, GType enum_type); 58 void osinfo_entity_add_param(OsinfoEntity *entity, const gchar *key, const gchar *value); 59 void osinfo_entity_clear_param(OsinfoEntity *entity, const gchar *key); 60 61 #endif /* __OSINFO_ENTITY_H__ */ 62