| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
GI.Json.Callbacks
Description
Synopsis
- type ArrayForeach = Array -> Word32 -> Node -> IO ()
- type ArrayForeach_WithClosures = Array -> Word32 -> Node -> Ptr () -> IO ()
- type C_ArrayForeach = Ptr Array -> Word32 -> Ptr Node -> Ptr () -> IO ()
- drop_closures_ArrayForeach :: ArrayForeach -> ArrayForeach_WithClosures
- dynamic_ArrayForeach :: (HasCallStack, MonadIO m) => FunPtr C_ArrayForeach -> Array -> Word32 -> Node -> Ptr () -> m ()
- genClosure_ArrayForeach :: MonadIO m => ArrayForeach -> m (GClosure C_ArrayForeach)
- mk_ArrayForeach :: C_ArrayForeach -> IO (FunPtr C_ArrayForeach)
- noArrayForeach :: Maybe ArrayForeach
- noArrayForeach_WithClosures :: Maybe ArrayForeach_WithClosures
- wrap_ArrayForeach :: Maybe (Ptr (FunPtr C_ArrayForeach)) -> ArrayForeach_WithClosures -> C_ArrayForeach
- type BoxedDeserializeFunc = Node -> IO (Ptr ())
- type C_BoxedDeserializeFunc = Ptr Node -> IO (Ptr ())
- dynamic_BoxedDeserializeFunc :: (HasCallStack, MonadIO m) => FunPtr C_BoxedDeserializeFunc -> Node -> m (Ptr ())
- genClosure_BoxedDeserializeFunc :: MonadIO m => BoxedDeserializeFunc -> m (GClosure C_BoxedDeserializeFunc)
- mk_BoxedDeserializeFunc :: C_BoxedDeserializeFunc -> IO (FunPtr C_BoxedDeserializeFunc)
- noBoxedDeserializeFunc :: Maybe BoxedDeserializeFunc
- wrap_BoxedDeserializeFunc :: Maybe (Ptr (FunPtr C_BoxedDeserializeFunc)) -> BoxedDeserializeFunc -> C_BoxedDeserializeFunc
- type BoxedSerializeFunc = Ptr () -> IO Node
- type C_BoxedSerializeFunc = Ptr () -> IO (Ptr Node)
- dynamic_BoxedSerializeFunc :: (HasCallStack, MonadIO m) => FunPtr C_BoxedSerializeFunc -> Ptr () -> m Node
- genClosure_BoxedSerializeFunc :: MonadIO m => BoxedSerializeFunc -> m (GClosure C_BoxedSerializeFunc)
- mk_BoxedSerializeFunc :: C_BoxedSerializeFunc -> IO (FunPtr C_BoxedSerializeFunc)
- noBoxedSerializeFunc :: Maybe BoxedSerializeFunc
- wrap_BoxedSerializeFunc :: Maybe (Ptr (FunPtr C_BoxedSerializeFunc)) -> BoxedSerializeFunc -> C_BoxedSerializeFunc
- type C_ObjectForeach = Ptr Object -> CString -> Ptr Node -> Ptr () -> IO ()
- type ObjectForeach = Object -> Text -> Node -> IO ()
- type ObjectForeach_WithClosures = Object -> Text -> Node -> Ptr () -> IO ()
- drop_closures_ObjectForeach :: ObjectForeach -> ObjectForeach_WithClosures
- dynamic_ObjectForeach :: (HasCallStack, MonadIO m) => FunPtr C_ObjectForeach -> Object -> Text -> Node -> Ptr () -> m ()
- genClosure_ObjectForeach :: MonadIO m => ObjectForeach -> m (GClosure C_ObjectForeach)
- mk_ObjectForeach :: C_ObjectForeach -> IO (FunPtr C_ObjectForeach)
- noObjectForeach :: Maybe ObjectForeach
- noObjectForeach_WithClosures :: Maybe ObjectForeach_WithClosures
- wrap_ObjectForeach :: Maybe (Ptr (FunPtr C_ObjectForeach)) -> ObjectForeach_WithClosures -> C_ObjectForeach
Signals
ArrayForeach
type ArrayForeach Source #
Arguments
| = Array |
|
| -> Word32 |
|
| -> Node |
|
| -> IO () |
The function to be passed to [methodjson.Array.foreach_element].
You should not add or remove elements to and from array within
this function.
It is safe to change the value of elementNode.
Since: 0.8
type ArrayForeach_WithClosures Source #
Arguments
| = Array |
|
| -> Word32 |
|
| -> Node |
|
| -> Ptr () |
|
| -> IO () |
The function to be passed to [methodjson.Array.foreach_element].
You should not add or remove elements to and from array within
this function.
It is safe to change the value of elementNode.
Since: 0.8
type C_ArrayForeach = Ptr Array -> Word32 -> Ptr Node -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
drop_closures_ArrayForeach :: ArrayForeach -> ArrayForeach_WithClosures Source #
A simple wrapper that ignores the closure arguments.
Arguments
| :: (HasCallStack, MonadIO m) | |
| => FunPtr C_ArrayForeach | |
| -> Array |
|
| -> Word32 |
|
| -> Node |
|
| -> Ptr () |
|
| -> m () |
Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
genClosure_ArrayForeach :: MonadIO m => ArrayForeach -> m (GClosure C_ArrayForeach) Source #
Wrap the callback into a GClosure.
mk_ArrayForeach :: C_ArrayForeach -> IO (FunPtr C_ArrayForeach) Source #
Generate a function pointer callable from C code, from a C_ArrayForeach.
noArrayForeach :: Maybe ArrayForeach Source #
A convenience synonym for .Nothing :: Maybe ArrayForeach
noArrayForeach_WithClosures :: Maybe ArrayForeach_WithClosures Source #
A convenience synonym for .Nothing :: Maybe ArrayForeach_WithClosures
wrap_ArrayForeach :: Maybe (Ptr (FunPtr C_ArrayForeach)) -> ArrayForeach_WithClosures -> C_ArrayForeach Source #
Wrap a ArrayForeach into a C_ArrayForeach.
BoxedDeserializeFunc
type BoxedDeserializeFunc Source #
Arguments
| = Node |
|
| -> IO (Ptr ()) | Returns: the newly created boxed structure |
Deserializes the contents of the passed JsonNode into a GBoxed, for instance:
``@c static gpointer my_point_deserialize (JsonNode *node) { double x = 0.0, y = 0.0;
if (JSON_NODE_HOLDS_ARRAY (node)) { JsonArray *array = json_node_get_array (node);
if (json_array_get_length (array) == 2) { x = json_array_get_double_element (array, 0); y = json_array_get_double_element (array, 1); } } else if (JSON_NODE_HOLDS_OBJECT (node)) { JsonObject *obj = json_node_get_object (node);
x = json_object_get_double_member_with_default (obj, "x", 0.0); y = json_object_get_double_member_with_default (obj, "y", 0.0); }
// my_point_new() is defined elsewhere return my_point_new (x, y); } @``
Since: 0.10
type C_BoxedDeserializeFunc = Ptr Node -> IO (Ptr ()) Source #
Type for the callback on the (unwrapped) C side.
dynamic_BoxedDeserializeFunc Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => FunPtr C_BoxedDeserializeFunc | |
| -> Node |
|
| -> m (Ptr ()) | Returns: the newly created boxed structure |
Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
genClosure_BoxedDeserializeFunc :: MonadIO m => BoxedDeserializeFunc -> m (GClosure C_BoxedDeserializeFunc) Source #
Wrap the callback into a GClosure.
mk_BoxedDeserializeFunc :: C_BoxedDeserializeFunc -> IO (FunPtr C_BoxedDeserializeFunc) Source #
Generate a function pointer callable from C code, from a C_BoxedDeserializeFunc.
noBoxedDeserializeFunc :: Maybe BoxedDeserializeFunc Source #
A convenience synonym for .Nothing :: Maybe BoxedDeserializeFunc
wrap_BoxedDeserializeFunc :: Maybe (Ptr (FunPtr C_BoxedDeserializeFunc)) -> BoxedDeserializeFunc -> C_BoxedDeserializeFunc Source #
Wrap a BoxedDeserializeFunc into a C_BoxedDeserializeFunc.
BoxedSerializeFunc
type BoxedSerializeFunc Source #
Arguments
| = Ptr () |
|
| -> IO Node | Returns: the newly created JSON node tree representing the boxed data |
Serializes the passed GBoxed and stores it inside a JsonNode, for instance:
``@c static JsonNode * my_point_serialize (gconstpointer boxed) { const MyPoint *point = boxed;
g_autoptr(JsonBuilder) builder = json_builder_new ();
json_builder_begin_object (builder); json_builder_set_member_name (builder, "x"); json_builder_add_double_value (builder, point->x); json_builder_set_member_name (builder, "y"); json_builder_add_double_value (builder, point->y); json_builder_end_object (builder);
return json_builder_get_root (builder); } @``
Since: 0.10
type C_BoxedSerializeFunc = Ptr () -> IO (Ptr Node) Source #
Type for the callback on the (unwrapped) C side.
dynamic_BoxedSerializeFunc Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => FunPtr C_BoxedSerializeFunc | |
| -> Ptr () |
|
| -> m Node | Returns: the newly created JSON node tree representing the boxed data |
Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
genClosure_BoxedSerializeFunc :: MonadIO m => BoxedSerializeFunc -> m (GClosure C_BoxedSerializeFunc) Source #
Wrap the callback into a GClosure.
mk_BoxedSerializeFunc :: C_BoxedSerializeFunc -> IO (FunPtr C_BoxedSerializeFunc) Source #
Generate a function pointer callable from C code, from a C_BoxedSerializeFunc.
noBoxedSerializeFunc :: Maybe BoxedSerializeFunc Source #
A convenience synonym for .Nothing :: Maybe BoxedSerializeFunc
wrap_BoxedSerializeFunc :: Maybe (Ptr (FunPtr C_BoxedSerializeFunc)) -> BoxedSerializeFunc -> C_BoxedSerializeFunc Source #
Wrap a BoxedSerializeFunc into a C_BoxedSerializeFunc.
ObjectForeach
type C_ObjectForeach = Ptr Object -> CString -> Ptr Node -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type ObjectForeach Source #
Arguments
| = Object |
|
| -> Text |
|
| -> Node |
|
| -> IO () |
The function to be passed to [methodjson.Object.foreach_member].
You should not add or remove members to and from object within
this function.
It is safe to change the value of memberNode.
Since: 0.8
type ObjectForeach_WithClosures Source #
Arguments
| = Object |
|
| -> Text |
|
| -> Node |
|
| -> Ptr () |
|
| -> IO () |
The function to be passed to [methodjson.Object.foreach_member].
You should not add or remove members to and from object within
this function.
It is safe to change the value of memberNode.
Since: 0.8
drop_closures_ObjectForeach :: ObjectForeach -> ObjectForeach_WithClosures Source #
A simple wrapper that ignores the closure arguments.
dynamic_ObjectForeach Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => FunPtr C_ObjectForeach | |
| -> Object |
|
| -> Text |
|
| -> Node |
|
| -> Ptr () |
|
| -> m () |
Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
genClosure_ObjectForeach :: MonadIO m => ObjectForeach -> m (GClosure C_ObjectForeach) Source #
Wrap the callback into a GClosure.
mk_ObjectForeach :: C_ObjectForeach -> IO (FunPtr C_ObjectForeach) Source #
Generate a function pointer callable from C code, from a C_ObjectForeach.
noObjectForeach :: Maybe ObjectForeach Source #
A convenience synonym for .Nothing :: Maybe ObjectForeach
noObjectForeach_WithClosures :: Maybe ObjectForeach_WithClosures Source #
A convenience synonym for .Nothing :: Maybe ObjectForeach_WithClosures
wrap_ObjectForeach :: Maybe (Ptr (FunPtr C_ObjectForeach)) -> ObjectForeach_WithClosures -> C_ObjectForeach Source #
Wrap a ObjectForeach into a C_ObjectForeach.