Pepper_47_C++_interfaces
remote_controller_samsung.cc
Go to the documentation of this file.
1 // Copyright 2016 Samsung Electronics. 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 
6 
7 #include "ppapi/c/pp_errors.h"
9 
10 namespace pp {
11 
12 namespace {
13 
14 template <>
15 const char* interface_name<PPB_RemoteController_Samsung_0_1>() {
16  return PPB_REMOTECONTROLLER_SAMSUNG_INTERFACE_0_1;
17 }
18 
19 } // namespace
20 
22  : instance_(instance) {}
23 
25  const char* keys[]) {
26  if (!has_interface<PPB_RemoteController_Samsung_0_1>())
27  return PP_ERROR_NOINTERFACE;
28 
29  return get_interface<PPB_RemoteController_Samsung_0_1>()->RegisterKeys(
30  instance_.pp_instance(), key_count, keys);
31 }
32 
34  const std::vector<std::string>& keys) {
35  std::vector<const char*> v;
36  v.reserve(keys.size());
37  for (uint32_t i = 0; i < keys.size(); ++i)
38  v.push_back(keys[i].c_str());
39  return RegisterKeys(static_cast<uint32_t>(v.size()), &v[0]);
40 }
41 
43  const char* keys[]) {
44  if (!has_interface<PPB_RemoteController_Samsung_0_1>())
45  return PP_ERROR_NOINTERFACE;
46 
47  return get_interface<PPB_RemoteController_Samsung_0_1>()->UnRegisterKeys(
48  instance_.pp_instance(), key_count, keys);
49 }
50 
52  const std::vector<std::string>& keys) {
53  std::vector<const char*> v;
54  v.reserve(keys.size());
55  for (uint32_t i = 0; i < keys.size(); ++i)
56  v.push_back(keys[i].c_str());
57  return UnRegisterKeys(static_cast<uint32_t>(v.size()), &v[0]);
58 }
59 
60 } // namespace pp
RemoteControllerSamsung(const InstanceHandle &instance)
int32_t UnRegisterKeys(uint32_t key_count, const char *keys[])
int32_t RegisterKeys(uint32_t key_count, const char *keys[])
PP_Instance pp_instance() const