objc2_core_image/generated/CIBarcodeDescriptor.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// An abstract base class that represents a machine-readable code's attributes.
11 ///
12 /// Subclasses encapsulate the formal specification and fields specific to a code type.
13 /// Each subclass is sufficient to recreate the unique symbol exactly as seen or used with a custom parser.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cibarcodedescriptor?language=objc)
16 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct CIBarcodeDescriptor;
19);
20
21extern_conformance!(
22 unsafe impl NSCoding for CIBarcodeDescriptor {}
23);
24
25extern_conformance!(
26 unsafe impl NSCopying for CIBarcodeDescriptor {}
27);
28
29unsafe impl CopyingHelper for CIBarcodeDescriptor {
30 type Result = Self;
31}
32
33extern_conformance!(
34 unsafe impl NSObjectProtocol for CIBarcodeDescriptor {}
35);
36
37extern_conformance!(
38 unsafe impl NSSecureCoding for CIBarcodeDescriptor {}
39);
40
41impl CIBarcodeDescriptor {
42 extern_methods!();
43}
44
45/// Methods declared on superclass `NSObject`.
46impl CIBarcodeDescriptor {
47 extern_methods!(
48 #[unsafe(method(init))]
49 #[unsafe(method_family = init)]
50 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
51
52 #[unsafe(method(new))]
53 #[unsafe(method_family = new)]
54 pub unsafe fn new() -> Retained<Self>;
55 );
56}
57
58/// Constants indicating the percentage of the symbol that is dedicated to error correction.
59///
60/// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/ciqrcodeerrorcorrectionlevel?language=objc)
61// NS_ENUM
62#[repr(transparent)]
63#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
64pub struct CIQRCodeErrorCorrectionLevel(pub NSInteger);
65impl CIQRCodeErrorCorrectionLevel {
66 /// Indicates that approximately 20% of the symbol data is dedicated to error correction.
67 #[doc(alias = "CIQRCodeErrorCorrectionLevelL")]
68 pub const L: Self = Self(b'L' as _);
69 /// Indicates that approximately 37% of the symbol data is dedicated to error correction.
70 #[doc(alias = "CIQRCodeErrorCorrectionLevelM")]
71 pub const M: Self = Self(b'M' as _);
72 /// Indicates that approximately 55% of the symbol data is dedicated to error correction.
73 #[doc(alias = "CIQRCodeErrorCorrectionLevelQ")]
74 pub const Q: Self = Self(b'Q' as _);
75 /// Indicates that approximately 65% of the symbol data is dedicated to error correction.
76 #[doc(alias = "CIQRCodeErrorCorrectionLevelH")]
77 pub const H: Self = Self(b'H' as _);
78}
79
80unsafe impl Encode for CIQRCodeErrorCorrectionLevel {
81 const ENCODING: Encoding = NSInteger::ENCODING;
82}
83
84unsafe impl RefEncode for CIQRCodeErrorCorrectionLevel {
85 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
86}
87
88extern_class!(
89 /// A concrete subclass of the Core Image Barcode Descriptor that represents a square QR code symbol.
90 ///
91 /// ISO/IEC 18004 defines versions from 1 to 40, where a higher symbol version indicates a
92 /// larger data-carrying capacity.
93 /// QR Codes can encode text, vCard contact information, or Uniform Resource Identifiers (URI).
94 ///
95 /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/ciqrcodedescriptor?language=objc)
96 #[unsafe(super(CIBarcodeDescriptor, NSObject))]
97 #[derive(Debug, PartialEq, Eq, Hash)]
98 pub struct CIQRCodeDescriptor;
99);
100
101extern_conformance!(
102 unsafe impl NSCoding for CIQRCodeDescriptor {}
103);
104
105extern_conformance!(
106 unsafe impl NSCopying for CIQRCodeDescriptor {}
107);
108
109unsafe impl CopyingHelper for CIQRCodeDescriptor {
110 type Result = Self;
111}
112
113extern_conformance!(
114 unsafe impl NSObjectProtocol for CIQRCodeDescriptor {}
115);
116
117extern_conformance!(
118 unsafe impl NSSecureCoding for CIQRCodeDescriptor {}
119);
120
121impl CIQRCodeDescriptor {
122 extern_methods!(
123 /// The error-corrected codeword payload that comprises the QR code symbol.
124 ///
125 /// QR Codes are formally specified in ISO/IEC 18004:2006(E).
126 /// Section 6.4.10 "Bitstream to codeword conversion" specifies the set of 8-bit codewords in the symbol
127 /// immediately prior to splitting the message into blocks and applying error correction.
128 ///
129 /// During decode, error correction is applied and if successful, the message is re-ordered to the state immediately
130 /// following "Bitstream to codeword conversion."
131 ///
132 /// The `errorCorrectedPayload` corresponds to this sequence of 8-bit codewords.
133 #[unsafe(method(errorCorrectedPayload))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn errorCorrectedPayload(&self) -> Retained<NSData>;
136
137 /// The version of the QR code which corresponds to the size of the QR code symbol.
138 ///
139 /// ISO/IEC 18004 defines versions from 1 to 40, where a higher symbol version indicates a larger data-carrying capacity.
140 /// This field is required in order to properly interpret the error corrected payload.
141 #[unsafe(method(symbolVersion))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn symbolVersion(&self) -> NSInteger;
144
145 /// The data mask pattern for the QR code symbol.
146 ///
147 /// QR Codes support eight data mask patterns, which are used to avoid large black or large white areas inside the symbol body.
148 /// Valid values range from 0 to 7.
149 #[unsafe(method(maskPattern))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn maskPattern(&self) -> u8;
152
153 /// The error correction level of the QR code symbol.
154 ///
155 /// QR Codes support four levels of Reed-Solomon error correction.
156 ///
157 /// The possible error correction levels are enumerated in ``CIDataMatrixCodeECCVersion``.
158 #[unsafe(method(errorCorrectionLevel))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn errorCorrectionLevel(&self) -> CIQRCodeErrorCorrectionLevel;
161
162 /// Initializes a QR code descriptor for the given payload and parameters.
163 ///
164 /// - Parameters:
165 /// - errorCorrectedPayload: The data to encode in the QR code symbol.
166 /// - symbolVersion: The symbol version, from 1 through 40.
167 /// - maskPattern: The mask pattern to use in the QR code, from 0 to 7.
168 /// - errorCorrectionLevel: The QR code's error correction level: L, M, Q, or H.
169 /// - Returns:
170 /// An initialized ``CIAztecCodeDescriptor`` instance
171 /// or `nil` if the parameters are invalid
172 #[unsafe(method(initWithPayload:symbolVersion:maskPattern:errorCorrectionLevel:))]
173 #[unsafe(method_family = init)]
174 pub unsafe fn initWithPayload_symbolVersion_maskPattern_errorCorrectionLevel(
175 this: Allocated<Self>,
176 error_corrected_payload: &NSData,
177 symbol_version: NSInteger,
178 mask_pattern: u8,
179 error_correction_level: CIQRCodeErrorCorrectionLevel,
180 ) -> Option<Retained<Self>>;
181
182 /// Creates a QR code descriptor for the given payload and parameters.
183 ///
184 /// - Parameters:
185 /// - errorCorrectedPayload: The data to encode in the QR code symbol.
186 /// - symbolVersion: The symbol version, from 1 through 40.
187 /// - maskPattern: The mask pattern to use in the QR code, from 0 to 7.
188 /// - errorCorrectionLevel: The QR code's error correction level: L, M, Q, or H.
189 /// - Returns:
190 /// An autoreleased ``CIAztecCodeDescriptor`` instance
191 /// or `nil` if the parameters are invalid
192 #[unsafe(method(descriptorWithPayload:symbolVersion:maskPattern:errorCorrectionLevel:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn descriptorWithPayload_symbolVersion_maskPattern_errorCorrectionLevel(
195 error_corrected_payload: &NSData,
196 symbol_version: NSInteger,
197 mask_pattern: u8,
198 error_correction_level: CIQRCodeErrorCorrectionLevel,
199 ) -> Option<Retained<Self>>;
200 );
201}
202
203/// Methods declared on superclass `NSObject`.
204impl CIQRCodeDescriptor {
205 extern_methods!(
206 #[unsafe(method(init))]
207 #[unsafe(method_family = init)]
208 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
209
210 #[unsafe(method(new))]
211 #[unsafe(method_family = new)]
212 pub unsafe fn new() -> Retained<Self>;
213 );
214}
215
216extern_class!(
217 /// A concrete subclass the Core Image Barcode Descriptor that represents an Aztec code symbol.
218 ///
219 /// An Aztec code symbol is a 2D barcode format defined by the ISO/IEC 24778:2008 standard.
220 /// It encodes data in concentric square rings around a central bullseye pattern.
221 ///
222 /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/ciazteccodedescriptor?language=objc)
223 #[unsafe(super(CIBarcodeDescriptor, NSObject))]
224 #[derive(Debug, PartialEq, Eq, Hash)]
225 pub struct CIAztecCodeDescriptor;
226);
227
228extern_conformance!(
229 unsafe impl NSCoding for CIAztecCodeDescriptor {}
230);
231
232extern_conformance!(
233 unsafe impl NSCopying for CIAztecCodeDescriptor {}
234);
235
236unsafe impl CopyingHelper for CIAztecCodeDescriptor {
237 type Result = Self;
238}
239
240extern_conformance!(
241 unsafe impl NSObjectProtocol for CIAztecCodeDescriptor {}
242);
243
244extern_conformance!(
245 unsafe impl NSSecureCoding for CIAztecCodeDescriptor {}
246);
247
248impl CIAztecCodeDescriptor {
249 extern_methods!(
250 /// The error-corrected payload that comprises the the Aztec code symbol.
251 ///
252 /// Aztec Codes are formally specified in ISO/IEC 24778:2008(E).
253 ///
254 /// The error corrected payload consists of the 6-, 8-, 10-, or 12-bit message codewords produced
255 /// at the end of the step described in section 7.3.1.2 "Formation of data codewords", which exists
256 /// immediately prior to adding error correction. These codewords have dummy bits inserted to ensure
257 /// that an entire codeword isn't all 0's or all 1's. Clients will need to remove these extra bits
258 /// as part of interpreting the payload.
259 #[unsafe(method(errorCorrectedPayload))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn errorCorrectedPayload(&self) -> Retained<NSData>;
262
263 /// A Boolean value telling if the Aztec code is compact.
264 ///
265 /// Compact Aztec symbols use one-fewer ring in the central finder pattern than full-range
266 /// Aztec symbols of the same number of data layers.
267 #[unsafe(method(isCompact))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn isCompact(&self) -> bool;
270
271 /// The number of data layers in the Aztec code symbol.
272 ///
273 /// Combined with ``isCompact-property``, the number of data layers determines the number of
274 /// modules in the Aztec Code symbol. Valid values range from 1 to 32. Compact symbols can have
275 /// up to 4 data layers.
276 ///
277 /// The number of data layers also determines the number of bits in each data codeword of the message
278 /// carried by the Aztec Code symbol.
279 #[unsafe(method(layerCount))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn layerCount(&self) -> NSInteger;
282
283 /// The number of non-error-correction codewords carried by the Aztec code symbol.
284 ///
285 /// Used to determine the level of error correction in conjunction with the number of data layers.
286 /// Valid values are 1 to 2048. Compact symbols can have up to 64 message codewords.
287 ///
288 /// > Note: this value can exceed the number of message codewords allowed by the number of data
289 /// layers in this symbol. In this case, the actual number of message codewords is 1024 fewer than
290 /// this value and the message payload is to be interpreted in an application-defined manner.
291 #[unsafe(method(dataCodewordCount))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn dataCodewordCount(&self) -> NSInteger;
294
295 /// Initializes an Aztec code descriptor for the given payload and parameters.
296 ///
297 /// - Parameters:
298 /// - errorCorrectedPayload: The data to encode in the Aztec code symbol.
299 /// - isCompact: A Boolean indicating whether or not the Aztec code is compact.
300 /// - layerCount: The number of layers in the Aztec code, from 1 to 32.
301 /// - dataCodewordCount: The number of codewords in the Aztec code, from 1 to 2048.
302 /// - Returns:
303 /// An initialized ``CIAztecCodeDescriptor`` instance
304 /// or `nil` if the parameters are invalid
305 #[unsafe(method(initWithPayload:isCompact:layerCount:dataCodewordCount:))]
306 #[unsafe(method_family = init)]
307 pub unsafe fn initWithPayload_isCompact_layerCount_dataCodewordCount(
308 this: Allocated<Self>,
309 error_corrected_payload: &NSData,
310 is_compact: bool,
311 layer_count: NSInteger,
312 data_codeword_count: NSInteger,
313 ) -> Option<Retained<Self>>;
314
315 /// Creates an Aztec code descriptor for the given payload and parameters.
316 ///
317 /// - Parameters:
318 /// - errorCorrectedPayload: The data to encode in the Aztec code symbol.
319 /// - isCompact: A Boolean indicating whether or not the Aztec code is compact.
320 /// - layerCount: The number of layers in the Aztec code, from 1 to 32.
321 /// - dataCodewordCount: The number of codewords in the Aztec code, from 1 to 2048.
322 /// - Returns:
323 /// An autoreleased ``CIAztecCodeDescriptor`` instance
324 /// or `nil` if the parameters are invalid
325 #[unsafe(method(descriptorWithPayload:isCompact:layerCount:dataCodewordCount:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn descriptorWithPayload_isCompact_layerCount_dataCodewordCount(
328 error_corrected_payload: &NSData,
329 is_compact: bool,
330 layer_count: NSInteger,
331 data_codeword_count: NSInteger,
332 ) -> Option<Retained<Self>>;
333 );
334}
335
336/// Methods declared on superclass `NSObject`.
337impl CIAztecCodeDescriptor {
338 extern_methods!(
339 #[unsafe(method(init))]
340 #[unsafe(method_family = init)]
341 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
342
343 #[unsafe(method(new))]
344 #[unsafe(method_family = new)]
345 pub unsafe fn new() -> Retained<Self>;
346 );
347}
348
349extern_class!(
350 /// A concrete subclass of Core Image Barcode Descriptor that represents a PDF417 symbol.
351 ///
352 /// PDF417 is a stacked linear barcode symbol format used predominantly in transport, ID cards,
353 /// and inventory management. Each pattern in the code comprises 4 bars and spaces, 17 units long.
354 ///
355 /// Refer to the ISO/IEC 15438:2006(E) for the PDF417 symbol specification.
356 ///
357 /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cipdf417codedescriptor?language=objc)
358 #[unsafe(super(CIBarcodeDescriptor, NSObject))]
359 #[derive(Debug, PartialEq, Eq, Hash)]
360 pub struct CIPDF417CodeDescriptor;
361);
362
363extern_conformance!(
364 unsafe impl NSCoding for CIPDF417CodeDescriptor {}
365);
366
367extern_conformance!(
368 unsafe impl NSCopying for CIPDF417CodeDescriptor {}
369);
370
371unsafe impl CopyingHelper for CIPDF417CodeDescriptor {
372 type Result = Self;
373}
374
375extern_conformance!(
376 unsafe impl NSObjectProtocol for CIPDF417CodeDescriptor {}
377);
378
379extern_conformance!(
380 unsafe impl NSSecureCoding for CIPDF417CodeDescriptor {}
381);
382
383impl CIPDF417CodeDescriptor {
384 extern_methods!(
385 /// The error-corrected payload containing the data encoded in the PDF417 code symbol.
386 ///
387 /// The first codeword indicates the number of data codewords in the errorCorrectedPayload.
388 ///
389 /// PDF417 codes are comprised of a start character on the left and a stop character on the right.
390 /// Each row begins and ends with special characters indicating the current row as well as information
391 /// about the dimensions of the PDF417 symbol. The errorCorrectedPayload represents the sequence
392 /// of PDF417 codewords that make up the body of the message. The first codeword indicates the number
393 /// of codewords in the message. This count includes the "count" codeword and any padding codewords,
394 /// but does not include the error correction codewords. Each codeword is a 16-bit value in the range
395 /// of 0...928. The sequence is to be interpreted as described in the PDF417 bar code symbology
396 /// specification -- ISO/IEC 15438:2006(E).
397 #[unsafe(method(errorCorrectedPayload))]
398 #[unsafe(method_family = none)]
399 pub unsafe fn errorCorrectedPayload(&self) -> Retained<NSData>;
400
401 /// A boolean value telling if the PDF417 code is compact.
402 ///
403 /// Compact PDF417 symbols have abbreviated right-side guard bars.
404 #[unsafe(method(isCompact))]
405 #[unsafe(method_family = none)]
406 pub unsafe fn isCompact(&self) -> bool;
407
408 /// The number of rows in the PDF417 code symbol.
409 ///
410 /// Valid row count values are from 3 to 90.
411 #[unsafe(method(rowCount))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn rowCount(&self) -> NSInteger;
414
415 /// The number of columns in the PDF417 code symbol.
416 ///
417 /// Valid column count values are from 1 to 30.
418 /// This count excluded the columns used to indicate the symbol structure.
419 #[unsafe(method(columnCount))]
420 #[unsafe(method_family = none)]
421 pub unsafe fn columnCount(&self) -> NSInteger;
422
423 /// Initializes an PDF417 code descriptor for the given payload and parameters.
424 ///
425 /// - Parameters:
426 /// - errorCorrectedPayload: The data to encode in the PDF417 code symbol.
427 /// - isCompact: A Boolean indicating whether or not the PDF417 code is compact.
428 /// - rowCount: The number of rows in the PDF417 code, from 3 to 90.
429 /// - columnCount: The number of columns in the Aztec code, from 1 to 30.
430 /// - Returns:
431 /// An initialized ``CIPDF417CodeDescriptor`` instance
432 /// or `nil` if the parameters are invalid
433 #[unsafe(method(initWithPayload:isCompact:rowCount:columnCount:))]
434 #[unsafe(method_family = init)]
435 pub unsafe fn initWithPayload_isCompact_rowCount_columnCount(
436 this: Allocated<Self>,
437 error_corrected_payload: &NSData,
438 is_compact: bool,
439 row_count: NSInteger,
440 column_count: NSInteger,
441 ) -> Option<Retained<Self>>;
442
443 /// Creates an PDF417 code descriptor for the given payload and parameters.
444 ///
445 /// - Parameters:
446 /// - errorCorrectedPayload: The data to encode in the PDF417 code symbol.
447 /// - isCompact: A Boolean indicating whether or not the PDF417 code is compact.
448 /// - rowCount: The number of rows in the PDF417 code, from 3 to 90.
449 /// - columnCount: The number of columns in the Aztec code, from 1 to 30.
450 /// - Returns:
451 /// An autoreleased ``CIPDF417CodeDescriptor`` instance
452 /// or `nil` if the parameters are invalid
453 #[unsafe(method(descriptorWithPayload:isCompact:rowCount:columnCount:))]
454 #[unsafe(method_family = none)]
455 pub unsafe fn descriptorWithPayload_isCompact_rowCount_columnCount(
456 error_corrected_payload: &NSData,
457 is_compact: bool,
458 row_count: NSInteger,
459 column_count: NSInteger,
460 ) -> Option<Retained<Self>>;
461 );
462}
463
464/// Methods declared on superclass `NSObject`.
465impl CIPDF417CodeDescriptor {
466 extern_methods!(
467 #[unsafe(method(init))]
468 #[unsafe(method_family = init)]
469 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
470
471 #[unsafe(method(new))]
472 #[unsafe(method_family = new)]
473 pub unsafe fn new() -> Retained<Self>;
474 );
475}
476
477/// Constants indicating the Data Matrix code ECC version.
478///
479/// ECC 000 - 140 symbols offer five levels of error correction using convolutional code error correction.
480/// Each successive level or error correction offers more protection for the message data but increases the
481/// size of the symbol required to carry a given message. See the ISO/IEC 16022:2006 spec for other modes.
482///
483/// ECC 200 symbols utilize Reed-Solomon error correction.
484/// The error correction capacity for any given Data Matrix symbol is fixed by the size (in rows and columns)
485/// of the symbol. See Table 7 of ISO/IEC 16022:2006(E) for more details.
486///
487/// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cidatamatrixcodeeccversion?language=objc)
488// NS_ENUM
489#[repr(transparent)]
490#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
491pub struct CIDataMatrixCodeECCVersion(pub NSInteger);
492impl CIDataMatrixCodeECCVersion {
493 /// Indicates error correction using convolutional code error correction with no data protection.
494 #[doc(alias = "CIDataMatrixCodeECCVersion000")]
495 pub const Version000: Self = Self(0);
496 /// Indicates 1/4 of the symbol is dedicated to convolutional code error correction.
497 #[doc(alias = "CIDataMatrixCodeECCVersion050")]
498 pub const Version050: Self = Self(50);
499 /// Indicates 1/3 of the symbol is dedicated to convolutional code error correction.
500 #[doc(alias = "CIDataMatrixCodeECCVersion080")]
501 pub const Version080: Self = Self(80);
502 /// Indicates 1/2 of the symbol is dedicated to convolutional code error correction.
503 #[doc(alias = "CIDataMatrixCodeECCVersion100")]
504 pub const Version100: Self = Self(100);
505 /// Indicates 3/4 of the symbol is dedicated to convolutional code error correction.
506 #[doc(alias = "CIDataMatrixCodeECCVersion140")]
507 pub const Version140: Self = Self(140);
508 /// Indicates error correction using Reed-Solomon error correction. Data protection overhead varies based on symbol size.
509 #[doc(alias = "CIDataMatrixCodeECCVersion200")]
510 pub const Version200: Self = Self(200);
511}
512
513unsafe impl Encode for CIDataMatrixCodeECCVersion {
514 const ENCODING: Encoding = NSInteger::ENCODING;
515}
516
517unsafe impl RefEncode for CIDataMatrixCodeECCVersion {
518 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
519}
520
521extern_class!(
522 /// A concrete subclass the Core Image Barcode Descriptor that represents an Data Matrix code symbol.
523 ///
524 /// A Data Matrix code symbol is a 2D barcode format defined by the ISO/IEC 16022:2006(E) standard.
525 /// It encodes data in square or rectangular symbol with solid lines on the left and bottom sides
526 ///
527 /// See also [Apple's documentation](https://developer.apple.com/documentation/coreimage/cidatamatrixcodedescriptor?language=objc)
528 #[unsafe(super(CIBarcodeDescriptor, NSObject))]
529 #[derive(Debug, PartialEq, Eq, Hash)]
530 pub struct CIDataMatrixCodeDescriptor;
531);
532
533extern_conformance!(
534 unsafe impl NSCoding for CIDataMatrixCodeDescriptor {}
535);
536
537extern_conformance!(
538 unsafe impl NSCopying for CIDataMatrixCodeDescriptor {}
539);
540
541unsafe impl CopyingHelper for CIDataMatrixCodeDescriptor {
542 type Result = Self;
543}
544
545extern_conformance!(
546 unsafe impl NSObjectProtocol for CIDataMatrixCodeDescriptor {}
547);
548
549extern_conformance!(
550 unsafe impl NSSecureCoding for CIDataMatrixCodeDescriptor {}
551);
552
553impl CIDataMatrixCodeDescriptor {
554 extern_methods!(
555 /// The error-corrected payload containing the data encoded in the Data Matrix code symbol.
556 ///
557 /// DataMatrix symbols are specified bn ISO/IEC 16022:2006(E). ECC 200-type symbols will always
558 /// have an even number of rows and columns.
559 ///
560 /// For ECC 200-type symbols, the phases of encoding data into a symbol are described in
561 /// section 5.1 -- Encode procedure overview. The error corrected payload comprises the
562 /// de-interleaved bits of the message described at the end of Step 1: Data encodation.
563 #[unsafe(method(errorCorrectedPayload))]
564 #[unsafe(method_family = none)]
565 pub unsafe fn errorCorrectedPayload(&self) -> Retained<NSData>;
566
567 /// The number of rows in the Data Matrix code symbol.
568 ///
569 /// Refer to ISO/IEC 16022:2006(E) for valid module row and column count combinations.
570 #[unsafe(method(rowCount))]
571 #[unsafe(method_family = none)]
572 pub unsafe fn rowCount(&self) -> NSInteger;
573
574 /// The number of columns in the Data Matrix code symbol.
575 ///
576 /// Refer to ISO/IEC 16022:2006(E) for valid module row and column count combinations.
577 #[unsafe(method(columnCount))]
578 #[unsafe(method_family = none)]
579 pub unsafe fn columnCount(&self) -> NSInteger;
580
581 /// The error correction version of the Data Matrix code symbol.
582 ///
583 /// The possible error correction version are enumerated in ``CIDataMatrixCodeECCVersion``.
584 /// Any symbol with an even number of rows and columns will be ECC 200.
585 #[unsafe(method(eccVersion))]
586 #[unsafe(method_family = none)]
587 pub unsafe fn eccVersion(&self) -> CIDataMatrixCodeECCVersion;
588
589 /// Initializes a Data Matrix code descriptor for the given payload and parameters.
590 ///
591 /// - Parameters:
592 /// - errorCorrectedPayload: The data to encode in the Data Matrix code symbol.
593 /// - rowCount: The number of rows in the Data Matrix code symbol.
594 /// - columnCount: The number of columns in the Data Matrix code symbol.
595 /// - eccVersion: The ``CIDataMatrixCodeECCVersion`` for the Data Matrix code symbol.
596 /// - Returns:
597 /// An initialized ``CIAztecCodeDescriptor`` instance
598 /// or `nil` if the parameters are invalid
599 #[unsafe(method(initWithPayload:rowCount:columnCount:eccVersion:))]
600 #[unsafe(method_family = init)]
601 pub unsafe fn initWithPayload_rowCount_columnCount_eccVersion(
602 this: Allocated<Self>,
603 error_corrected_payload: &NSData,
604 row_count: NSInteger,
605 column_count: NSInteger,
606 ecc_version: CIDataMatrixCodeECCVersion,
607 ) -> Option<Retained<Self>>;
608
609 /// Creates a Data Matrix code descriptor for the given payload and parameters.
610 ///
611 /// - Parameters:
612 /// - errorCorrectedPayload: The data to encode in the Data Matrix code symbol.
613 /// - rowCount: The number of rows in the Data Matrix code symbol.
614 /// - columnCount: The number of columns in the Data Matrix code symbol.
615 /// - eccVersion: The ``CIDataMatrixCodeECCVersion`` for the Data Matrix code symbol.
616 /// - Returns:
617 /// An autoreleased ``CIAztecCodeDescriptor`` instance
618 /// or `nil` if the parameters are invalid
619 #[unsafe(method(descriptorWithPayload:rowCount:columnCount:eccVersion:))]
620 #[unsafe(method_family = none)]
621 pub unsafe fn descriptorWithPayload_rowCount_columnCount_eccVersion(
622 error_corrected_payload: &NSData,
623 row_count: NSInteger,
624 column_count: NSInteger,
625 ecc_version: CIDataMatrixCodeECCVersion,
626 ) -> Option<Retained<Self>>;
627 );
628}
629
630/// Methods declared on superclass `NSObject`.
631impl CIDataMatrixCodeDescriptor {
632 extern_methods!(
633 #[unsafe(method(init))]
634 #[unsafe(method_family = init)]
635 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
636
637 #[unsafe(method(new))]
638 #[unsafe(method_family = new)]
639 pub unsafe fn new() -> Retained<Self>;
640 );
641}
642
643mod private_NSUserActivityCIBarcodeDescriptor {
644 pub trait Sealed {}
645}
646
647/// Category "CIBarcodeDescriptor" on [`NSUserActivity`].
648#[doc(alias = "CIBarcodeDescriptor")]
649pub unsafe trait NSUserActivityCIBarcodeDescriptor:
650 ClassType + Sized + private_NSUserActivityCIBarcodeDescriptor::Sealed
651{
652 extern_methods!(
653 /// The scanned code in the user activity passed in by system scanner.
654 ///
655 /// This property is optional. This value is present if the user activity was created from a source that detected a QR code or other code symbol.
656 #[unsafe(method(detectedBarcodeDescriptor))]
657 #[unsafe(method_family = none)]
658 unsafe fn detectedBarcodeDescriptor(&self) -> Option<Retained<CIBarcodeDescriptor>>;
659 );
660}
661
662impl private_NSUserActivityCIBarcodeDescriptor::Sealed for NSUserActivity {}
663unsafe impl NSUserActivityCIBarcodeDescriptor for NSUserActivity {}