image_capture_core/
camera_item.rs1use cocoa::base::{id, BOOL};
2use crate::constants::ICEXIFOrientationType;
3use core_graphics::image::CGImageRef;
4use libc::c_uint;
5use libc::{c_double, off_t};
6use objc::*;
7
8pub trait ICCameraItem: Sized {
10 unsafe fn device(self) -> id;
12 unsafe fn parentFolder(self) -> id;
14 unsafe fn name(self) -> id;
16 unsafe fn UTI(self) -> id;
18 unsafe fn fileSystemPath(self) -> id;
20 unsafe fn isLocked(self) -> BOOL;
22 unsafe fn isRaw(self) -> BOOL;
24 unsafe fn isInTemporaryStore(self) -> BOOL;
26 unsafe fn creationDate(self) -> id;
28 unsafe fn modificationDate(self) -> id;
30 unsafe fn thumbnailIfAvailable(self) -> CGImageRef;
32 unsafe fn largeThumbnailIfAvailable(self) -> CGImageRef;
34 unsafe fn metadataIfAvailable(self) -> id;
36 unsafe fn userData(self) -> id;
38 unsafe fn ptpObjectHandle(self) -> c_uint;
40 unsafe fn wasAddedAfterContentCatalogCompleted(self) -> BOOL;
42}
43
44impl ICCameraItem for id {
45 unsafe fn device(self) -> id {
46 msg_send![self, device]
47 }
48
49 unsafe fn parentFolder(self) -> id {
50 msg_send![self, parentFolder]
51 }
52
53 unsafe fn name(self) -> id {
54 msg_send![self, name]
55 }
56
57 unsafe fn UTI(self) -> id {
58 msg_send![self, UTI]
59 }
60
61 unsafe fn fileSystemPath(self) -> id {
62 msg_send![self, fileSystemPath]
63 }
64
65 unsafe fn isLocked(self) -> BOOL {
66 msg_send![self, isLocked]
67 }
68
69 unsafe fn isRaw(self) -> BOOL {
70 msg_send![self, isRaw]
71 }
72
73 unsafe fn isInTemporaryStore(self) -> BOOL {
74 msg_send![self, isInTemporaryStore]
75 }
76
77 unsafe fn creationDate(self) -> id {
78 msg_send![self, creationDate]
79 }
80
81 unsafe fn modificationDate(self) -> id {
82 msg_send![self, modificationDate]
83 }
84
85 unsafe fn thumbnailIfAvailable(self) -> CGImageRef {
86 msg_send![self, thumbnailIfAvailable]
87 }
88
89 unsafe fn largeThumbnailIfAvailable(self) -> CGImageRef {
90 msg_send![self, largeThumbnailIfAvailable]
91 }
92
93 unsafe fn metadataIfAvailable(self) -> id {
94 msg_send![self, metadataIfAvailable]
95 }
96
97 unsafe fn userData(self) -> id {
98 msg_send![self, userData]
99 }
100
101 unsafe fn ptpObjectHandle(self) -> c_uint {
102 msg_send![self, ptpObjectHandle]
103 }
104
105 unsafe fn wasAddedAfterContentCatalogCompleted(self) -> BOOL {
106 msg_send![self, wasAddedAfterContentCatalogCompleted]
107 }
108}
109
110pub trait ICCameraFolder: Sized {
112 unsafe fn contents(self) -> id;
114}
115
116impl ICCameraFolder for id {
117 unsafe fn contents(self) -> id {
118 msg_send![self, contents]
119 }
120}
121
122pub trait ICCameraFile: Sized {
124 unsafe fn fileSize(self) -> off_t;
126 unsafe fn orientation(self) -> ICEXIFOrientationType;
128 unsafe fn duration(self) -> c_double;
130 unsafe fn sidecarFiles(self) -> id;
134}
135
136impl ICCameraFile for id {
137 unsafe fn fileSize(self) -> off_t {
138 msg_send![self, fileSize]
139 }
140
141 unsafe fn orientation(self) -> ICEXIFOrientationType {
142 msg_send![self, orientation]
143 }
144
145 unsafe fn duration(self) -> c_double {
146 msg_send![self, duration]
147 }
148
149 unsafe fn sidecarFiles(self) -> id {
150 msg_send![self, sidecarFiles]
151 }
152}