A wrapper factory returns the "fittest" wrapper object given a
pointer to a wrapped "thing".
A wrapper factory would implement the typing policy described in the
wrapper library documentation. In fact some libraries implement their
own type system like GObject, while other having smaller scopes will
describe the types of each returned pointer, sometime being polymorphic.
If the developer needs to create wrappers of several different types and
those types are pre-defined, known during the development of the
wrapper, for example when the actual returned type is explained in the
documentation of the library it is sometimes better to use (as a client)
one of its expanded variant, i.e. G_OBJECT_EXPANDED_FACTORY.
It could be newly created or
retrieved from a cache, a dictionary, from the underlying
object, depending on the implementation.
See also wrapper_or_void: when a_pointer is the
default pointer (known as NULL in C) Result will be Void.
A wrapper for a_pointer or Void if a_pointer
default_pointer (NULL in C).
A commodity feature to
replace the following code snippet:
my_gobject: A_WRAPPER
local p: POINTER
do
p := get_foo(handle)
if p.is_not_null then
Result := factory.wrapper(p)
end
end
with
my_gobject: A_G_OBJECT_HEIR
do
Result := factory.wrapper_or_void(get_foo(handle))
end
ensure
null_pointer_returns_void: a_pointer.is_null implies Result = Void
correct: a_pointer.is_not_null implies Result /= Void and then Result.handle = a_pointer
This exception occurs when Void is passed as the expression
to inspect ("inspect on STRING only).
This exception also occurs when the inspected value selects no branch (when the keyword "else"
not used, one "when" branch _must_ be selected). Some value which is not one of the inspect
constants, if there is no Else_part
o