123456789101112131415161718192021222324252627282930313233343536 |
- #ifndef BASE_MAC_SCOPED_IOOBJECT_H_
- #define BASE_MAC_SCOPED_IOOBJECT_H_
- #include <IOKit/IOKitLib.h>
- #include "base/mac/scoped_typeref.h"
- namespace base {
- namespace mac {
- namespace internal {
- template <typename IOT>
- struct ScopedIOObjectTraits {
- static IOT InvalidValue() { return IO_OBJECT_NULL; }
- static IOT Retain(IOT iot) {
- IOObjectRetain(iot);
- return iot;
- }
- static void Release(IOT iot) { IOObjectRelease(iot); }
- };
- }
- template <typename IOT>
- using ScopedIOObject = ScopedTypeRef<IOT, internal::ScopedIOObjectTraits<IOT>>;
- }
- }
- #endif
|