Flutter Linux Embedder
fl_method_codec.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CODEC_H_
6
#define FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CODEC_H_
7
8
#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION)
9
#error "Only <flutter_linux/flutter_linux.h> can be included directly."
10
#endif
11
12
#include <glib-object.h>
13
#include <gmodule.h>
14
15
#include "
fl_method_response.h
"
16
#include "
fl_value.h
"
17
18
G_BEGIN_DECLS
19
20
G_MODULE_EXPORT
21
G_DECLARE_DERIVABLE_TYPE
(FlMethodCodec,
22
fl_method_codec,
23
FL
,
24
METHOD_CODEC,
25
GObject)
26
27
/**
28
* FlMethodCodec:
29
*
30
* #FlMethodCodec is an abstract class that encodes and decodes method calls on
31
* a platform channel. Override this class to implement an encoding.
32
*
33
* #FlMethodCodec matches the MethodCodec class in the Flutter services
34
* library.
35
*/
36
37
struct
_FlMethodCodecClass {
38
GObjectClass parent_class;
39
40
/**
41
* FlMethodCodec::encode_method_call:
42
* @codec: an #FlMethodCodec.
43
* @name: method name.
44
* @args: (allow-none): method arguments, or %NULL.
45
* @error: (allow-none): #GError location to store the error occurring, or
46
* %NULL.
47
*
48
* Encodes a method call.
49
*
50
* Returns: (transfer full): a binary encoding of this method call or %NULL if
51
* not able to encode.
52
*/
53
GBytes* (*encode_method_call)(FlMethodCodec* codec,
54
const
gchar* name,
55
FlValue
*
args
,
56
GError**
error
);
57
58
/**
59
* FlMethodCodec::decode_method_call:
60
* @codec: an #FlMethodCodec
61
* @message: message to decode.
62
* @name: (transfer full): location to write method name or %NULL if not
63
* required
64
* @args: (transfer full): location to write method arguments, or %NULL if not
65
* required
66
* @error: (allow-none): #GError location to store the error occurring, or
67
* %NULL
68
*
69
* Decodes a method call.
70
*
71
* Returns: %TRUE if successfully decoded.
72
*/
73
gboolean (*
decode_method_call
)(FlMethodCodec* codec,
74
GBytes* message,
75
gchar** name,
76
FlValue
**
args
,
77
GError**
error
);
78
79
/**
80
* FlMethodCodec::encode_success_envelope:
81
* @codec: an #FlMethodCodec.
82
* @result: (allow-none): method result, or %NULL.
83
* @error: (allow-none): #GError location to store the error occurring, or
84
* %NULL.
85
*
86
* Encodes a successful response to a method call.
87
*
88
* Returns: (transfer full): a binary encoding of this response or %NULL if
89
* not able to encode.
90
*/
91
GBytes* (*encode_success_envelope)(FlMethodCodec* codec,
92
FlValue
*
result
,
93
GError**
error
);
94
95
/**
96
* FlMethodCodec::encode_error_envelope:
97
* @codec: an #FlMethodCodec.
98
* @code: an error code.
99
* @message: (allow-none): an error message, or %NULL.
100
* @details: (allow-none): error details, or %NULL.
101
* @error: (allow-none): #GError location to store the error occurring, or
102
* %NULL.
103
*
104
* Encodes an error response to a method call.
105
*
106
* Returns: (transfer full): a binary encoding of this response or %NULL if
107
* not able to encode.
108
*/
109
GBytes* (*encode_error_envelope)(FlMethodCodec* codec,
110
const
gchar* code,
111
const
gchar* message,
112
FlValue
* details,
113
GError**
error
);
114
115
/**
116
* FlMethodCodec::decode_response:
117
* @codec: an #FlMethodCodec.
118
* @message: message to decode.
119
* @error: (allow-none): #GError location to store the error occurring, or
120
* %NULL.
121
*
122
* Decodes a response to a method call.
123
*
124
* Returns: a new #FlMethodResponse or %NULL on error.
125
*/
126
FlMethodResponse* (*decode_response)(FlMethodCodec* codec,
127
GBytes* message,
128
GError**
error
);
129
};
130
131
G_END_DECLS
132
133
#endif // FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CODEC_H_
G_DECLARE_DERIVABLE_TYPE
G_DECLARE_DERIVABLE_TYPE(FlAccessibleNode, fl_accessible_node, FL, ACCESSIBLE_NODE, AtkObject)
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition:
fl_value.h:42
decode_method_call
static void decode_method_call(const char *text, gchar **name, FlValue **args)
Definition:
fl_json_method_codec_test.cc:66
FL
FL
Definition:
fl_binary_messenger.cc:27
fl_method_response.h
result
GAsyncResult * result
Definition:
fl_text_input_handler.cc:106
fl_value.h
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition:
fl_event_channel.h:89
error
const uint8_t uint32_t uint32_t GError ** error
Definition:
fl_pixel_buffer_texture_test.cc:40
shell
platform
linux
public
flutter_linux
fl_method_codec.h
Generated by
1.8.17