Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Adapter.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkottieAdapter_DEFINED
9#define SkottieAdapter_DEFINED
10
12
13namespace skottie {
14namespace internal {
15
16template <typename AdapterT, typename T>
18public:
19 template <typename... Args>
20 static sk_sp<AdapterT> Make(Args&&... args) {
21 sk_sp<AdapterT> adapter(new AdapterT(std::forward<Args>(args)...));
22 adapter->shrink_to_fit();
23 return adapter;
24 }
25
26 const sk_sp<T>& node() const { return fNode; }
27
28protected:
30 : fNode(T::Make()) {}
31
33 : fNode(std::move(node)) {}
34
35private:
36 const sk_sp<T> fNode;
37};
38
39} // namespace internal
40} // namespace skottie
41
42#endif // SkottieAdapter_DEFINED
const sk_sp< T > & node() const
Definition Adapter.h:26
static sk_sp< AdapterT > Make(Args &&... args)
Definition Adapter.h:20
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition ref_ptr.h:256
#define T