[beast: 1/26] BSE: move Container.get_item() into bseapi.idl
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 1/26] BSE: move Container.get_item() into bseapi.idl
- Date: Fri, 14 Oct 2016 15:48:04 +0000 (UTC)
commit 267e31f97345dd2af67b04854247fbf7d863d53b
Author: Tim Janik <timj gnu org>
Date: Fri May 27 10:28:54 2016 +0200
BSE: move Container.get_item() into bseapi.idl
Signed-off-by: Tim Janik <timj gnu org>
bse/bseapi.idl | 1 +
bse/bsecontainer.cc | 9 +++++++++
bse/bsecontainer.hh | 1 +
bse/bsecontainer.proc | 28 ----------------------------
4 files changed, 11 insertions(+), 28 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 8154e62..ff70311 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -614,6 +614,7 @@ interface ContextMerger : Source {
/// Base interface type for containers of Item derived types.
interface Container : Source {
Item lookup_item (String uname); ///< Find an immediate child of a container by name (unique per container
child).
+ Item get_item (String item_type, int32 seq_id); ///< Retrieve the immediate child of type @a item_type
by its sequential id (the 'nth' child).
};
/// Base interface type for Item managers.
diff --git a/bse/bsecontainer.cc b/bse/bsecontainer.cc
index 1c1b33a..1f5ac68 100644
--- a/bse/bsecontainer.cc
+++ b/bse/bsecontainer.cc
@@ -1360,4 +1360,13 @@ ContainerImpl::lookup_item (const String &uname)
return child->as<ItemIfaceP>();
}
+ItemIfaceP
+ContainerImpl::get_item (const String &item_type, int seq_id)
+{
+ BseContainer *self = as<BseContainer*>();
+ GType type = g_type_from_name (item_type.c_str());
+ BseItem *child = bse_container_get_item (self, type, seq_id);
+ return child->as<ItemIfaceP>();
+}
+
} // Bse
diff --git a/bse/bsecontainer.hh b/bse/bsecontainer.hh
index 283afd6..2050f8e 100644
--- a/bse/bsecontainer.hh
+++ b/bse/bsecontainer.hh
@@ -111,6 +111,7 @@ protected:
public:
explicit ContainerImpl (BseObject*);
virtual ItemIfaceP lookup_item (const String &uname) override;
+ virtual ItemIfaceP get_item (const String &item_type, int seq_id) override;
};
} // Bse
diff --git a/bse/bsecontainer.proc b/bse/bsecontainer.proc
index e2c68cf..5e3a55b 100644
--- a/bse/bsecontainer.proc
+++ b/bse/bsecontainer.proc
@@ -30,31 +30,3 @@ METHOD (BseContainer, list-children) {
return Bse::Error::NONE;
}
-
-METHOD (BseContainer, get-item) {
- HELP = "Retrieve a containers immediate child from it's sequential id.";
- IN = bse_param_spec_object ("container", NULL, NULL, BSE_TYPE_CONTAINER, SFI_PARAM_STANDARD);
- IN = sfi_pspec_string ("item_type", NULL, "Type of the item to retrieve",
- NULL, SFI_PARAM_STANDARD);
- IN = sfi_pspec_int ("seq_id", NULL, "Sequential ID",
- 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
- OUT = bse_param_spec_object ("item", NULL, "The item with seqid as requested", BSE_TYPE_ITEM,
SFI_PARAM_STANDARD);
-} BODY (BseProcedureClass *proc,
- const GValue *in_values,
- GValue *out_values)
-{
- /* extract parameter values */
- BseContainer *container = (BseContainer*) bse_value_get_object (in_values++);
- const char *type_name = sfi_value_get_string (in_values++);
- guint seqid = sfi_value_get_int (in_values++);
- GType type = type_name ? g_type_from_name (type_name) : 0;
-
- /* check parameters */
- if (!BSE_IS_CONTAINER (container) || !g_type_is_a (type, BSE_TYPE_ITEM))
- return Bse::Error::PROC_PARAM_INVAL;
-
- /* set output parameters */
- bse_value_set_object (out_values++, bse_container_get_item (container, type, seqid));
-
- return Bse::Error::NONE;
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]