Flutter Impeller
backend_cast.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_IMPELLER_BASE_BACKEND_CAST_H_
6 #define FLUTTER_IMPELLER_BASE_BACKEND_CAST_H_
7 
8 #include "flutter/fml/macros.h"
9 
10 namespace impeller {
11 
12 template <class Sub, class Base>
13 class BackendCast {
14  public:
15  static Sub& Cast(Base& base) { return reinterpret_cast<Sub&>(base); }
16 
17  static const Sub& Cast(const Base& base) {
18  return reinterpret_cast<const Sub&>(base);
19  }
20 
21  static Sub* Cast(Base* base) { return reinterpret_cast<Sub*>(base); }
22 
23  static const Sub* Cast(const Base* base) {
24  return reinterpret_cast<const Sub*>(base);
25  }
26 };
27 
28 } // namespace impeller
29 
30 #endif // FLUTTER_IMPELLER_BASE_BACKEND_CAST_H_
impeller::BackendCast::Cast
static const Sub * Cast(const Base *base)
Definition: backend_cast.h:23
impeller::BackendCast::Cast
static Sub * Cast(Base *base)
Definition: backend_cast.h:21
impeller::BackendCast
Definition: backend_cast.h:13
impeller::BackendCast::Cast
static Sub & Cast(Base &base)
Definition: backend_cast.h:15
impeller
Definition: aiks_context.cc:10
impeller::BackendCast::Cast
static const Sub & Cast(const Base &base)
Definition: backend_cast.h:17