Mirage.Contextual

g GObject.GInterface GObject.GInterface Mirage.Contextual Mirage.Contextual GObject.GInterface->Mirage.Contextual

Implementations:

Mirage.Object

Methods

create_input_stream (filename)

create_output_stream (filename, filter_chain)

debug_is_active (level)

debug_print_buffer (level, prefix, width, buffer)

get_context ()

get_option (name)

obtain_password ()

set_context (context)

Virtual Methods

do_get_context ()

do_set_context (context)

Properties

None

Signals

None

Fields

None

Class Details

class Mirage.Contextual
Bases:

GObject.GInterface

Structure:

Mirage.ContextualInterface

An object that can be attached a Mirage.Context.

create_input_stream(filename)
Parameters:

filename (str) – filename to create input stream on

Raises:

GLib.Error

Returns:

on success, an object implementing Mirage.Stream interface is returned, which can be used to access data stored in file. On failure, None is returned. The reference to the object should be released using GObject.Object.unref() when no longer needed.

Return type:

Mirage.Stream

Opens a file pointed to by filename and creates a chain of filter streams on top of it.

This is a convenience function that retrieves a Mirage.Context from self and calls Mirage.Context.create_input_stream().

create_output_stream(filename, filter_chain)
Parameters:
  • filename (str) – filename to create output stream on

  • filter_chain ([str] or None) – None-terminated array of strings describing types of filters to include in the filter chain, or None

Raises:

GLib.Error

Returns:

on success, an object implementing Mirage.Stream interface is returned, which can be used to write data to file. On failure, None is returned. The reference to the object should be released using GObject.Object.unref() when no longer needed.

Return type:

Mirage.Stream

Opens a file pointed to by filename and creates a chain of filter streams on top of it.

This is a convenience function that retrieves a Mirage.Context from self and calls Mirage.Context.create_output_stream().

debug_is_active(level)
Parameters:

level (int) – debug level

Returns:

a boolean indicating whether debug messages at debug level level are currently active or not.

Return type:

bool

Checks whether debug messages at debug level level are currently active or not.

debug_print_buffer(level, prefix, width, buffer)
Parameters:
  • level (int) – debug level

  • prefix (str or None) – prefix, or none

  • width (int) – output width

  • buffer (bytes) – buffer to print

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.

get_context()
Returns:

attached context (a Mirage.Context), or None. The reference to context is incremented, and should be released using GObject.Object.unref() when no longer needed.

Return type:

Mirage.Context

Retrieves the attached context.

get_option(name)
Parameters:

name (str) – option name

Returns:

a GLib.Variant containing the option value on success, None on failure.

Return type:

GLib.Variant

Retrieves option named name from the context.

This is a convenience function that retrieves a Mirage.Context from self and calls Mirage.Context.get_option().

obtain_password()
Raises:

GLib.Error

Returns:

password string on success, None on failure. The string should be freed with GLib.free() when no longer needed.

Return type:

str

Obtains password string, using the Mirage.PasswordFunction callback that was provided via Mirage.Context.set_password_function().

This is a convenience function that retrieves a Mirage.Context from self and calls Mirage.Context.obtain_password().

set_context(context)
Parameters:

context (Mirage.Context) – debug context (a Mirage.Context)

Sets/attaches a context.

do_get_context() virtual
Returns:

attached context (a Mirage.Context), or None. The reference to context is incremented, and should be released using GObject.Object.unref() when no longer needed.

Return type:

Mirage.Context

Retrieves the attached context.

do_set_context(context) virtual
Parameters:

context (Mirage.Context) – debug context (a Mirage.Context)

Sets/attaches a context.