BonoboPersistStream

BonoboPersistStream

Name

BonoboPersistStream -- Interface for anything that can save / load itself from a Bonobo stream.

Description

The PersistStream interface is the interface to use for all new components that are able to load and save themselves to a stream. It should be associated with any BonoboEmbeddable for use by the container in creating a compound document.

This interface works by connecting callbacks to the methods, in a somewhat deprecated fashion, it is probably better nowadays to simply sub-class the BonoboXObject and override the epv methods. Either way, after all the caveats here is an example use:

Having implemented the callbacks we then have to register them and aggregate the interface to our object:

Details

BONOBO_PERSIST_STREAM_TYPE

#define BONOBO_PERSIST_STREAM_TYPE        BONOBO_TYPE_PERSIST_STREAM /* deprecated, you should use BONOBO_TYPE_PERSIST_STREAM */


struct BonoboPersistStreamPrivate

struct BonoboPersistStreamPrivate;


struct BonoboPersistStream

struct BonoboPersistStream {
BonoboPersist persist;

gboolean     is_dirty;

/*
 * For the sample routines, NULL if we use the
 * methods from the class
 */
BonoboPersistStreamIOFn     save_fn;
BonoboPersistStreamIOFn     load_fn;
BonoboPersistStreamTypesFn  types_fn;

void                       *closure;

BonoboPersistStreamPrivate *priv;
};


BonoboPersistStreamIOFn ()

void        (*BonoboPersistStreamIOFn)      (BonoboPersistStream *ps,
                                             const Bonobo_Stream stream,
                                             Bonobo_Persist_ContentType type,
                                             void *closure,
                                             CORBA_Environment *ev);


BonoboPersistStreamTypesFn ()

Bonobo_Persist_ContentTypeList* (*BonoboPersistStreamTypesFn)
                                            (BonoboPersistStream *ps,
                                             void *closure,
                                             CORBA_Environment *ev);


BonoboPersistStreamClass

typedef struct {
BonoboPersistClass parent_class;

POA_Bonobo_PersistStream__epv epv;

/* methods */
void       (*load)         (BonoboPersistStream        *ps,
    Bonobo_Stream              stream,
    Bonobo_Persist_ContentType type,
    CORBA_Environment          *ev);
void       (*save)         (BonoboPersistStream        *ps,
    Bonobo_Stream              stream,
    Bonobo_Persist_ContentType type,
    CORBA_Environment          *ev);

Bonobo_Persist_ContentTypeList * (*get

oops

The requested page could not be found. Please use your browsers 'back' button or the above home button to return to the Greenstone Digital Library.types) (BonoboPersistStream *ps, CORBA_Environment *ev); } BonoboPersistStreamClass;


bonobo_persist_stream_new ()

BonoboPersistStream* bonobo_persist_stream_new
                                            (BonoboPersistStreamIOFn load_fn,
                                             BonoboPersistStreamIOFn save_fn,
                                             BonoboPersistStreamTypesFn types_fn,
                                             const gchar *iid,
                                             void *closure);

Creates a new BonoboPersistStream object. The various operations for the object are performed by the provided callback functions, which are passed closure when they are invoked. If any callback is NULL, the corresponding operation is performed by the class load and save routines.


bonobo_persist_stream_construct ()

BonoboPersistStream* bonobo_persist_stream_construct
                                            (BonoboPersistStream *ps,
                                             BonoboPersistStreamIOFn load_fn,
                                             BonoboPersistStreamIOFn save_fn,
                                             BonoboPersistStreamTypesFn types_fn,
                                             const gchar *iid,
                                             void *closure);

Initializes the BonoboPersistStream object. The load and save operations for the object are performed by the provided load_fn and save_fn callback functions, which are passed closure when they are invoked. If either load_fn or save_fn is NULL, the corresponding operation is performed by the class load and save routines.