1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13#[doc(alias = "SKIndexRef")]
15#[repr(C)]
16pub struct SKIndex {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21cf_type!(
22 unsafe impl SKIndex {}
23);
24#[cfg(feature = "objc2")]
25cf_objc2_type!(
26 unsafe impl RefEncode<"__SKIndex"> for SKIndex {}
27);
28
29unsafe impl ConcreteType for SKIndex {
30 #[doc(alias = "SKIndexGetTypeID")]
31 #[inline]
32 fn type_id() -> CFTypeID {
33 extern "C-unwind" {
34 fn SKIndexGetTypeID() -> CFTypeID;
35 }
36 unsafe { SKIndexGetTypeID() }
37 }
38}
39
40#[doc(alias = "SKIndexDocumentIteratorRef")]
42#[repr(C)]
43pub struct SKIndexDocumentIterator {
44 inner: [u8; 0],
45 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
46}
47
48cf_type!(
49 unsafe impl SKIndexDocumentIterator {}
50);
51#[cfg(feature = "objc2")]
52cf_objc2_type!(
53 unsafe impl RefEncode<"__SKIndexDocumentIterator"> for SKIndexDocumentIterator {}
54);
55
56unsafe impl ConcreteType for SKIndexDocumentIterator {
57 #[doc(alias = "SKIndexDocumentIteratorGetTypeID")]
58 #[inline]
59 fn type_id() -> CFTypeID {
60 extern "C-unwind" {
61 fn SKIndexDocumentIteratorGetTypeID() -> CFTypeID;
62 }
63 unsafe { SKIndexDocumentIteratorGetTypeID() }
64 }
65}
66
67#[repr(transparent)]
69#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
70pub struct SKIndexType(pub c_uint);
71impl SKIndexType {
72 #[doc(alias = "kSKIndexUnknown")]
73 pub const Unknown: Self = Self(0);
74 #[doc(alias = "kSKIndexInverted")]
75 pub const Inverted: Self = Self(1);
76 #[doc(alias = "kSKIndexVector")]
77 pub const Vector: Self = Self(2);
78 #[doc(alias = "kSKIndexInvertedVector")]
79 pub const InvertedVector: Self = Self(3);
80}
81
82#[cfg(feature = "objc2")]
83unsafe impl Encode for SKIndexType {
84 const ENCODING: Encoding = c_uint::ENCODING;
85}
86
87#[cfg(feature = "objc2")]
88unsafe impl RefEncode for SKIndexType {
89 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
90}
91
92#[repr(transparent)]
94#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
95pub struct SKDocumentIndexState(pub c_uint);
96impl SKDocumentIndexState {
97 #[doc(alias = "kSKDocumentStateNotIndexed")]
98 pub const StateNotIndexed: Self = Self(0);
99 #[doc(alias = "kSKDocumentStateIndexed")]
100 pub const StateIndexed: Self = Self(1);
101 #[doc(alias = "kSKDocumentStateAddPending")]
102 pub const StateAddPending: Self = Self(2);
103 #[doc(alias = "kSKDocumentStateDeletePending")]
104 pub const StateDeletePending: Self = Self(3);
105}
106
107#[cfg(feature = "objc2")]
108unsafe impl Encode for SKDocumentIndexState {
109 const ENCODING: Encoding = c_uint::ENCODING;
110}
111
112#[cfg(feature = "objc2")]
113unsafe impl RefEncode for SKDocumentIndexState {
114 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
115}
116
117impl SKIndex {
118 #[doc(alias = "SKIndexCreateWithURL")]
125 #[inline]
126 pub unsafe fn with_url(
127 in_url: Option<&CFURL>,
128 in_index_name: Option<&CFString>,
129 in_index_type: SKIndexType,
130 in_analysis_properties: Option<&CFDictionary>,
131 ) -> Option<CFRetained<SKIndex>> {
132 extern "C-unwind" {
133 fn SKIndexCreateWithURL(
134 in_url: Option<&CFURL>,
135 in_index_name: Option<&CFString>,
136 in_index_type: SKIndexType,
137 in_analysis_properties: Option<&CFDictionary>,
138 ) -> Option<NonNull<SKIndex>>;
139 }
140 let ret = unsafe {
141 SKIndexCreateWithURL(in_url, in_index_name, in_index_type, in_analysis_properties)
142 };
143 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
144 }
145
146 #[doc(alias = "SKIndexOpenWithURL")]
151 #[inline]
152 pub unsafe fn open_with_url(
153 in_url: Option<&CFURL>,
154 in_index_name: Option<&CFString>,
155 in_write_access: bool,
156 ) -> Option<CFRetained<SKIndex>> {
157 extern "C-unwind" {
158 fn SKIndexOpenWithURL(
159 in_url: Option<&CFURL>,
160 in_index_name: Option<&CFString>,
161 in_write_access: Boolean,
162 ) -> Option<NonNull<SKIndex>>;
163 }
164 let ret = unsafe { SKIndexOpenWithURL(in_url, in_index_name, in_write_access as _) };
165 ret.map(|ret| unsafe { CFRetained::retain(ret) })
166 }
167
168 #[doc(alias = "SKIndexCreateWithMutableData")]
175 #[inline]
176 pub unsafe fn with_mutable_data(
177 in_data: Option<&CFMutableData>,
178 in_index_name: Option<&CFString>,
179 in_index_type: SKIndexType,
180 in_analysis_properties: Option<&CFDictionary>,
181 ) -> Option<CFRetained<SKIndex>> {
182 extern "C-unwind" {
183 fn SKIndexCreateWithMutableData(
184 in_data: Option<&CFMutableData>,
185 in_index_name: Option<&CFString>,
186 in_index_type: SKIndexType,
187 in_analysis_properties: Option<&CFDictionary>,
188 ) -> Option<NonNull<SKIndex>>;
189 }
190 let ret = unsafe {
191 SKIndexCreateWithMutableData(
192 in_data,
193 in_index_name,
194 in_index_type,
195 in_analysis_properties,
196 )
197 };
198 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
199 }
200
201 #[doc(alias = "SKIndexOpenWithData")]
206 #[inline]
207 pub unsafe fn open_with_data(
208 in_data: Option<&CFData>,
209 in_index_name: Option<&CFString>,
210 ) -> Option<CFRetained<SKIndex>> {
211 extern "C-unwind" {
212 fn SKIndexOpenWithData(
213 in_data: Option<&CFData>,
214 in_index_name: Option<&CFString>,
215 ) -> Option<NonNull<SKIndex>>;
216 }
217 let ret = unsafe { SKIndexOpenWithData(in_data, in_index_name) };
218 ret.map(|ret| unsafe { CFRetained::retain(ret) })
219 }
220
221 #[doc(alias = "SKIndexOpenWithMutableData")]
226 #[inline]
227 pub unsafe fn open_with_mutable_data(
228 in_data: Option<&CFMutableData>,
229 in_index_name: Option<&CFString>,
230 ) -> Option<CFRetained<SKIndex>> {
231 extern "C-unwind" {
232 fn SKIndexOpenWithMutableData(
233 in_data: Option<&CFMutableData>,
234 in_index_name: Option<&CFString>,
235 ) -> Option<NonNull<SKIndex>>;
236 }
237 let ret = unsafe { SKIndexOpenWithMutableData(in_data, in_index_name) };
238 ret.map(|ret| unsafe { CFRetained::retain(ret) })
239 }
240
241 #[doc(alias = "SKIndexFlush")]
242 #[inline]
243 pub unsafe fn flush(&self) -> bool {
244 extern "C-unwind" {
245 fn SKIndexFlush(in_index: &SKIndex) -> Boolean;
246 }
247 let ret = unsafe { SKIndexFlush(self) };
248 ret != 0
249 }
250
251 #[doc(alias = "SKIndexSetMaximumBytesBeforeFlush")]
252 #[inline]
253 pub unsafe fn set_maximum_bytes_before_flush(&self, in_bytes_for_update: CFIndex) {
254 extern "C-unwind" {
255 fn SKIndexSetMaximumBytesBeforeFlush(in_index: &SKIndex, in_bytes_for_update: CFIndex);
256 }
257 unsafe { SKIndexSetMaximumBytesBeforeFlush(self, in_bytes_for_update) }
258 }
259
260 #[doc(alias = "SKIndexGetMaximumBytesBeforeFlush")]
261 #[inline]
262 pub unsafe fn maximum_bytes_before_flush(&self) -> CFIndex {
263 extern "C-unwind" {
264 fn SKIndexGetMaximumBytesBeforeFlush(in_index: &SKIndex) -> CFIndex;
265 }
266 unsafe { SKIndexGetMaximumBytesBeforeFlush(self) }
267 }
268
269 #[doc(alias = "SKIndexCompact")]
270 #[inline]
271 pub unsafe fn compact(&self) -> bool {
272 extern "C-unwind" {
273 fn SKIndexCompact(in_index: &SKIndex) -> Boolean;
274 }
275 let ret = unsafe { SKIndexCompact(self) };
276 ret != 0
277 }
278
279 #[doc(alias = "SKIndexGetIndexType")]
280 #[inline]
281 pub unsafe fn index_type(&self) -> SKIndexType {
282 extern "C-unwind" {
283 fn SKIndexGetIndexType(in_index: &SKIndex) -> SKIndexType;
284 }
285 unsafe { SKIndexGetIndexType(self) }
286 }
287
288 #[doc(alias = "SKIndexGetAnalysisProperties")]
289 #[inline]
290 pub unsafe fn analysis_properties(&self) -> Option<CFRetained<CFDictionary>> {
291 extern "C-unwind" {
292 fn SKIndexGetAnalysisProperties(in_index: &SKIndex) -> Option<NonNull<CFDictionary>>;
293 }
294 let ret = unsafe { SKIndexGetAnalysisProperties(self) };
295 ret.map(|ret| unsafe { CFRetained::retain(ret) })
296 }
297
298 #[doc(alias = "SKIndexGetDocumentCount")]
299 #[inline]
300 pub unsafe fn document_count(&self) -> CFIndex {
301 extern "C-unwind" {
302 fn SKIndexGetDocumentCount(in_index: &SKIndex) -> CFIndex;
303 }
304 unsafe { SKIndexGetDocumentCount(self) }
305 }
306
307 #[doc(alias = "SKIndexClose")]
308 #[inline]
309 pub unsafe fn close(&self) {
310 extern "C-unwind" {
311 fn SKIndexClose(in_index: &SKIndex);
312 }
313 unsafe { SKIndexClose(self) }
314 }
315}
316
317pub type SKDocumentID = CFIndex;
319
320impl SKIndex {
321 #[doc(alias = "SKIndexAddDocumentWithText")]
327 #[cfg(feature = "SKDocument")]
328 #[inline]
329 pub unsafe fn add_document_with_text(
330 &self,
331 in_document: Option<&SKDocument>,
332 in_document_text: Option<&CFString>,
333 in_can_replace: bool,
334 ) -> bool {
335 extern "C-unwind" {
336 fn SKIndexAddDocumentWithText(
337 in_index: &SKIndex,
338 in_document: Option<&SKDocument>,
339 in_document_text: Option<&CFString>,
340 in_can_replace: Boolean,
341 ) -> Boolean;
342 }
343 let ret = unsafe {
344 SKIndexAddDocumentWithText(self, in_document, in_document_text, in_can_replace as _)
345 };
346 ret != 0
347 }
348
349 #[doc(alias = "SKIndexAddDocument")]
355 #[cfg(feature = "SKDocument")]
356 #[inline]
357 pub unsafe fn add_document(
358 &self,
359 in_document: Option<&SKDocument>,
360 in_mime_type_hint: Option<&CFString>,
361 in_can_replace: bool,
362 ) -> bool {
363 extern "C-unwind" {
364 fn SKIndexAddDocument(
365 in_index: &SKIndex,
366 in_document: Option<&SKDocument>,
367 in_mime_type_hint: Option<&CFString>,
368 in_can_replace: Boolean,
369 ) -> Boolean;
370 }
371 let ret = unsafe {
372 SKIndexAddDocument(self, in_document, in_mime_type_hint, in_can_replace as _)
373 };
374 ret != 0
375 }
376
377 #[doc(alias = "SKIndexRemoveDocument")]
382 #[cfg(feature = "SKDocument")]
383 #[inline]
384 pub unsafe fn remove_document(&self, in_document: Option<&SKDocument>) -> bool {
385 extern "C-unwind" {
386 fn SKIndexRemoveDocument(
387 in_index: &SKIndex,
388 in_document: Option<&SKDocument>,
389 ) -> Boolean;
390 }
391 let ret = unsafe { SKIndexRemoveDocument(self, in_document) };
392 ret != 0
393 }
394
395 #[doc(alias = "SKIndexCopyDocumentProperties")]
400 #[cfg(feature = "SKDocument")]
401 #[inline]
402 pub unsafe fn document_properties(
403 &self,
404 in_document: Option<&SKDocument>,
405 ) -> Option<CFRetained<CFDictionary>> {
406 extern "C-unwind" {
407 fn SKIndexCopyDocumentProperties(
408 in_index: &SKIndex,
409 in_document: Option<&SKDocument>,
410 ) -> Option<NonNull<CFDictionary>>;
411 }
412 let ret = unsafe { SKIndexCopyDocumentProperties(self, in_document) };
413 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
414 }
415
416 #[doc(alias = "SKIndexSetDocumentProperties")]
423 #[cfg(feature = "SKDocument")]
424 #[inline]
425 pub unsafe fn set_document_properties(
426 &self,
427 in_document: Option<&SKDocument>,
428 in_properties: Option<&CFDictionary>,
429 ) {
430 extern "C-unwind" {
431 fn SKIndexSetDocumentProperties(
432 in_index: &SKIndex,
433 in_document: Option<&SKDocument>,
434 in_properties: Option<&CFDictionary>,
435 );
436 }
437 unsafe { SKIndexSetDocumentProperties(self, in_document, in_properties) }
438 }
439
440 #[doc(alias = "SKIndexGetDocumentState")]
445 #[cfg(feature = "SKDocument")]
446 #[inline]
447 pub unsafe fn document_state(&self, in_document: Option<&SKDocument>) -> SKDocumentIndexState {
448 extern "C-unwind" {
449 fn SKIndexGetDocumentState(
450 in_index: &SKIndex,
451 in_document: Option<&SKDocument>,
452 ) -> SKDocumentIndexState;
453 }
454 unsafe { SKIndexGetDocumentState(self, in_document) }
455 }
456
457 #[doc(alias = "SKIndexGetDocumentID")]
462 #[cfg(feature = "SKDocument")]
463 #[inline]
464 pub unsafe fn document_id(&self, in_document: Option<&SKDocument>) -> SKDocumentID {
465 extern "C-unwind" {
466 fn SKIndexGetDocumentID(
467 in_index: &SKIndex,
468 in_document: Option<&SKDocument>,
469 ) -> SKDocumentID;
470 }
471 unsafe { SKIndexGetDocumentID(self, in_document) }
472 }
473
474 #[doc(alias = "SKIndexCopyDocumentForDocumentID")]
475 #[cfg(feature = "SKDocument")]
476 #[inline]
477 pub unsafe fn document_for_document_id(
478 &self,
479 in_document_id: SKDocumentID,
480 ) -> Option<CFRetained<SKDocument>> {
481 extern "C-unwind" {
482 fn SKIndexCopyDocumentForDocumentID(
483 in_index: &SKIndex,
484 in_document_id: SKDocumentID,
485 ) -> Option<NonNull<SKDocument>>;
486 }
487 let ret = unsafe { SKIndexCopyDocumentForDocumentID(self, in_document_id) };
488 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
489 }
490
491 #[doc(alias = "SKIndexRenameDocument")]
497 #[cfg(feature = "SKDocument")]
498 #[inline]
499 pub unsafe fn rename_document(
500 &self,
501 in_document: Option<&SKDocument>,
502 in_new_name: Option<&CFString>,
503 ) -> bool {
504 extern "C-unwind" {
505 fn SKIndexRenameDocument(
506 in_index: &SKIndex,
507 in_document: Option<&SKDocument>,
508 in_new_name: Option<&CFString>,
509 ) -> Boolean;
510 }
511 let ret = unsafe { SKIndexRenameDocument(self, in_document, in_new_name) };
512 ret != 0
513 }
514
515 #[doc(alias = "SKIndexMoveDocument")]
522 #[cfg(feature = "SKDocument")]
523 #[inline]
524 pub unsafe fn move_document(
525 &self,
526 in_document: Option<&SKDocument>,
527 in_new_parent: Option<&SKDocument>,
528 ) -> bool {
529 extern "C-unwind" {
530 fn SKIndexMoveDocument(
531 in_index: &SKIndex,
532 in_document: Option<&SKDocument>,
533 in_new_parent: Option<&SKDocument>,
534 ) -> Boolean;
535 }
536 let ret = unsafe { SKIndexMoveDocument(self, in_document, in_new_parent) };
537 ret != 0
538 }
539}
540
541impl SKIndexDocumentIterator {
542 #[doc(alias = "SKIndexDocumentIteratorCreate")]
547 #[cfg(feature = "SKDocument")]
548 #[inline]
549 pub unsafe fn new(
550 in_index: &SKIndex,
551 in_parent_document: Option<&SKDocument>,
552 ) -> Option<CFRetained<SKIndexDocumentIterator>> {
553 extern "C-unwind" {
554 fn SKIndexDocumentIteratorCreate(
555 in_index: &SKIndex,
556 in_parent_document: Option<&SKDocument>,
557 ) -> Option<NonNull<SKIndexDocumentIterator>>;
558 }
559 let ret = unsafe { SKIndexDocumentIteratorCreate(in_index, in_parent_document) };
560 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
561 }
562
563 #[doc(alias = "SKIndexDocumentIteratorCopyNext")]
564 #[cfg(feature = "SKDocument")]
565 #[inline]
566 pub unsafe fn next(&self) -> Option<CFRetained<SKDocument>> {
567 extern "C-unwind" {
568 fn SKIndexDocumentIteratorCopyNext(
569 in_iterator: &SKIndexDocumentIterator,
570 ) -> Option<NonNull<SKDocument>>;
571 }
572 let ret = unsafe { SKIndexDocumentIteratorCopyNext(self) };
573 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
574 }
575}
576
577impl SKIndex {
578 #[doc(alias = "SKIndexGetMaximumDocumentID")]
579 #[inline]
580 pub unsafe fn maximum_document_id(&self) -> SKDocumentID {
581 extern "C-unwind" {
582 fn SKIndexGetMaximumDocumentID(in_index: &SKIndex) -> SKDocumentID;
583 }
584 unsafe { SKIndexGetMaximumDocumentID(self) }
585 }
586
587 #[doc(alias = "SKIndexGetDocumentTermCount")]
588 #[inline]
589 pub unsafe fn document_term_count(&self, in_document_id: SKDocumentID) -> CFIndex {
590 extern "C-unwind" {
591 fn SKIndexGetDocumentTermCount(
592 in_index: &SKIndex,
593 in_document_id: SKDocumentID,
594 ) -> CFIndex;
595 }
596 unsafe { SKIndexGetDocumentTermCount(self, in_document_id) }
597 }
598
599 #[doc(alias = "SKIndexCopyTermIDArrayForDocumentID")]
600 #[inline]
601 pub unsafe fn term_id_array_for_document_id(
602 &self,
603 in_document_id: SKDocumentID,
604 ) -> Option<CFRetained<CFArray>> {
605 extern "C-unwind" {
606 fn SKIndexCopyTermIDArrayForDocumentID(
607 in_index: &SKIndex,
608 in_document_id: SKDocumentID,
609 ) -> Option<NonNull<CFArray>>;
610 }
611 let ret = unsafe { SKIndexCopyTermIDArrayForDocumentID(self, in_document_id) };
612 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
613 }
614
615 #[doc(alias = "SKIndexGetDocumentTermFrequency")]
616 #[inline]
617 pub unsafe fn document_term_frequency(
618 &self,
619 in_document_id: SKDocumentID,
620 in_term_id: CFIndex,
621 ) -> CFIndex {
622 extern "C-unwind" {
623 fn SKIndexGetDocumentTermFrequency(
624 in_index: &SKIndex,
625 in_document_id: SKDocumentID,
626 in_term_id: CFIndex,
627 ) -> CFIndex;
628 }
629 unsafe { SKIndexGetDocumentTermFrequency(self, in_document_id, in_term_id) }
630 }
631
632 #[doc(alias = "SKIndexGetMaximumTermID")]
633 #[inline]
634 pub unsafe fn maximum_term_id(&self) -> CFIndex {
635 extern "C-unwind" {
636 fn SKIndexGetMaximumTermID(in_index: &SKIndex) -> CFIndex;
637 }
638 unsafe { SKIndexGetMaximumTermID(self) }
639 }
640
641 #[doc(alias = "SKIndexGetTermDocumentCount")]
642 #[inline]
643 pub unsafe fn term_document_count(&self, in_term_id: CFIndex) -> CFIndex {
644 extern "C-unwind" {
645 fn SKIndexGetTermDocumentCount(in_index: &SKIndex, in_term_id: CFIndex) -> CFIndex;
646 }
647 unsafe { SKIndexGetTermDocumentCount(self, in_term_id) }
648 }
649
650 #[doc(alias = "SKIndexCopyDocumentIDArrayForTermID")]
651 #[inline]
652 pub unsafe fn document_id_array_for_term_id(
653 &self,
654 in_term_id: CFIndex,
655 ) -> Option<CFRetained<CFArray>> {
656 extern "C-unwind" {
657 fn SKIndexCopyDocumentIDArrayForTermID(
658 in_index: &SKIndex,
659 in_term_id: CFIndex,
660 ) -> Option<NonNull<CFArray>>;
661 }
662 let ret = unsafe { SKIndexCopyDocumentIDArrayForTermID(self, in_term_id) };
663 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
664 }
665
666 #[doc(alias = "SKIndexCopyTermStringForTermID")]
667 #[inline]
668 pub unsafe fn term_string_for_term_id(
669 &self,
670 in_term_id: CFIndex,
671 ) -> Option<CFRetained<CFString>> {
672 extern "C-unwind" {
673 fn SKIndexCopyTermStringForTermID(
674 in_index: &SKIndex,
675 in_term_id: CFIndex,
676 ) -> Option<NonNull<CFString>>;
677 }
678 let ret = unsafe { SKIndexCopyTermStringForTermID(self, in_term_id) };
679 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
680 }
681
682 #[doc(alias = "SKIndexGetTermIDForTermString")]
686 #[inline]
687 pub unsafe fn term_id_for_term_string(&self, in_term_string: Option<&CFString>) -> CFIndex {
688 extern "C-unwind" {
689 fn SKIndexGetTermIDForTermString(
690 in_index: &SKIndex,
691 in_term_string: Option<&CFString>,
692 ) -> CFIndex;
693 }
694 unsafe { SKIndexGetTermIDForTermString(self, in_term_string) }
695 }
696}
697
698extern "C-unwind" {
699 pub fn SKLoadDefaultExtractorPlugIns();
700}
701
702#[deprecated = "renamed to `SKIndex::with_url`"]
703#[inline]
704pub unsafe extern "C-unwind" fn SKIndexCreateWithURL(
705 in_url: Option<&CFURL>,
706 in_index_name: Option<&CFString>,
707 in_index_type: SKIndexType,
708 in_analysis_properties: Option<&CFDictionary>,
709) -> Option<CFRetained<SKIndex>> {
710 extern "C-unwind" {
711 fn SKIndexCreateWithURL(
712 in_url: Option<&CFURL>,
713 in_index_name: Option<&CFString>,
714 in_index_type: SKIndexType,
715 in_analysis_properties: Option<&CFDictionary>,
716 ) -> Option<NonNull<SKIndex>>;
717 }
718 let ret = unsafe {
719 SKIndexCreateWithURL(in_url, in_index_name, in_index_type, in_analysis_properties)
720 };
721 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
722}
723
724#[deprecated = "renamed to `SKIndex::open_with_url`"]
725#[inline]
726pub unsafe extern "C-unwind" fn SKIndexOpenWithURL(
727 in_url: Option<&CFURL>,
728 in_index_name: Option<&CFString>,
729 in_write_access: bool,
730) -> Option<CFRetained<SKIndex>> {
731 extern "C-unwind" {
732 fn SKIndexOpenWithURL(
733 in_url: Option<&CFURL>,
734 in_index_name: Option<&CFString>,
735 in_write_access: Boolean,
736 ) -> Option<NonNull<SKIndex>>;
737 }
738 let ret = unsafe { SKIndexOpenWithURL(in_url, in_index_name, in_write_access as _) };
739 ret.map(|ret| unsafe { CFRetained::retain(ret) })
740}
741
742#[deprecated = "renamed to `SKIndex::with_mutable_data`"]
743#[inline]
744pub unsafe extern "C-unwind" fn SKIndexCreateWithMutableData(
745 in_data: Option<&CFMutableData>,
746 in_index_name: Option<&CFString>,
747 in_index_type: SKIndexType,
748 in_analysis_properties: Option<&CFDictionary>,
749) -> Option<CFRetained<SKIndex>> {
750 extern "C-unwind" {
751 fn SKIndexCreateWithMutableData(
752 in_data: Option<&CFMutableData>,
753 in_index_name: Option<&CFString>,
754 in_index_type: SKIndexType,
755 in_analysis_properties: Option<&CFDictionary>,
756 ) -> Option<NonNull<SKIndex>>;
757 }
758 let ret = unsafe {
759 SKIndexCreateWithMutableData(
760 in_data,
761 in_index_name,
762 in_index_type,
763 in_analysis_properties,
764 )
765 };
766 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
767}
768
769#[deprecated = "renamed to `SKIndex::open_with_data`"]
770#[inline]
771pub unsafe extern "C-unwind" fn SKIndexOpenWithData(
772 in_data: Option<&CFData>,
773 in_index_name: Option<&CFString>,
774) -> Option<CFRetained<SKIndex>> {
775 extern "C-unwind" {
776 fn SKIndexOpenWithData(
777 in_data: Option<&CFData>,
778 in_index_name: Option<&CFString>,
779 ) -> Option<NonNull<SKIndex>>;
780 }
781 let ret = unsafe { SKIndexOpenWithData(in_data, in_index_name) };
782 ret.map(|ret| unsafe { CFRetained::retain(ret) })
783}
784
785#[deprecated = "renamed to `SKIndex::open_with_mutable_data`"]
786#[inline]
787pub unsafe extern "C-unwind" fn SKIndexOpenWithMutableData(
788 in_data: Option<&CFMutableData>,
789 in_index_name: Option<&CFString>,
790) -> Option<CFRetained<SKIndex>> {
791 extern "C-unwind" {
792 fn SKIndexOpenWithMutableData(
793 in_data: Option<&CFMutableData>,
794 in_index_name: Option<&CFString>,
795 ) -> Option<NonNull<SKIndex>>;
796 }
797 let ret = unsafe { SKIndexOpenWithMutableData(in_data, in_index_name) };
798 ret.map(|ret| unsafe { CFRetained::retain(ret) })
799}
800
801#[deprecated = "renamed to `SKIndex::flush`"]
802#[inline]
803pub unsafe extern "C-unwind" fn SKIndexFlush(in_index: &SKIndex) -> bool {
804 extern "C-unwind" {
805 fn SKIndexFlush(in_index: &SKIndex) -> Boolean;
806 }
807 let ret = unsafe { SKIndexFlush(in_index) };
808 ret != 0
809}
810
811extern "C-unwind" {
812 #[deprecated = "renamed to `SKIndex::set_maximum_bytes_before_flush`"]
813 pub fn SKIndexSetMaximumBytesBeforeFlush(in_index: &SKIndex, in_bytes_for_update: CFIndex);
814}
815
816extern "C-unwind" {
817 #[deprecated = "renamed to `SKIndex::maximum_bytes_before_flush`"]
818 pub fn SKIndexGetMaximumBytesBeforeFlush(in_index: &SKIndex) -> CFIndex;
819}
820
821#[deprecated = "renamed to `SKIndex::compact`"]
822#[inline]
823pub unsafe extern "C-unwind" fn SKIndexCompact(in_index: &SKIndex) -> bool {
824 extern "C-unwind" {
825 fn SKIndexCompact(in_index: &SKIndex) -> Boolean;
826 }
827 let ret = unsafe { SKIndexCompact(in_index) };
828 ret != 0
829}
830
831extern "C-unwind" {
832 #[deprecated = "renamed to `SKIndex::index_type`"]
833 pub fn SKIndexGetIndexType(in_index: &SKIndex) -> SKIndexType;
834}
835
836#[deprecated = "renamed to `SKIndex::analysis_properties`"]
837#[inline]
838pub unsafe extern "C-unwind" fn SKIndexGetAnalysisProperties(
839 in_index: &SKIndex,
840) -> Option<CFRetained<CFDictionary>> {
841 extern "C-unwind" {
842 fn SKIndexGetAnalysisProperties(in_index: &SKIndex) -> Option<NonNull<CFDictionary>>;
843 }
844 let ret = unsafe { SKIndexGetAnalysisProperties(in_index) };
845 ret.map(|ret| unsafe { CFRetained::retain(ret) })
846}
847
848extern "C-unwind" {
849 #[deprecated = "renamed to `SKIndex::document_count`"]
850 pub fn SKIndexGetDocumentCount(in_index: &SKIndex) -> CFIndex;
851}
852
853extern "C-unwind" {
854 #[deprecated = "renamed to `SKIndex::close`"]
855 pub fn SKIndexClose(in_index: &SKIndex);
856}
857
858#[cfg(feature = "SKDocument")]
859#[deprecated = "renamed to `SKIndex::add_document_with_text`"]
860#[inline]
861pub unsafe extern "C-unwind" fn SKIndexAddDocumentWithText(
862 in_index: &SKIndex,
863 in_document: Option<&SKDocument>,
864 in_document_text: Option<&CFString>,
865 in_can_replace: bool,
866) -> bool {
867 extern "C-unwind" {
868 fn SKIndexAddDocumentWithText(
869 in_index: &SKIndex,
870 in_document: Option<&SKDocument>,
871 in_document_text: Option<&CFString>,
872 in_can_replace: Boolean,
873 ) -> Boolean;
874 }
875 let ret = unsafe {
876 SKIndexAddDocumentWithText(in_index, in_document, in_document_text, in_can_replace as _)
877 };
878 ret != 0
879}
880
881#[cfg(feature = "SKDocument")]
882#[deprecated = "renamed to `SKIndex::add_document`"]
883#[inline]
884pub unsafe extern "C-unwind" fn SKIndexAddDocument(
885 in_index: &SKIndex,
886 in_document: Option<&SKDocument>,
887 in_mime_type_hint: Option<&CFString>,
888 in_can_replace: bool,
889) -> bool {
890 extern "C-unwind" {
891 fn SKIndexAddDocument(
892 in_index: &SKIndex,
893 in_document: Option<&SKDocument>,
894 in_mime_type_hint: Option<&CFString>,
895 in_can_replace: Boolean,
896 ) -> Boolean;
897 }
898 let ret = unsafe {
899 SKIndexAddDocument(
900 in_index,
901 in_document,
902 in_mime_type_hint,
903 in_can_replace as _,
904 )
905 };
906 ret != 0
907}
908
909#[cfg(feature = "SKDocument")]
910#[deprecated = "renamed to `SKIndex::remove_document`"]
911#[inline]
912pub unsafe extern "C-unwind" fn SKIndexRemoveDocument(
913 in_index: &SKIndex,
914 in_document: Option<&SKDocument>,
915) -> bool {
916 extern "C-unwind" {
917 fn SKIndexRemoveDocument(in_index: &SKIndex, in_document: Option<&SKDocument>) -> Boolean;
918 }
919 let ret = unsafe { SKIndexRemoveDocument(in_index, in_document) };
920 ret != 0
921}
922
923#[cfg(feature = "SKDocument")]
924#[deprecated = "renamed to `SKIndex::document_properties`"]
925#[inline]
926pub unsafe extern "C-unwind" fn SKIndexCopyDocumentProperties(
927 in_index: &SKIndex,
928 in_document: Option<&SKDocument>,
929) -> Option<CFRetained<CFDictionary>> {
930 extern "C-unwind" {
931 fn SKIndexCopyDocumentProperties(
932 in_index: &SKIndex,
933 in_document: Option<&SKDocument>,
934 ) -> Option<NonNull<CFDictionary>>;
935 }
936 let ret = unsafe { SKIndexCopyDocumentProperties(in_index, in_document) };
937 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
938}
939
940extern "C-unwind" {
941 #[cfg(feature = "SKDocument")]
942 #[deprecated = "renamed to `SKIndex::set_document_properties`"]
943 pub fn SKIndexSetDocumentProperties(
944 in_index: &SKIndex,
945 in_document: Option<&SKDocument>,
946 in_properties: Option<&CFDictionary>,
947 );
948}
949
950extern "C-unwind" {
951 #[cfg(feature = "SKDocument")]
952 #[deprecated = "renamed to `SKIndex::document_state`"]
953 pub fn SKIndexGetDocumentState(
954 in_index: &SKIndex,
955 in_document: Option<&SKDocument>,
956 ) -> SKDocumentIndexState;
957}
958
959extern "C-unwind" {
960 #[cfg(feature = "SKDocument")]
961 #[deprecated = "renamed to `SKIndex::document_id`"]
962 pub fn SKIndexGetDocumentID(
963 in_index: &SKIndex,
964 in_document: Option<&SKDocument>,
965 ) -> SKDocumentID;
966}
967
968#[cfg(feature = "SKDocument")]
969#[deprecated = "renamed to `SKIndex::document_for_document_id`"]
970#[inline]
971pub unsafe extern "C-unwind" fn SKIndexCopyDocumentForDocumentID(
972 in_index: &SKIndex,
973 in_document_id: SKDocumentID,
974) -> Option<CFRetained<SKDocument>> {
975 extern "C-unwind" {
976 fn SKIndexCopyDocumentForDocumentID(
977 in_index: &SKIndex,
978 in_document_id: SKDocumentID,
979 ) -> Option<NonNull<SKDocument>>;
980 }
981 let ret = unsafe { SKIndexCopyDocumentForDocumentID(in_index, in_document_id) };
982 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
983}
984
985#[cfg(feature = "SKDocument")]
986#[deprecated = "renamed to `SKIndex::rename_document`"]
987#[inline]
988pub unsafe extern "C-unwind" fn SKIndexRenameDocument(
989 in_index: &SKIndex,
990 in_document: Option<&SKDocument>,
991 in_new_name: Option<&CFString>,
992) -> bool {
993 extern "C-unwind" {
994 fn SKIndexRenameDocument(
995 in_index: &SKIndex,
996 in_document: Option<&SKDocument>,
997 in_new_name: Option<&CFString>,
998 ) -> Boolean;
999 }
1000 let ret = unsafe { SKIndexRenameDocument(in_index, in_document, in_new_name) };
1001 ret != 0
1002}
1003
1004#[cfg(feature = "SKDocument")]
1005#[deprecated = "renamed to `SKIndex::move_document`"]
1006#[inline]
1007pub unsafe extern "C-unwind" fn SKIndexMoveDocument(
1008 in_index: &SKIndex,
1009 in_document: Option<&SKDocument>,
1010 in_new_parent: Option<&SKDocument>,
1011) -> bool {
1012 extern "C-unwind" {
1013 fn SKIndexMoveDocument(
1014 in_index: &SKIndex,
1015 in_document: Option<&SKDocument>,
1016 in_new_parent: Option<&SKDocument>,
1017 ) -> Boolean;
1018 }
1019 let ret = unsafe { SKIndexMoveDocument(in_index, in_document, in_new_parent) };
1020 ret != 0
1021}
1022
1023#[cfg(feature = "SKDocument")]
1024#[deprecated = "renamed to `SKIndexDocumentIterator::new`"]
1025#[inline]
1026pub unsafe extern "C-unwind" fn SKIndexDocumentIteratorCreate(
1027 in_index: &SKIndex,
1028 in_parent_document: Option<&SKDocument>,
1029) -> Option<CFRetained<SKIndexDocumentIterator>> {
1030 extern "C-unwind" {
1031 fn SKIndexDocumentIteratorCreate(
1032 in_index: &SKIndex,
1033 in_parent_document: Option<&SKDocument>,
1034 ) -> Option<NonNull<SKIndexDocumentIterator>>;
1035 }
1036 let ret = unsafe { SKIndexDocumentIteratorCreate(in_index, in_parent_document) };
1037 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1038}
1039
1040#[cfg(feature = "SKDocument")]
1041#[deprecated = "renamed to `SKIndexDocumentIterator::next`"]
1042#[inline]
1043pub unsafe extern "C-unwind" fn SKIndexDocumentIteratorCopyNext(
1044 in_iterator: &SKIndexDocumentIterator,
1045) -> Option<CFRetained<SKDocument>> {
1046 extern "C-unwind" {
1047 fn SKIndexDocumentIteratorCopyNext(
1048 in_iterator: &SKIndexDocumentIterator,
1049 ) -> Option<NonNull<SKDocument>>;
1050 }
1051 let ret = unsafe { SKIndexDocumentIteratorCopyNext(in_iterator) };
1052 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1053}
1054
1055extern "C-unwind" {
1056 #[deprecated = "renamed to `SKIndex::maximum_document_id`"]
1057 pub fn SKIndexGetMaximumDocumentID(in_index: &SKIndex) -> SKDocumentID;
1058}
1059
1060extern "C-unwind" {
1061 #[deprecated = "renamed to `SKIndex::document_term_count`"]
1062 pub fn SKIndexGetDocumentTermCount(in_index: &SKIndex, in_document_id: SKDocumentID)
1063 -> CFIndex;
1064}
1065
1066#[deprecated = "renamed to `SKIndex::term_id_array_for_document_id`"]
1067#[inline]
1068pub unsafe extern "C-unwind" fn SKIndexCopyTermIDArrayForDocumentID(
1069 in_index: &SKIndex,
1070 in_document_id: SKDocumentID,
1071) -> Option<CFRetained<CFArray>> {
1072 extern "C-unwind" {
1073 fn SKIndexCopyTermIDArrayForDocumentID(
1074 in_index: &SKIndex,
1075 in_document_id: SKDocumentID,
1076 ) -> Option<NonNull<CFArray>>;
1077 }
1078 let ret = unsafe { SKIndexCopyTermIDArrayForDocumentID(in_index, in_document_id) };
1079 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1080}
1081
1082extern "C-unwind" {
1083 #[deprecated = "renamed to `SKIndex::document_term_frequency`"]
1084 pub fn SKIndexGetDocumentTermFrequency(
1085 in_index: &SKIndex,
1086 in_document_id: SKDocumentID,
1087 in_term_id: CFIndex,
1088 ) -> CFIndex;
1089}
1090
1091extern "C-unwind" {
1092 #[deprecated = "renamed to `SKIndex::maximum_term_id`"]
1093 pub fn SKIndexGetMaximumTermID(in_index: &SKIndex) -> CFIndex;
1094}
1095
1096extern "C-unwind" {
1097 #[deprecated = "renamed to `SKIndex::term_document_count`"]
1098 pub fn SKIndexGetTermDocumentCount(in_index: &SKIndex, in_term_id: CFIndex) -> CFIndex;
1099}
1100
1101#[deprecated = "renamed to `SKIndex::document_id_array_for_term_id`"]
1102#[inline]
1103pub unsafe extern "C-unwind" fn SKIndexCopyDocumentIDArrayForTermID(
1104 in_index: &SKIndex,
1105 in_term_id: CFIndex,
1106) -> Option<CFRetained<CFArray>> {
1107 extern "C-unwind" {
1108 fn SKIndexCopyDocumentIDArrayForTermID(
1109 in_index: &SKIndex,
1110 in_term_id: CFIndex,
1111 ) -> Option<NonNull<CFArray>>;
1112 }
1113 let ret = unsafe { SKIndexCopyDocumentIDArrayForTermID(in_index, in_term_id) };
1114 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1115}
1116
1117#[deprecated = "renamed to `SKIndex::term_string_for_term_id`"]
1118#[inline]
1119pub unsafe extern "C-unwind" fn SKIndexCopyTermStringForTermID(
1120 in_index: &SKIndex,
1121 in_term_id: CFIndex,
1122) -> Option<CFRetained<CFString>> {
1123 extern "C-unwind" {
1124 fn SKIndexCopyTermStringForTermID(
1125 in_index: &SKIndex,
1126 in_term_id: CFIndex,
1127 ) -> Option<NonNull<CFString>>;
1128 }
1129 let ret = unsafe { SKIndexCopyTermStringForTermID(in_index, in_term_id) };
1130 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1131}
1132
1133extern "C-unwind" {
1134 #[deprecated = "renamed to `SKIndex::term_id_for_term_string`"]
1135 pub fn SKIndexGetTermIDForTermString(
1136 in_index: &SKIndex,
1137 in_term_string: Option<&CFString>,
1138 ) -> CFIndex;
1139}