Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> --- osinfo/Makefile.am | 2 + osinfo/libosinfo.syms | 3 ++ osinfo/osinfo.h | 1 + osinfo/osinfo_featurelinklist.c | 90 +++++++++++++++++++++++++++++++++ osinfo/osinfo_featurelinklist.h | 78 ++++++++++++++++++++++++++++ 5 files changed, 174 insertions(+) create mode 100644 osinfo/osinfo_featurelinklist.c create mode 100644 osinfo/osinfo_featurelinklist.h diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 0b243fc..8c3135e 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -82,6 +82,7 @@ libosinfo_impl_include_HEADERS = \ osinfo_entity.h \ osinfo_feature.h \ osinfo_featurelink.h \ + osinfo_featurelinklist.h \ osinfo_featurelist.h \ osinfo_filter.h \ osinfo_install_config.h \ @@ -134,6 +135,7 @@ libosinfo_c_files = \ osinfo_device_driverlist.c \ osinfo_feature.c \ osinfo_featurelink.c \ + osinfo_featurelinklist.c \ osinfo_featurelist.c \ osinfo_install_config.c \ osinfo_install_config_param.c \ diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms index b24ce16..be59fc7 100644 --- a/osinfo/libosinfo.syms +++ b/osinfo/libosinfo.syms @@ -540,6 +540,9 @@ LIBOSINFO_1.3.0 { osinfo_featurelink_get_type; osinfo_featurelink_new; + osinfo_featurelinklist_get_type; + osinfo_featurelinklist_new; + osinfo_featurelist_get_type; osinfo_featurelist_new; diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h index 91c2d34..24fd09c 100644 --- a/osinfo/osinfo.h +++ b/osinfo/osinfo.h @@ -33,6 +33,7 @@ #include <osinfo/osinfo_entity.h> #include <osinfo/osinfo_feature.h> #include <osinfo/osinfo_featurelink.h> +#include <osinfo/osinfo_featurelinklist.h> #include <osinfo/osinfo_featurelist.h> #include <osinfo/osinfo_filter.h> #include <osinfo/osinfo_link.h> diff --git a/osinfo/osinfo_featurelinklist.c b/osinfo/osinfo_featurelinklist.c new file mode 100644 index 0000000..a4671d0 --- /dev/null +++ b/osinfo/osinfo_featurelinklist.c @@ -0,0 +1,90 @@ +/* + * libosinfo: a list of featurelinks + * + * Copyright (C) 2018 Red Hat, Inc. + * + * 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.1 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, see + * <http://www.gnu.org/licenses/>. + * + * Authors: + * Fabiano Fidêncio <fidencio@xxxxxxxxxx> + */ + +#include <config.h> + +#include <osinfo/osinfo.h> +#include <glib/gi18n-lib.h> + +G_DEFINE_TYPE(OsinfoFeatureLinkList, osinfo_featurelinklist, OSINFO_TYPE_LINKLIST); + +#define OSINFO_FEATURELINKLIST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), OSINFO_TYPE_FEATURELINKLIST, OsinfoFeatureLinkListPrivate)) + +/** + * SECTION:osinfo_featurelinklist + * @short_description: A list of guest featurelink + * @see_also: #OsinfoList, #OsinfoFeatureLink + * + * #OsinfoFeatureLinkList is a list specialization that stores + * only #OsinfoFeatureLink objects. + */ + +struct _OsinfoFeatureLinkListPrivate +{ + gboolean unused; +}; + +static void +osinfo_featurelinklist_finalize(GObject *object) +{ + /* Chain up to the parent class */ + G_OBJECT_CLASS(osinfo_featurelinklist_parent_class)->finalize(object); +} + +/* Init functions */ +static void +osinfo_featurelinklist_class_init(OsinfoFeatureLinkListClass *klass) +{ + GObjectClass *g_klass = G_OBJECT_CLASS(klass); + + g_klass->finalize = osinfo_featurelinklist_finalize; + g_type_class_add_private(klass, sizeof(OsinfoFeatureLinkListPrivate)); +} + +static void +osinfo_featurelinklist_init(OsinfoFeatureLinkList *list) +{ + list->priv = OSINFO_FEATURELINKLIST_GET_PRIVATE(list); +} + +/** + * osinfo_featurelinklist_new: + * + * Construct a new featurelink list that is initially empty. + * + * Returns: (transfer full): an empty featurelink list + */ +OsinfoFeatureLinkList *osinfo_featurelinklist_new(void) +{ + return g_object_new(OSINFO_TYPE_FEATURELINKLIST, + "element-type", OSINFO_TYPE_FEATURELINK, + NULL); +} + +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/osinfo/osinfo_featurelinklist.h b/osinfo/osinfo_featurelinklist.h new file mode 100644 index 0000000..2c5c07f --- /dev/null +++ b/osinfo/osinfo_featurelinklist.h @@ -0,0 +1,78 @@ +/* + * libosinfo: a list of featurelinks + * + * Copyright (C) 2018 Red Hat, Inc. + * + * 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.1 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, see + * <http://www.gnu.org/licenses/>. + * + * Authors: + * Fabiano Fidêncio <fidencio@xxxxxxxxxx> + */ + +#include <glib-object.h> +#include <osinfo/osinfo_filter.h> +#include <osinfo/osinfo_linklist.h> + +#ifndef __OSINFO_FEATURELINKLIST_H__ +#define __OSINFO_FEATURELINKLIST_H__ + +/* + * Type macros. + */ +#define OSINFO_TYPE_FEATURELINKLIST (osinfo_featurelinklist_get_type ()) +#define OSINFO_FEATURELINKLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OSINFO_TYPE_FEATURELINKLIST, OsinfoFeatureLinkList)) +#define OSINFO_IS_FEATURELINKLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OSINFO_TYPE_FEATURELINKLIST)) +#define OSINFO_FEATURELINKLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OSINFO_TYPE_FEATURELINKLIST, OsinfoFeatureLinkListClass)) +#define OSINFO_IS_FEATURELINKLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_FEATURELINKLIST)) +#define OSINFO_FEATURELINKLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_FEATURELINKLIST, OsinfoFeatureLinkListClass)) + +typedef struct _OsinfoFeatureLinkList OsinfoFeatureLinkList; + +typedef struct _OsinfoFeatureLinkListClass OsinfoFeatureLinkListClass; + +typedef struct _OsinfoFeatureLinkListPrivate OsinfoFeatureLinkListPrivate; + +/* object */ +struct _OsinfoFeatureLinkList +{ + OsinfoLinkList parent_instance; + + /* public */ + + /* private */ + OsinfoFeatureLinkListPrivate *priv; +}; + +/* class */ +struct _OsinfoFeatureLinkListClass +{ + /*< private >*/ + OsinfoLinkListClass parent_class; + + /* class members */ +}; + +GType osinfo_featurelinklist_get_type(void); + +OsinfoFeatureLinkList *osinfo_featurelinklist_new(void); + +#endif /* __OSINFO_FEATURELINKLIST_H__ */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + */ -- 2.19.1 _______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo