Top | ![]() |
![]() |
![]() |
![]() |
MirageStream * | mirage_contextual_create_input_stream () |
MirageStream * | mirage_contextual_create_output_stream () |
void | mirage_contextual_debug_message () |
void | mirage_contextual_debug_messagev () |
gboolean | mirage_contextual_debug_is_active () |
void | mirage_contextual_debug_print_buffer () |
MirageContext * | mirage_contextual_get_context () |
GVariant * | mirage_contextual_get_option () |
gchar * | mirage_contextual_obtain_password () |
void | mirage_contextual_set_context () |
MirageContextual is implemented by MirageCdTextCoder, MirageDisc, MirageFileStream, MirageFilterStream, MirageFragment, MirageIndex, MirageLanguage, MirageObject, MirageParser, MirageSector, MirageSession, MirageTrack and MirageWriter.
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.
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()
.
self |
||
filename |
filename to create input stream on. |
[in] |
error |
location to store error, or |
[out][allow-none] |
on success, an object implementing MirageStream
interface is returned, which can be used to access data stored in file.
On failure, NULL
is returned. The reference to the object should be
released using g_object_unref()
when no longer needed.
[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()
.
self |
||
filename |
filename to create output stream on. |
[in] |
filter_chain |
NULL-terminated array of strings describing types of filters to include in the filter chain, or |
[in][allow-none][array zero-terminated=1] |
error |
location to store error, or |
[out][allow-none] |
on success, an object implementing MirageStream
interface is returned, which can be used to write data to file.
On failure, NULL
is returned. The reference to the object should be
released using g_object_unref()
when no longer needed.
[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
.
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
.
gboolean mirage_contextual_debug_is_active (MirageContextual *self
,gint level
);
Checks 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.
MirageContext *
mirage_contextual_get_context (MirageContextual *self
);
Retrieves the attached context.
attached context (a MirageContext), or NULL
.
The reference to context is incremented, and should be released using g_object_unref()
when no longer needed.
[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()
.
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()
.
void mirage_contextual_set_context (MirageContextual *self
,MirageContext *context
);
Sets/attaches a context.
typedef struct _MirageContextual MirageContextual;
An object that can be attached a MirageContext.
struct MirageContextualInterface { GTypeInterface parent_iface; /* Interface methods */ void (*set_context) (MirageContextual *self, MirageContext *context); MirageContext *(*get_context) (MirageContextual *self); };
Provides an interface for implementing objects that can be attached a MirageContext.