| Flutter Linux Embedder |

method_call.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_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
6 #define FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
7
8 #include <memory>
9 #include <string>
10
11 namespace flutter {
12
13 class EncodableValue;
14
15 // An object encapsulating a method call from Flutter whose arguments are of
16 // type T.
17 template <typename T = EncodableValue>
18 class MethodCall {
19 public:
20 // Creates a MethodCall with the given name and arguments.
21 MethodCall(const std::string& method_name, std::unique_ptr<T> arguments)
22 : method_name_(method_name), arguments_(std::move(arguments)) {}
23
24 virtual ~MethodCall() = default;
25
26 // Prevent copying.
27 MethodCall(MethodCall<T> const&) = delete;
28 MethodCall& operator=(MethodCall<T> const&) = delete;
29
30 // The name of the method being called.
31 const std::string& method_name() const { return method_name_; }
32
33 // The arguments to the method call, or NULL if there are none.
34 const T* arguments() const { return arguments_.get(); }
35
36 private:
37 std::string method_name_;
38 std::unique_ptr<T> arguments_;
39 };
40
41 } // namespace flutter
42
43 #endif // FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_
flutter::MethodCall::~MethodCall
virtual ~MethodCall()=default
flutter::MethodCall::MethodCall
MethodCall(const std::string &method_name, std::unique_ptr< T > arguments)
Definition: method_call.h:21
flutter::MethodCall
Definition: method_call.h:18
flutter
Definition: accessibility_bridge.cc:14
flutter::MethodCall::method_name
const std::string & method_name() const
Definition: method_call.h:31
flutter::MethodCall::operator=
MethodCall & operator=(MethodCall< T > const &)=delete
flutter::MethodCall::arguments
const T * arguments() const
Definition: method_call.h:34