1 // Copyright 2014 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.
5 #ifndef DEVICE_HID_UDEV_COMMON_H_
6 #define DEVICE_HID_UDEV_COMMON_H_
10 #include "base/memory/scoped_ptr.h"
14 template <typename T
, void func(T
*)>
15 void DiscardReturnType(T
* arg
) {
19 template <typename T
, T
* func(T
*)>
20 void DiscardReturnType(T
* arg
) {
24 template <typename T
, void func(T
*)>
26 void operator()(T
* enumerate
) const {
27 if (enumerate
!= NULL
)
32 typedef Deleter
<udev
, DiscardReturnType
<udev
, udev_unref
> > UdevDeleter
;
33 typedef Deleter
<udev_enumerate
,
34 DiscardReturnType
<udev_enumerate
, udev_enumerate_unref
> >
36 typedef Deleter
<udev_device
, DiscardReturnType
<udev_device
, udev_device_unref
> >
38 typedef Deleter
<udev_monitor
,
39 DiscardReturnType
<udev_monitor
, udev_monitor_unref
> >
42 typedef scoped_ptr
<udev
, UdevDeleter
> ScopedUdevPtr
;
43 typedef scoped_ptr
<udev_enumerate
, UdevEnumerateDeleter
> ScopedUdevEnumeratePtr
;
44 typedef scoped_ptr
<udev_device
, UdevDeviceDeleter
> ScopedUdevDevicePtr
;
45 typedef scoped_ptr
<udev_monitor
, UdevMonitorDeleter
> ScopedUdevMonitorPtr
;
49 #endif // DEVICE_HID_UDEV_COMMON_H_