Dynamic build for Objective-C/Swift wrapper
[platform/upstream/opencv.git] / modules / core / misc / objc / common / Size2i.h
1 //
2 //  Size2i.h
3 //
4 //  Created by Giles Payne on 2019/10/06.
5 //
6
7 #pragma once
8
9 #ifdef __cplusplus
10 #import "opencv.hpp"
11 #else
12 #define CV_EXPORTS
13 #endif
14
15 @class Point2i;
16
17 #import <Foundation/Foundation.h>
18
19 NS_ASSUME_NONNULL_BEGIN
20
21 /**
22 * Represents the dimensions of a rectangle the values of which are of type `int`
23 */
24 NS_SWIFT_NAME(Size)
25 CV_EXPORTS @interface Size2i : NSObject
26
27 #pragma mark - Properties
28
29 @property int width;
30 @property int height;
31 #ifdef __cplusplus
32 @property(readonly) cv::Size2i& nativeRef;
33 #endif
34
35 #pragma mark - Constructors
36
37 - (instancetype)init;
38 - (instancetype)initWithWidth:(int)width height:(int)height;
39 - (instancetype)initWithPoint:(Point2i*)point;
40 - (instancetype)initWithVals:(NSArray<NSNumber*>*)vals;
41
42 #ifdef __cplusplus
43 + (instancetype)fromNative:(cv::Size2i&)size;
44 #endif
45 + (instancetype)width:(int)width height:(int)height;
46
47 #pragma mark - Methods
48
49 /**
50 * Returns the area of a rectangle with corresponding dimensions
51 */
52 - (double)area;
53
54 /**
55 * Determines if a rectangle with corresponding dimensions has area of zero
56 */
57 - (BOOL)empty;
58
59 /**
60 * Set the dimensions from the values of an array
61 * @param vals The array of values from which to set the dimensions
62 */
63 - (void)set:(NSArray<NSNumber*>*)vals NS_SWIFT_NAME(set(vals:));
64
65 #pragma mark - Common Methods
66
67 /**
68 * Clone object
69 */
70 - (Size2i*)clone;
71
72 /**
73 * Compare for equality
74 * @param other Object to compare
75 */
76 - (BOOL)isEqual:(nullable id)object;
77
78 /**
79 * Calculate hash value for this object
80 */
81 - (NSUInteger)hash;
82
83 /**
84 * Returns a string that describes the contents of the object
85 */
86 - (NSString*)description;
87
88 @end
89
90 NS_ASSUME_NONNULL_END