BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bsecontainer.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __BSE_CONTAINER_H__
00003 #define __BSE_CONTAINER_H__
00004 
00005 #include <bse/bsesource.hh>
00006 #include <sfi/gbsearcharray.hh>
00007 
00008 G_BEGIN_DECLS
00009 
00010 /* --- object type macros --- */
00011 #define BSE_TYPE_CONTAINER              (BSE_TYPE_ID (BseContainer))
00012 #define BSE_CONTAINER(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_CONTAINER, BseContainer))
00013 #define BSE_CONTAINER_CLASS(class)      (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_CONTAINER, BseContainerClass))
00014 #define BSE_IS_CONTAINER(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_CONTAINER))
00015 #define BSE_IS_CONTAINER_CLASS(class)   (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_CONTAINER))
00016 #define BSE_CONTAINER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_CONTAINER, BseContainerClass))
00017 #define BSE_CONTAINER_FLAGS_USHIFT      (BSE_SOURCE_FLAGS_USHIFT + 0)
00018 
00019 
00020 /* --- BseContainer object --- */
00021 typedef gboolean (*BseForallItemsFunc) (BseItem  *item,
00022                                         gpointer  data);
00023 typedef gboolean (*BseForallCrossFunc) (BseItem  *owner,
00024                                         BseItem  *link,
00025                                         gpointer  data);
00026 struct BseContainer : BseSource {
00027   guint         n_items;        /* paranoid checks */
00028 };
00029 struct BseContainerClass : BseSourceClass {
00030   void          (*add_item)             (BseContainer           *container,
00031                                          BseItem                *item);
00032   void          (*remove_item)          (BseContainer           *container,
00033                                          BseItem                *item);
00034   void          (*forall_items)         (BseContainer           *container,
00035                                          BseForallItemsFunc      func,
00036                                          gpointer                data);
00037   gboolean      (*check_restore)        (BseContainer           *container,
00038                                          const gchar            *child_type);
00039   BseItem*      (*retrieve_child)       (BseContainer           *container,
00040                                          GType                   child_type,
00041                                          const gchar            *uname);
00042   GSList*       (*context_children)     (BseContainer           *container);
00043   void          (*release_children)     (BseContainer           *container);
00044 };
00045 
00046 
00047 /* --- prototypes --- */
00048 void            bse_container_forall_items      (BseContainer   *container,
00049                                                  BseForallItemsFunc func,
00050                                                  gpointer        data);
00051 BseItemSeq*     bse_container_list_children     (BseContainer   *container);
00052 guint           bse_container_get_item_seqid    (BseContainer   *container,
00053                                                  BseItem        *item);
00054 BseItem*        bse_container_get_item          (BseContainer   *container,
00055                                                  GType           item_type,
00056                                                  guint           seq_id);
00057 void            bse_container_store_children    (BseContainer   *container,
00058                                                  BseStorage     *storage);
00059 BseItem*        bse_container_lookup_item       (BseContainer   *container,
00060                                                  const gchar    *uname);
00061 BseItem*        bse_container_retrieve_child    (BseContainer   *container,
00062                                                  const gchar    *type_uname);
00063 BseItem*        bse_container_resolve_upath     (BseContainer   *container,
00064                                                  const gchar    *upath);
00065 gchar* /*fr*/   bse_container_make_upath        (BseContainer   *container,
00066                                                  BseItem        *item);
00067 gboolean        bse_container_check_restore     (BseContainer   *container,
00068                                                  const gchar    *child_type);
00069 /* non-undo functions */
00070 gpointer        bse_container_new_child_bname   (BseContainer   *container,
00071                                                  GType           child_type,
00072                                                  const gchar    *base_name,
00073                                                  const gchar    *first_param_name,
00074                                                  ...);
00075 #define         bse_container_new_child(         container, child_type, ...) \
00076                 bse_container_new_child_bname(   container, child_type, NULL, __VA_ARGS__)
00077 void            bse_container_add_item          (BseContainer   *container,
00078                                                  BseItem        *item);
00079 void            bse_container_remove_item       (BseContainer   *container,
00080                                                  BseItem        *item);
00081 /* undo+redo functions or undo-only (backup) functions */
00082 void        bse_container_uncross_undoable      (BseContainer   *container,
00083                                                  BseItem        *child);
00084 void        bse_container_remove_backedup       (BseContainer   *container,
00085                                                  BseItem        *child,
00086                                                  BseUndoStack   *ustack);
00087 
00088 
00089 /* --- internal functions --- */
00090 void          _bse_container_cross_link         (BseContainer    *container,
00091                                                  BseItem         *owner,
00092                                                  BseItem         *link,
00093                                                  BseItemUncross   uncross_func);
00094 void          _bse_container_cross_unlink       (BseContainer    *container,
00095                                                  BseItem         *owner,
00096                                                  BseItem         *link,
00097                                                  BseItemUncross   uncross);
00098 void          _bse_container_uncross            (BseContainer    *container,
00099                                                  BseItem         *owner,
00100                                                  BseItem         *link);
00101 void          bse_container_debug_tree          (BseContainer    *container);
00102 
00103 
00104 G_END_DECLS
00105 
00106 #endif /* __BSE_CONTAINER_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines