Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsecontainer.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __BSE_CONTAINER_H__
3 #define __BSE_CONTAINER_H__
4 
5 #include <bse/bsesource.hh>
6 #include <sfi/gbsearcharray.hh>
7 
8 /* --- object type macros --- */
9 #define BSE_TYPE_CONTAINER (BSE_TYPE_ID (BseContainer))
10 #define BSE_CONTAINER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_CONTAINER, BseContainer))
11 #define BSE_CONTAINER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_CONTAINER, BseContainerClass))
12 #define BSE_IS_CONTAINER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_CONTAINER))
13 #define BSE_IS_CONTAINER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_CONTAINER))
14 #define BSE_CONTAINER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_CONTAINER, BseContainerClass))
15 #define BSE_CONTAINER_FLAGS_USHIFT (BSE_SOURCE_FLAGS_USHIFT + 0)
16 
17 
18 /* --- BseContainer object --- */
19 typedef gboolean (*BseForallItemsFunc) (BseItem *item,
20  gpointer data);
21 typedef gboolean (*BseForallCrossFunc) (BseItem *owner,
22  BseItem *link,
23  gpointer data);
25  guint n_items; /* paranoid checks */
26 };
28  void (*add_item) (BseContainer *container,
29  BseItem *item);
30  void (*remove_item) (BseContainer *container,
31  BseItem *item);
32  void (*forall_items) (BseContainer *container,
33  BseForallItemsFunc func,
34  gpointer data);
35  gboolean (*check_restore) (BseContainer *container,
36  const gchar *child_type);
37  BseItem* (*retrieve_child) (BseContainer *container,
38  GType child_type,
39  const gchar *uname);
40  GSList* (*context_children) (BseContainer *container);
41  void (*release_children) (BseContainer *container);
42 };
43 
44 
45 /* --- prototypes --- */
46 void bse_container_forall_items (BseContainer *container,
47  BseForallItemsFunc func,
48  gpointer data);
49 guint bse_container_get_item_seqid (BseContainer *container,
50  BseItem *item);
51 BseItem* bse_container_get_item (BseContainer *container,
52  GType item_type,
53  guint seq_id);
54 void bse_container_store_children (BseContainer *container,
55  BseStorage *storage);
56 BseItem* bse_container_lookup_item (BseContainer *container,
57  const gchar *uname);
58 BseItem* bse_container_retrieve_child (BseContainer *container,
59  const gchar *type_uname);
60 BseItem* bse_container_resolve_upath (BseContainer *container,
61  const gchar *upath);
62 gchar* /*fr*/ bse_container_make_upath (BseContainer *container,
63  BseItem *item);
64 gboolean bse_container_check_restore (BseContainer *container,
65  const gchar *child_type);
66 /* non-undo functions */
67 gpointer bse_container_new_child_bname (BseContainer *container,
68  GType child_type,
69  const gchar *base_name,
70  const gchar *first_param_name,
71  ...);
72 #define bse_container_new_child( container, child_type, ...) \
73  bse_container_new_child_bname( container, child_type, NULL, __VA_ARGS__)
74 void bse_container_add_item (BseContainer *container,
75  BseItem *item);
76 void bse_container_remove_item (BseContainer *container,
77  BseItem *item);
78 /* undo+redo functions or undo-only (backup) functions */
79 void bse_container_uncross_undoable (BseContainer *container,
80  BseItem *child);
81 void bse_container_remove_backedup (BseContainer *container,
82  BseItem *child,
83  BseUndoStack *ustack);
84 
85 
86 /* --- internal functions --- */
87 void _bse_container_cross_link (BseContainer *container,
88  BseItem *owner,
89  BseItem *link,
90  BseItemUncross uncross_func);
91 void _bse_container_cross_unlink (BseContainer *container,
92  BseItem *owner,
93  BseItem *link,
94  BseItemUncross uncross);
95 void _bse_container_uncross (BseContainer *container,
96  BseItem *owner,
97  BseItem *link);
98 void bse_container_debug_tree (BseContainer *container);
99 
100 
101 namespace Bse {
102 
103 class ContainerImpl : public SourceImpl, public virtual ContainerIface {
104 protected:
105  virtual ~ContainerImpl ();
106 public:
107  explicit ContainerImpl (BseObject*);
108  virtual ItemIfaceP lookup_item (const String &uname) override;
109  virtual ItemIfaceP get_item (const String &item_type, int seq_id) override;
110  virtual ItemSeq list_children ();
111 };
112 
113 } // Bse
114 
115 #endif /* __BSE_CONTAINER_H__ */
A list of part note events.
Definition: bseapi.idl:500
Definition: bsecontainer.hh:24
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:91
STL class.
Definition: bsecontainer.hh:27
Definition: bseobject.hh:57
Definition: bsesource.hh:82
Definition: bsesource.hh:90
Definition: bsestorage.hh:45
Definition: bseitem.hh:32
Definition: bsesource.hh:274
link
uname