| libMirage Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Known Implementations | ||||
#include <mirage-contextual.h>
MirageContextual;
MirageContextualInterface;
MirageStream * mirage_contextual_create_input_stream
(MirageContextual *self,
const gchar *filename,
GError **error);
MirageStream * mirage_contextual_create_output_stream
(MirageContextual *self,
const gchar *filename,
const gchar **filter_chain,
GError **error);
void mirage_contextual_debug_message (MirageContextual *self,
gint level,
gchar *format,
...);
void mirage_contextual_debug_messagev (MirageContextual *self,
gint level,
gchar *format,
va_list args);
gboolean mirage_contextual_debug_is_active (MirageContextual *self,
gint level);
void mirage_contextual_debug_print_buffer
(MirageContextual *self,
gint level,
const gchar *prefix,
gint width,
const guint8 *buffer,
gint buffer_length);
MirageContext * mirage_contextual_get_context (MirageContextual *self);
GVariant * mirage_contextual_get_option (MirageContextual *self,
const gchar *name);
gchar * mirage_contextual_obtain_password (MirageContextual *self,
GError **error);
void mirage_contextual_set_context (MirageContextual *self,
MirageContext *context);
MirageContextual is implemented by MirageSector, MirageCdTextCoder, MirageFragment, MirageFileStream, MirageLanguage, MirageDisc, MirageIndex, MirageWriter, MirageTrack, MirageParser, MirageSession, MirageObject and MirageFilterStream.
MirageContextual provides an interface that allows attachment of a
MirageContext to the object implementing it. The object must implement
two functions for getting and setting the context - mirage_contextual_get_context()
and mirage_contextual_set_context().
In addition, MirageContextual provides some shared code that can be
used by implementations. Most notable are debugging facilities, in
form of functions mirage_contextual_debug_message() and
mirage_contextual_debug_messagev(), which print debug messages depending
on the settings of the attached context.
Furthermore, for convenience of image parser and filter stream implementations, passthrough is provided for some functions of MirageContext. Using these functions is equivalent to getting and verifying the attached context, calling its function directly, and releasing the reference.
typedef struct _MirageContextual MirageContextual;
An object that can be attached a MirageContext.
typedef struct {
GTypeInterface parent_iface;
/* Interface methods */
void (*set_context) (MirageContextual *self, MirageContext *context);
MirageContext *(*get_context) (MirageContextual *self);
} MirageContextualInterface;
Provides an interface for implementing objects that can be attached a MirageContext.
GTypeInterface |
the parent interface |
|
sets/attaches the context |
|
retrieves the attached context |
MirageStream * mirage_contextual_create_input_stream (MirageContextual *self, const gchar *filename, GError **error);
Opens a file pointed to by filename and creates a chain of filter
streams on top of it.
self and calls mirage_context_create_input_stream().
|
a MirageContextual |
|
filename to create input stream on. in. |
|
location to store error, or NULL. out. allow-none. |
Returns : |
transfer full. transfer full. |
MirageStream * mirage_contextual_create_output_stream (MirageContextual *self, const gchar *filename, const gchar **filter_chain, GError **error);
Opens a file pointed to by filename and creates a chain of filter
streams on top of it.
self and calls mirage_context_create_output_stream().
|
a MirageContextual |
|
filename to create output stream on. in. |
|
NULL-terminated array of strings describing types of filters to include in the filter chain, or NULL. in. allow-none. array zero-terminated=1. |
|
location to store error, or NULL. out. allow-none. |
Returns : |
transfer full. transfer full. |
void mirage_contextual_debug_message (MirageContextual *self, gint level, gchar *format, ...);
Outputs debug message with verbosity level level, format string format and
format arguments Varargs. The message is displayed if debug context has mask
that covers level, or if level is either MIRAGE_DEBUG_WARNING or
MIRAGE_DEBUG_ERROR.
|
a MirageContextual |
|
debug level. in. |
|
message format. See the printf() documentation.. in. |
|
parameters to insert into the format string.. in. |
void mirage_contextual_debug_messagev (MirageContextual *self, gint level, gchar *format, va_list args);
Outputs debug message with verbosity level level, format string format and
format arguments args. The message is displayed if debug context has mask
that covers level, or if level is either MIRAGE_DEBUG_WARNING or
MIRAGE_DEBUG_ERROR.
|
a MirageContextual |
|
debug level. in. |
|
message format. See the printf() documentation.. in. |
|
parameters to insert into the format string.. in. |
gboolean mirage_contextual_debug_is_active (MirageContextual *self, gint level);
Checks whether debug messages at debug level level are currently
active or not.
|
a MirageContextual |
|
debug level. in. |
Returns : |
a boolean indicating whether debug messages at debug level
level are currently active or not.
|
void mirage_contextual_debug_print_buffer
(MirageContextual *self,
gint level,
const gchar *prefix,
gint width,
const guint8 *buffer,
gint buffer_length);
Prints contents of buffer as a sequence of buffer_length two-digit
hexadecimal numbers, arranged in lines of width numbers. Each line
is optionally prefixed by prefix. If specified debug level is not
active (masked by context), this function does nothing.
|
a MirageContextual |
|
debug level. in. |
|
prefix, or none. in. allow-none. |
|
output width. in. |
|
buffer to print. in. array length=buffer_length. |
|
buffer length. in. |
MirageContext * mirage_contextual_get_context (MirageContextual *self);
Retrieves the attached context.
|
a MirageContextual |
Returns : |
transfer full. transfer full. |
GVariant * mirage_contextual_get_option (MirageContextual *self, const gchar *name);
Retrieves option named name from the context.
self and calls mirage_context_get_option().
|
a MirageContextual |
|
option name. in. |
Returns : |
transfer full. transfer full. |
gchar * mirage_contextual_obtain_password (MirageContextual *self, GError **error);
Obtains password string, using the MiragePasswordFunction callback
that was provided via mirage_context_set_password_function().
self and calls mirage_context_obtain_password().
|
a MirageContextual |
|
location to store error, or NULL. out. allow-none. |
Returns : |
password string on success, NULL on failure. The string should be
freed with g_free() when no longer needed.
|
void mirage_contextual_set_context (MirageContextual *self, MirageContext *context);
Sets/attaches a context.
|
a MirageContextual |
|
debug context (a MirageContext). in. transfer full. |