1 // Copyright 2016 The Chromium 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 MOJO_PUBLIC_CPP_BINDINGS_RAW_PTR_IMPL_REF_TRAITS_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_RAW_PTR_IMPL_REF_TRAITS_H_ 7 8 namespace mojo { 9 10 // Default traits for a binding's implementation reference type. This 11 // corresponds to a raw pointer. 12 template <typename Interface> 13 struct RawPtrImplRefTraits { 14 using PointerType = Interface*; 15 IsNullRawPtrImplRefTraits16 static bool IsNull(PointerType ptr) { return !ptr; } GetRawPointerRawPtrImplRefTraits17 static Interface* GetRawPointer(PointerType* ptr) { return *ptr; } 18 }; 19 20 } // namespace mojo 21 22 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_RAW_PTR_IMPL_REF_TRAITS_H_ 23