pepper_interface_dummy.h revision 3551c9c881056c480085172ff9840cab31610854
1/* Copyright (c) 2013 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 LIBRARIES_NACL_IO_PEPPER_INTERFACE_DUMMY_H_ 6#define LIBRARIES_NACL_IO_PEPPER_INTERFACE_DUMMY_H_ 7 8#include "nacl_io/pepper_interface.h" 9 10// This class simplifies implementing a PepperInterface-derived class where you 11// don't care about certain interfaces. All interface-getters return NULL by 12// default. 13// 14// For example: 15// 16// class FooPepperInterface : public PepperInterfaceDummy { 17// public: 18// CoreInterface* GetCoreInterface() { ... }; 19// }; 20// 21// // FooPepperInterface is not abstract -- all pure virtual functions have 22// been defined to return NULL. 23 24namespace nacl_io { 25 26class PepperInterfaceDummy : public PepperInterface { 27 public: 28 PepperInterfaceDummy() {} 29 virtual ~PepperInterfaceDummy() {} 30 virtual PP_Instance GetInstance() { return 0; } 31 32// Interface getters. 33#include "nacl_io/pepper/undef_macros.h" 34#include "nacl_io/pepper/define_empty_macros.h" 35#undef BEGIN_INTERFACE 36#define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ 37 virtual BaseClass* Get##BaseClass() { return NULL; } 38#include "nacl_io/pepper/all_interfaces.h" 39}; 40 41} // namespace nacl_io 42 43#endif // LIBRARIES_NACL_IO_PEPPER_INTERFACE_DUMMY_H_ 44