| Flutter Linux Embedder |

Classes | Functions | Variables
fl_method_response.cc File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_response.h"`
`#include <gmodule.h>`

Go to the source code of this file.

## Classes
struct | _FlMethodSuccessResponse
struct | _FlMethodErrorResponse
struct | _FlMethodNotImplementedResponse

## Functions
| G_DEFINE_TYPE (FlMethodSuccessResponse, fl_method_success_response, fl_method_response_get_type()) G_DEFINE_TYPE(FlMethodErrorResponse
| fl_method_response_get_type ()) G_DEFINE_TYPE(FlMethodNotImplementedResponse
static void | fl_method_response_init (FlMethodResponse *self)
static void | fl_method_success_response_dispose (GObject *object)
static void | fl_method_success_response_class_init (FlMethodSuccessResponseClass *klass)
static void | fl_method_success_response_init (FlMethodSuccessResponse *self)
static void | fl_method_error_response_dispose (GObject *object)
static void | fl_method_error_response_class_init (FlMethodErrorResponseClass *klass)
static void | fl_method_error_response_init (FlMethodErrorResponse *self)
static void | fl_method_not_implemented_response_class_init (FlMethodNotImplementedResponseClass *klass)
static void | fl_method_not_implemented_response_init (FlMethodNotImplementedResponse *self)
G_MODULE_EXPORT FlValue * | fl_method_response_get_result (FlMethodResponse *self, GError **error)
G_MODULE_EXPORT FlMethodSuccessResponse * | fl_method_success_response_new (FlValue *result)
G_MODULE_EXPORT FlValue * | fl_method_success_response_get_result (FlMethodSuccessResponse *self)
G_MODULE_EXPORT FlMethodErrorResponse * | fl_method_error_response_new (const gchar *code, const gchar *message, FlValue *details)
const G_MODULE_EXPORT gchar * | fl_method_error_response_get_code (FlMethodErrorResponse *self)
const G_MODULE_EXPORT gchar * | fl_method_error_response_get_message (FlMethodErrorResponse *self)
G_MODULE_EXPORT FlValue * | fl_method_error_response_get_details (FlMethodErrorResponse *self)
G_MODULE_EXPORT FlMethodNotImplementedResponse * | fl_method_not_implemented_response_new ()

## Variables
| fl_method_error_response
| fl_method_not_implemented_response

## Function Documentation

## ◆ fl_method_error_response_class_init()

static void fl_method_error_response_class_init | ( | FlMethodErrorResponseClass * | klass | ) |
| static

Definition at line 69 of file fl_method_response.cc.

70 {
71 G_OBJECT_CLASS(klass)->dispose = fl_method_error_response_dispose;
72 }

References fl_method_error_response_dispose().

## ◆ fl_method_error_response_dispose()

static void fl_method_error_response_dispose | ( | GObject * | object | ) |
| static

Definition at line 59 of file fl_method_response.cc.

59 {
60 FlMethodErrorResponse* self = FL_METHOD_ERROR_RESPONSE(object);
61
62 g_clear_pointer(&self->code, g_free);
63 g_clear_pointer(&self->message, g_free);
64 g_clear_pointer(&self->details, fl_value_unref);
65
66 G_OBJECT_CLASS(fl_method_error_response_parent_class)->dispose(object);
67 }

References fl_value_unref().

Referenced by fl_method_error_response_class_init().

## ◆ fl_method_error_response_get_code()

const G_MODULE_EXPORT gchar* fl_method_error_response_get_code | ( | FlMethodErrorResponse * | self | ) |

Definition at line 160 of file fl_method_response.cc.

161 {
162 g_return_val_if_fail(FL_IS_METHOD_ERROR_RESPONSE(self), nullptr);
163 return self->code;
164 }

Referenced by decode_response_with_error(), fl_method_codec_encode_response(), fl_method_response_get_result(), message_cb(), and TEST().

## ◆ fl_method_error_response_get_details()

G_MODULE_EXPORT FlValue* fl_method_error_response_get_details | ( | FlMethodErrorResponse * | self | ) |

Definition at line 172 of file fl_method_response.cc.

173 {
174 g_return_val_if_fail(FL_IS_METHOD_ERROR_RESPONSE(self), nullptr);
175 return self->details;
176 }

Referenced by decode_response_with_error(), fl_method_codec_encode_response(), fl_method_response_get_result(), message_cb(), and TEST().

## ◆ fl_method_error_response_get_message()

const G_MODULE_EXPORT gchar* fl_method_error_response_get_message | ( | FlMethodErrorResponse * | self | ) |

Definition at line 166 of file fl_method_response.cc.

167 {
168 g_return_val_if_fail(FL_IS_METHOD_ERROR_RESPONSE(self), nullptr);
169 return self->message;
170 }

Referenced by decode_response_with_error(), fl_method_codec_encode_response(), fl_method_response_get_result(), message_cb(), and TEST().

## ◆ fl_method_error_response_init()

static void fl_method_error_response_init | ( | FlMethodErrorResponse * | self | ) |
| static

Definition at line 74 of file fl_method_response.cc.

74 {}

## ◆ fl_method_error_response_new()

G_MODULE_EXPORT FlMethodErrorResponse* fl_method_error_response_new | ( | const gchar * | code,
|  | const gchar * | message,
|  | FlValue * | details
| ) |  |

Definition at line 144 of file fl_method_response.cc.

147 {
148 g_return_val_if_fail(code != nullptr, nullptr);
149
150 FlMethodErrorResponse* self = FL_METHOD_ERROR_RESPONSE(
151 g_object_new(fl_method_error_response_get_type(), nullptr));
152
153 self->code = g_strdup(code);
154 self->message = g_strdup(message);
155 self->details = details != nullptr ? fl_value_ref(details) : nullptr;
156
157 return self;
158 }

References fl_value_ref().

Referenced by activate_system_cursor(), clipboard_get_data(), clipboard_set_data(), fl_json_method_codec_decode_response(), fl_method_call_respond_error(), fl_standard_method_codec_decode_response(), fl_test_codec_decode_response(), handle_method_call(), set_client(), set_editable_size_and_transform(), system_exit_application(), system_sound_play(), and TEST().

## ◆ fl_method_not_implemented_response_class_init()

static void fl_method_not_implemented_response_class_init | ( | FlMethodNotImplementedResponseClass * | klass | ) |
| static

Definition at line 76 of file fl_method_response.cc.

77 {}

## ◆ fl_method_not_implemented_response_init()

static void fl_method_not_implemented_response_init | ( | FlMethodNotImplementedResponse * | self | ) |
| static

Definition at line 79 of file fl_method_response.cc.

80 {}

## ◆ fl_method_not_implemented_response_new()

G_MODULE_EXPORT FlMethodNotImplementedResponse* fl_method_not_implemented_response_new | ( |  | ) |

Definition at line 179 of file fl_method_response.cc.

179 {
180 return FL_METHOD_NOT_IMPLEMENTED_RESPONSE(
181 g_object_new(fl_method_not_implemented_response_get_type(), nullptr));
182 }

Referenced by fl_method_call_respond_not_implemented(), fl_method_codec_decode_response(), method_call_cb(), and TEST().

## ◆ fl_method_response_get_result()

G_MODULE_EXPORT FlValue* fl_method_response_get_result | ( | FlMethodResponse * | self,
|  | GError ** | error
| ) |  |

Definition at line 82 of file fl_method_response.cc.

83 {
84 if (FL_IS_METHOD_SUCCESS_RESPONSE(self)) {
85 return fl_method_success_response_get_result(
86 FL_METHOD_SUCCESS_RESPONSE(self));
87 }
88
89 if (FL_IS_METHOD_ERROR_RESPONSE(self)) {
90 const gchar* code =
91 fl_method_error_response_get_code(FL_METHOD_ERROR_RESPONSE(self));
92 const gchar* message =
93 fl_method_error_response_get_message(FL_METHOD_ERROR_RESPONSE(self));
94 FlValue* details =
95 fl_method_error_response_get_details(FL_METHOD_ERROR_RESPONSE(self));
96 g_autofree gchar* details_text = nullptr;
97 if (details != nullptr) {
98 details_text = fl_value_to_string(details);
99 }
100
101 g_autoptr(GString) error_message = g_string_new("");
102 g_string_append_printf(error_message, "Remote code returned error %s",
103 code);
104 if (message != nullptr) {
105 g_string_append_printf(error_message, ": %s", message);
106 }
107 if (details_text != nullptr) {
108 g_string_append_printf(error_message, " %s", details_text);
109 }
110 g_set_error_literal(error, FL_METHOD_RESPONSE_ERROR,
111 FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR,
112 error_message->str);
113 return nullptr;
114 } else if (FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE(self)) {
115 g_set_error(error, FL_METHOD_RESPONSE_ERROR,
116 FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED,
117 "Requested method is not implemented");
118 return nullptr;
119 } else {
120 g_set_error(error, FL_METHOD_RESPONSE_ERROR,
121 FL_METHOD_RESPONSE_ERROR_FAILED, "Unknown response type");
122 return nullptr;
123 }
124 }

References error, fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), FL_METHOD_RESPONSE_ERROR, FL_METHOD_RESPONSE_ERROR_FAILED, FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED, FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR, fl_method_success_response_get_result(), and fl_value_to_string().

Referenced by fl_text_input_channel_perform_action_finish(), fl_text_input_channel_update_editing_state_finish(), fl_text_input_channel_update_editing_state_with_deltas_finish(), get_exit_response(), and TEST().

## ◆ fl_method_response_get_type()

fl_method_response_get_type | ( |  | ) |

Definition at line 38 of file fl_method_response.cc.

40 {}

## ◆ fl_method_response_init()

static void fl_method_response_init | ( | FlMethodResponse * | self | ) |
| static

Definition at line 42 of file fl_method_response.cc.

42 {}

## ◆ fl_method_success_response_class_init()

static void fl_method_success_response_class_init | ( | FlMethodSuccessResponseClass * | klass | ) |
| static

Definition at line 52 of file fl_method_response.cc.

53 {
54 G_OBJECT_CLASS(klass)->dispose = fl_method_success_response_dispose;
55 }

References fl_method_success_response_dispose().

## ◆ fl_method_success_response_dispose()

static void fl_method_success_response_dispose | ( | GObject * | object | ) |
| static

Definition at line 44 of file fl_method_response.cc.

44 {
45 FlMethodSuccessResponse* self = FL_METHOD_SUCCESS_RESPONSE(object);
46
47 g_clear_pointer(&self->result, fl_value_unref);
48
49 G_OBJECT_CLASS(fl_method_success_response_parent_class)->dispose(object);
50 }

References fl_value_unref().

Referenced by fl_method_success_response_class_init().

## ◆ fl_method_success_response_get_result()

G_MODULE_EXPORT FlValue* fl_method_success_response_get_result | ( | FlMethodSuccessResponse * | response | ) |

fl_method_success_response_get_result: @response: an #FlMethodSuccessResponse.

Gets the result of the method call.

Returns: an FlValue.

Definition at line 138 of file fl_method_response.cc.

139 {
140 g_return_val_if_fail(FL_IS_METHOD_SUCCESS_RESPONSE(self), nullptr);
141 return self->result;
142 }

Referenced by decode_response_with_success(), fl_method_codec_encode_response(), fl_method_response_get_result(), fl_test_application_activate(), set_client(), set_editing_state(), and TEST().

## ◆ fl_method_success_response_init()

static void fl_method_success_response_init | ( | FlMethodSuccessResponse * | self | ) |
| static

Definition at line 57 of file fl_method_response.cc.

57 {}

## ◆ fl_method_success_response_new()

G_MODULE_EXPORT FlMethodSuccessResponse* fl_method_success_response_new | ( | FlValue * | result | ) |

fl_method_success_response_new:

Returns
  : (allow-none): the FlValue returned by the method call or NULL.

Creates a response to a method call when that method has successfully completed.

Returns: a new #FlMethodResponse.

Definition at line 126 of file fl_method_response.cc.

127 {
128 FlMethodSuccessResponse* self = FL_METHOD_SUCCESS_RESPONSE(
129 g_object_new(fl_method_success_response_get_type(), nullptr));
130
131 if (result != nullptr) {
132 self->result = fl_value_ref(result);
133 }
134
135 return self;
136 }

References fl_value_ref().

Referenced by activate_system_cursor(), clear_client(), clipboard_set_data(), fl_json_method_codec_decode_response(), fl_method_call_respond_success(), fl_platform_channel_make_system_request_app_exit_response(), fl_platform_channel_respond_clipboard_get_data(), fl_platform_channel_respond_clipboard_has_strings(), fl_standard_method_codec_decode_response(), fl_test_codec_decode_response(), get_keyboard_state(), hide(), set_client(), set_editable_size_and_transform(), set_editing_state(), set_marked_text_rect(), show(), system_initialization_complete(), system_navigator_pop(), system_sound_play(), and TEST().

## ◆ G_DEFINE_TYPE()

G_DEFINE_TYPE | ( | FlMethodSuccessResponse | ,
|  | fl_method_success_response | ,
|  | fl_method_response_get_type() |
| ) |  |

## Variable Documentation

## ◆ fl_method_error_response

fl_method_error_response

Definition at line 34 of file fl_method_response.cc.

## ◆ fl_method_not_implemented_response

fl_method_not_implemented_response

Definition at line 37 of file fl_method_response.cc.

FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR
@ FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR
Definition: fl_method_response.h:34
fl_method_success_response_dispose
static void fl_method_success_response_dispose(GObject *object)
Definition: fl_method_response.cc:44
FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED
@ FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED
Definition: fl_method_response.h:35
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
fl_method_error_response_dispose
static void fl_method_error_response_dispose(GObject *object)
Definition: fl_method_response.cc:59
fl_method_error_response_get_message
const G_MODULE_EXPORT gchar * fl_method_error_response_get_message(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:166
FL_METHOD_RESPONSE_ERROR_FAILED
@ FL_METHOD_RESPONSE_ERROR_FAILED
Definition: fl_method_response.h:33
fl_value_unref
G_MODULE_EXPORT void fl_value_unref(FlValue *self)
Definition: fl_value.cc:400
fl_value_ref
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:394
fl_method_error_response_get_details
G_MODULE_EXPORT FlValue * fl_method_error_response_get_details(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:172
FL_METHOD_RESPONSE_ERROR
#define FL_METHOD_RESPONSE_ERROR
Definition: fl_method_response.h:30
fl_method_success_response_get_result
G_MODULE_EXPORT FlValue * fl_method_success_response_get_result(FlMethodSuccessResponse *self)
Definition: fl_method_response.cc:138
fl_method_error_response_get_code
const G_MODULE_EXPORT gchar * fl_method_error_response_get_code(FlMethodErrorResponse *self)
Definition: fl_method_response.cc:160
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
fl_value_to_string
G_MODULE_EXPORT gchar * fl_value_to_string(FlValue *value)
Definition: fl_value.cc:846