Flutter Engine
The Flutter Engine
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_METHOD_CALL_H_
6#define FLUTTER_SHELL_PLATFORM_COMMON_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CALL_H_
7
8#include <memory>
9#include <string>
10
11namespace flutter {
12
13class EncodableValue;
14
15// An object encapsulating a method call from Flutter whose arguments are of
16// type T.
17template <typename T = EncodableValue>
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;
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_METHOD_CALL_H_
const std::string & method_name() const
Definition: method_call.h:31
MethodCall & operator=(MethodCall< T > const &)=delete
MethodCall(MethodCall< T > const &)=delete
virtual ~MethodCall()=default
const T * arguments() const
Definition: method_call.h:34
MethodCall(const std::string &method_name, std::unique_ptr< T > arguments)
Definition: method_call.h:21
Definition: ref_ptr.h:256
#define T
Definition: precompiler.cc:65