-
-
Notifications
You must be signed in to change notification settings - Fork 56.3k
obj-c: de-duplicate values of nested enums #23002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- prefix with outer class name
/cc @komakai |
@alalek I think there was already a mechanism to handle this kind of problem although my memory isn't that great how it worked.
If there is an overlap between the 2 approaches then I think it would be better to choose one unified approach |
@komakai Thank you for the information! In C++ values of nested enums are used through outer class:
So it makes sense to add prefix everywhere as unified approach to be aligned with C++ code. |
Full list of changes in generated code: diff -r -U3 gen/objc/calib3d/CirclesGridFinderParameters.h gen/objc/calib3d/CirclesGridFinderParameters.h
--- gen/objc/calib3d/CirclesGridFinderParameters.h 2022-12-21 13:50:22.730755955 +0000
+++ gen/objc/calib3d/CirclesGridFinderParameters.h 2022-12-21 12:37:19.007325800 +0000
@@ -18,8 +18,8 @@
// C++: enum GridType (cv.CirclesGridFinderParameters.GridType)
typedef NS_ENUM(int, GridType) {
- SYMMETRIC_GRID = 0,
- ASYMMETRIC_GRID = 1
+ CirclesGridFinderParameters_SYMMETRIC_GRID = 0,
+ CirclesGridFinderParameters_ASYMMETRIC_GRID = 1
};
diff -r -U3 gen/objc/features2d/AgastFeatureDetector.h gen/objc/features2d/AgastFeatureDetector.h
--- gen/objc/features2d/AgastFeatureDetector.h 2022-12-21 13:50:22.606753792 +0000
+++ gen/objc/features2d/AgastFeatureDetector.h 2022-12-21 12:55:07.216600400 +0000
@@ -18,10 +18,10 @@
// C++: enum AgastDetectorType (cv.AgastFeatureDetector.DetectorType)
typedef NS_ENUM(int, AgastDetectorType) {
- AGAST_5_8 = 0,
- AGAST_7_12d = 1,
- AGAST_7_12s = 2,
- OAST_9_16 = 3
+ AgastFeatureDetector_AGAST_5_8 = 0,
+ AgastFeatureDetector_AGAST_7_12d = 1,
+ AgastFeatureDetector_AGAST_7_12s = 2,
+ AgastFeatureDetector_OAST_9_16 = 3
};
diff -r -U3 gen/objc/features2d/AKAZE.h gen/objc/features2d/AKAZE.h
--- gen/objc/features2d/AKAZE.h 2022-12-21 13:50:22.605753774 +0000
+++ gen/objc/features2d/AKAZE.h 2022-12-21 12:37:18.882323600 +0000
@@ -18,10 +18,10 @@
// C++: enum DescriptorType (cv.AKAZE.DescriptorType)
typedef NS_ENUM(int, DescriptorType) {
- DESCRIPTOR_KAZE_UPRIGHT = 2,
- DESCRIPTOR_KAZE = 3,
- DESCRIPTOR_MLDB_UPRIGHT = 4,
- DESCRIPTOR_MLDB = 5
+ AKAZE_DESCRIPTOR_KAZE_UPRIGHT = 2,
+ AKAZE_DESCRIPTOR_KAZE = 3,
+ AKAZE_DESCRIPTOR_MLDB_UPRIGHT = 4,
+ AKAZE_DESCRIPTOR_MLDB = 5
};
diff -r -U3 gen/objc/features2d/DescriptorMatcher.h gen/objc/features2d/DescriptorMatcher.h
--- gen/objc/features2d/DescriptorMatcher.h 2022-12-21 13:50:22.610753861 +0000
+++ gen/objc/features2d/DescriptorMatcher.h 2022-12-21 12:37:18.887323700 +0000
@@ -19,12 +19,12 @@
// C++: enum MatcherType (cv.DescriptorMatcher.MatcherType)
typedef NS_ENUM(int, MatcherType) {
- FLANNBASED = 1,
- BRUTEFORCE = 2,
- BRUTEFORCE_L1 = 3,
- BRUTEFORCE_HAMMING = 4,
- BRUTEFORCE_HAMMINGLUT = 5,
- BRUTEFORCE_SL2 = 6
+ DescriptorMatcher_FLANNBASED = 1,
+ DescriptorMatcher_BRUTEFORCE = 2,
+ DescriptorMatcher_BRUTEFORCE_L1 = 3,
+ DescriptorMatcher_BRUTEFORCE_HAMMING = 4,
+ DescriptorMatcher_BRUTEFORCE_HAMMINGLUT = 5,
+ DescriptorMatcher_BRUTEFORCE_SL2 = 6
};
diff -r -U3 gen/objc/features2d/FastFeatureDetector.h gen/objc/features2d/FastFeatureDetector.h
--- gen/objc/features2d/FastFeatureDetector.h 2022-12-21 13:50:22.611753879 +0000
+++ gen/objc/features2d/FastFeatureDetector.h 2022-12-21 12:55:07.225600600 +0000
@@ -18,9 +18,9 @@
// C++: enum FastDetectorType (cv.FastFeatureDetector.DetectorType)
typedef NS_ENUM(int, FastDetectorType) {
- TYPE_5_8 = 0,
- TYPE_7_12 = 1,
- TYPE_9_16 = 2
+ FastFeatureDetector_TYPE_5_8 = 0,
+ FastFeatureDetector_TYPE_7_12 = 1,
+ FastFeatureDetector_TYPE_9_16 = 2
};
diff -r -U3 gen/objc/features2d/KAZE.h gen/objc/features2d/KAZE.h
--- gen/objc/features2d/KAZE.h 2022-12-21 13:50:22.614753931 +0000
+++ gen/objc/features2d/KAZE.h 2022-12-21 12:37:18.890323700 +0000
@@ -18,10 +18,10 @@
// C++: enum DiffusivityType (cv.KAZE.DiffusivityType)
typedef NS_ENUM(int, DiffusivityType) {
- DIFF_PM_G1 = 0,
- DIFF_PM_G2 = 1,
- DIFF_WEICKERT = 2,
- DIFF_CHARBONNIER = 3
+ KAZE_DIFF_PM_G1 = 0,
+ KAZE_DIFF_PM_G2 = 1,
+ KAZE_DIFF_WEICKERT = 2,
+ KAZE_DIFF_CHARBONNIER = 3
};
diff -r -U3 gen/objc/features2d/ORB.h gen/objc/features2d/ORB.h
--- gen/objc/features2d/ORB.h 2022-12-21 13:50:22.616753966 +0000
+++ gen/objc/features2d/ORB.h 2022-12-21 12:37:18.893323800 +0000
@@ -18,8 +18,8 @@
// C++: enum ScoreType (cv.ORB.ScoreType)
typedef NS_ENUM(int, ScoreType) {
- HARRIS_SCORE = 0,
- FAST_SCORE = 1
+ ORB_HARRIS_SCORE = 0,
+ ORB_FAST_SCORE = 1
};
diff -r -U3 gen/objc/ml/ANN_MLP.h gen/objc/ml/ANN_MLP.h
--- gen/objc/ml/ANN_MLP.h 2022-12-21 13:50:22.498751907 +0000
+++ gen/objc/ml/ANN_MLP.h 2022-12-21 12:37:18.773321700 +0000
@@ -19,27 +19,27 @@
// C++: enum ActivationFunctions (cv.ml.ANN_MLP.ActivationFunctions)
typedef NS_ENUM(int, ActivationFunctions) {
- IDENTITY = 0,
- SIGMOID_SYM = 1,
- GAUSSIAN = 2,
- RELU = 3,
- LEAKYRELU = 4
+ ANN_MLP_IDENTITY = 0,
+ ANN_MLP_SIGMOID_SYM = 1,
+ ANN_MLP_GAUSSIAN = 2,
+ ANN_MLP_RELU = 3,
+ ANN_MLP_LEAKYRELU = 4
};
// C++: enum TrainFlags (cv.ml.ANN_MLP.TrainFlags)
typedef NS_ENUM(int, TrainFlags) {
- UPDATE_WEIGHTS = 1,
- NO_INPUT_SCALE = 2,
- NO_OUTPUT_SCALE = 4
+ ANN_MLP_UPDATE_WEIGHTS = 1,
+ ANN_MLP_NO_INPUT_SCALE = 2,
+ ANN_MLP_NO_OUTPUT_SCALE = 4
};
// C++: enum TrainingMethods (cv.ml.ANN_MLP.TrainingMethods)
typedef NS_ENUM(int, TrainingMethods) {
- BACKPROP = 0,
- RPROP = 1,
- ANNEAL = 2
+ ANN_MLP_BACKPROP = 0,
+ ANN_MLP_RPROP = 1,
+ ANN_MLP_ANNEAL = 2
};
diff -r -U3 gen/objc/ml/Boost.h gen/objc/ml/Boost.h
--- gen/objc/ml/Boost.h 2022-12-21 13:50:22.498751907 +0000
+++ gen/objc/ml/Boost.h 2022-12-21 12:37:18.774321700 +0000
@@ -18,10 +18,10 @@
// C++: enum Types (cv.ml.Boost.Types)
typedef NS_ENUM(int, Types) {
- DISCRETE = 0,
- REAL = 1,
- LOGIT = 2,
- GENTLE = 3
+ Boost_DISCRETE = 0,
+ Boost_REAL = 1,
+ Boost_LOGIT = 2,
+ Boost_GENTLE = 3
};
diff -r -U3 gen/objc/ml/DTrees.h gen/objc/ml/DTrees.h
--- gen/objc/ml/DTrees.h 2022-12-21 13:50:22.499751924 +0000
+++ gen/objc/ml/DTrees.h 2022-12-21 12:37:18.775321800 +0000
@@ -18,10 +18,10 @@
// C++: enum DTreeFlags (cv.ml.DTrees.Flags)
typedef NS_ENUM(int, DTreeFlags) {
- PREDICT_AUTO = 0,
- PREDICT_SUM = (1<<8),
- PREDICT_MAX_VOTE = (2<<8),
- PREDICT_MASK = (3<<8)
+ DTrees_PREDICT_AUTO = 0,
+ DTrees_PREDICT_SUM = (1<<8),
+ DTrees_PREDICT_MAX_VOTE = (2<<8),
+ DTrees_PREDICT_MASK = (3<<8)
};
diff -r -U3 gen/objc/ml/EM.h gen/objc/ml/EM.h
--- gen/objc/ml/EM.h 2022-12-21 13:50:22.501751959 +0000
+++ gen/objc/ml/EM.h 2022-12-21 12:55:07.083597800 +0000
@@ -20,10 +20,10 @@
// C++: enum EMTypes (cv.ml.EM.Types)
typedef NS_ENUM(int, EMTypes) {
- COV_MAT_SPHERICAL = 0,
- COV_MAT_DIAGONAL = 1,
- COV_MAT_GENERIC = 2,
- COV_MAT_DEFAULT = COV_MAT_DIAGONAL
+ EM_COV_MAT_SPHERICAL = 0,
+ EM_COV_MAT_DIAGONAL = 1,
+ EM_COV_MAT_GENERIC = 2,
+ EM_COV_MAT_DEFAULT = EM_COV_MAT_DIAGONAL
};
diff -r -U3 gen/objc/ml/KNearest.h gen/objc/ml/KNearest.h
--- gen/objc/ml/KNearest.h 2022-12-21 13:50:22.502751977 +0000
+++ gen/objc/ml/KNearest.h 2022-12-21 12:37:18.777321800 +0000
@@ -18,8 +18,8 @@
// C++: enum KNearestTypes (cv.ml.KNearest.Types)
typedef NS_ENUM(int, KNearestTypes) {
- BRUTE_FORCE = 1,
- KDTREE = 2
+ KNearest_BRUTE_FORCE = 1,
+ KNearest_KDTREE = 2
};
diff -r -U3 gen/objc/ml/LogisticRegression.h gen/objc/ml/LogisticRegression.h
--- gen/objc/ml/LogisticRegression.h 2022-12-21 13:50:22.503751994 +0000
+++ gen/objc/ml/LogisticRegression.h 2022-12-21 12:37:18.778321800 +0000
@@ -19,16 +19,16 @@
// C++: enum Methods (cv.ml.LogisticRegression.Methods)
typedef NS_ENUM(int, Methods) {
- BATCH = 0,
- MINI_BATCH = 1
+ LogisticRegression_BATCH = 0,
+ LogisticRegression_MINI_BATCH = 1
};
// C++: enum RegKinds (cv.ml.LogisticRegression.RegKinds)
typedef NS_ENUM(int, RegKinds) {
- REG_DISABLE = -1,
- REG_L1 = 0,
- REG_L2 = 1
+ LogisticRegression_REG_DISABLE = -1,
+ LogisticRegression_REG_L1 = 0,
+ LogisticRegression_REG_L2 = 1
};
diff -r -U3 gen/objc/ml/StatModel.h gen/objc/ml/StatModel.h
--- gen/objc/ml/StatModel.h 2022-12-21 13:50:22.507752064 +0000
+++ gen/objc/ml/StatModel.h 2022-12-21 12:37:18.782321900 +0000
@@ -19,10 +19,10 @@
// C++: enum StatModelFlags (cv.ml.StatModel.Flags)
typedef NS_ENUM(int, StatModelFlags) {
- UPDATE_MODEL = 1,
- RAW_OUTPUT = 1,
- COMPRESSED_INPUT = 2,
- PREPROCESSED_INPUT = 4
+ StatModel_UPDATE_MODEL = 1,
+ StatModel_RAW_OUTPUT = 1,
+ StatModel_COMPRESSED_INPUT = 2,
+ StatModel_PREPROCESSED_INPUT = 4
};
diff -r -U3 gen/objc/ml/SVM.h gen/objc/ml/SVM.h
--- gen/objc/ml/SVM.h 2022-12-21 13:50:22.506752046 +0000
+++ gen/objc/ml/SVM.h 2022-12-21 12:37:18.781321900 +0000
@@ -20,34 +20,34 @@
// C++: enum KernelTypes (cv.ml.SVM.KernelTypes)
typedef NS_ENUM(int, KernelTypes) {
- CUSTOM = -1,
- LINEAR = 0,
- POLY = 1,
- RBF = 2,
- SIGMOID = 3,
- CHI2 = 4,
- INTER = 5
+ SVM_CUSTOM = -1,
+ SVM_LINEAR = 0,
+ SVM_POLY = 1,
+ SVM_RBF = 2,
+ SVM_SIGMOID = 3,
+ SVM_CHI2 = 4,
+ SVM_INTER = 5
};
// C++: enum ParamTypes (cv.ml.SVM.ParamTypes)
typedef NS_ENUM(int, ParamTypes) {
- C = 0,
- GAMMA = 1,
- P = 2,
- NU = 3,
- COEF = 4,
- DEGREE = 5
+ SVM_C = 0,
+ SVM_GAMMA = 1,
+ SVM_P = 2,
+ SVM_NU = 3,
+ SVM_COEF = 4,
+ SVM_DEGREE = 5
};
// C++: enum SVMTypes (cv.ml.SVM.Types)
typedef NS_ENUM(int, SVMTypes) {
- C_SVC = 100,
- NU_SVC = 101,
- ONE_CLASS = 102,
- EPS_SVR = 103,
- NU_SVR = 104
+ SVM_C_SVC = 100,
+ SVM_NU_SVC = 101,
+ SVM_ONE_CLASS = 102,
+ SVM_EPS_SVR = 103,
+ SVM_NU_SVR = 104
};
diff -r -U3 gen/objc/ml/SVMSGD.h gen/objc/ml/SVMSGD.h
--- gen/objc/ml/SVMSGD.h 2022-12-21 13:50:22.506752046 +0000
+++ gen/objc/ml/SVMSGD.h 2022-12-21 12:37:18.782321900 +0000
@@ -19,15 +19,15 @@
// C++: enum MarginType (cv.ml.SVMSGD.MarginType)
typedef NS_ENUM(int, MarginType) {
- SOFT_MARGIN = 0,
- HARD_MARGIN = 1
+ SVMSGD_SOFT_MARGIN = 0,
+ SVMSGD_HARD_MARGIN = 1
};
// C++: enum SvmsgdType (cv.ml.SVMSGD.SvmsgdType)
typedef NS_ENUM(int, SvmsgdType) {
- SGD = 0,
- ASGD = 1
+ SVMSGD_SGD = 0,
+ SVMSGD_ASGD = 1
};
diff -r -U3 gen/objc/objdetect/FaceRecognizerSF.h gen/objc/objdetect/FaceRecognizerSF.h
--- gen/objc/objdetect/FaceRecognizerSF.h 2022-12-21 13:50:22.757756427 +0000
+++ gen/objc/objdetect/FaceRecognizerSF.h 2022-12-21 12:37:19.034326200 +0000
@@ -19,8 +19,8 @@
// C++: enum DisType (cv.FaceRecognizerSF.DisType)
typedef NS_ENUM(int, DisType) {
- FR_COSINE = 0,
- FR_NORM_L2 = 1
+ FaceRecognizerSF_FR_COSINE = 0,
+ FaceRecognizerSF_FR_NORM_L2 = 1
};
diff -r -U3 gen/objc/objdetect/HOGDescriptor.h gen/objc/objdetect/HOGDescriptor.h
--- gen/objc/objdetect/HOGDescriptor.h 2022-12-21 13:50:22.759756462 +0000
+++ gen/objc/objdetect/HOGDescriptor.h 2022-12-21 12:55:07.403604000 +0000
@@ -23,14 +23,14 @@
// C++: enum DescriptorStorageFormat (cv.HOGDescriptor.DescriptorStorageFormat)
typedef NS_ENUM(int, DescriptorStorageFormat) {
- DESCR_FORMAT_COL_BY_COL = 0,
- DESCR_FORMAT_ROW_BY_ROW = 1
+ HOGDescriptor_DESCR_FORMAT_COL_BY_COL = 0,
+ HOGDescriptor_DESCR_FORMAT_ROW_BY_ROW = 1
};
// C++: enum HistogramNormType (cv.HOGDescriptor.HistogramNormType)
typedef NS_ENUM(int, HistogramNormType) {
- L2Hys = 0
+ HOGDescriptor_L2Hys = 0
};
diff -r -U3 gen/objc/objdetect/QRCodeEncoder.h gen/objc/objdetect/QRCodeEncoder.h
--- gen/objc/objdetect/QRCodeEncoder.h 2022-12-21 13:50:22.761756497 +0000
+++ gen/objc/objdetect/QRCodeEncoder.h 2022-12-21 12:37:19.038326300 +0000
@@ -19,28 +19,28 @@
// C++: enum CorrectionLevel (cv.QRCodeEncoder.CorrectionLevel)
typedef NS_ENUM(int, CorrectionLevel) {
- CORRECT_LEVEL_L = 0,
- CORRECT_LEVEL_M = 1,
- CORRECT_LEVEL_Q = 2,
- CORRECT_LEVEL_H = 3
+ QRCodeEncoder_CORRECT_LEVEL_L = 0,
+ QRCodeEncoder_CORRECT_LEVEL_M = 1,
+ QRCodeEncoder_CORRECT_LEVEL_Q = 2,
+ QRCodeEncoder_CORRECT_LEVEL_H = 3
};
// C++: enum ECIEncodings (cv.QRCodeEncoder.ECIEncodings)
typedef NS_ENUM(int, ECIEncodings) {
- ECI_UTF8 = 26
+ QRCodeEncoder_ECI_UTF8 = 26
};
// C++: enum EncodeMode (cv.QRCodeEncoder.EncodeMode)
typedef NS_ENUM(int, EncodeMode) {
- MODE_AUTO = -1,
- MODE_NUMERIC = 1,
- MODE_ALPHANUMERIC = 2,
- MODE_BYTE = 4,
- MODE_ECI = 7,
- MODE_KANJI = 8,
- MODE_STRUCTURED_APPEND = 3
+ QRCodeEncoder_MODE_AUTO = -1,
+ QRCodeEncoder_MODE_NUMERIC = 1,
+ QRCodeEncoder_MODE_ALPHANUMERIC = 2,
+ QRCodeEncoder_MODE_BYTE = 4,
+ QRCodeEncoder_MODE_ECI = 7,
+ QRCodeEncoder_MODE_KANJI = 8,
+ QRCodeEncoder_MODE_STRUCTURED_APPEND = 3
};
diff -r -U3 gen/objc/tracking/TrackerKCF.h gen/objc/tracking/TrackerKCF.h
--- gen/objc/tracking/TrackerKCF.h 2022-12-21 13:50:22.932759481 +0000
+++ gen/objc/tracking/TrackerKCF.h 2022-12-21 12:42:31.754732600 +0000
@@ -18,9 +18,9 @@
// C++: enum MODE (cv.TrackerKCF.MODE)
typedef NS_ENUM(int, MODE) {
- GRAY = (1 << 0),
- CN = (1 << 1),
- MODE_CUSTOM = (1 << 2)
+ TrackerKCF_GRAY = (1 << 0),
+ TrackerKCF_CN = (1 << 1),
+ TrackerKCF_CUSTOM = (1 << 2)
};
diff -r -U3 gen/objc/xfeatures2d/BEBLID.h gen/objc/xfeatures2d/BEBLID.h
--- gen/objc/xfeatures2d/BEBLID.h 2022-12-21 13:50:22.814757421 +0000
+++ gen/objc/xfeatures2d/BEBLID.h 2022-12-21 12:37:19.092327200 +0000
@@ -18,8 +18,8 @@
// C++: enum BeblidSize (cv.xfeatures2d.BEBLID.BeblidSize)
typedef NS_ENUM(int, BeblidSize) {
- SIZE_512_BITS = 100,
- SIZE_256_BITS = 101
+ BEBLID_SIZE_512_BITS = 100,
+ BEBLID_SIZE_256_BITS = 101
};
diff -r -U3 gen/objc/xfeatures2d/DAISY.h gen/objc/xfeatures2d/DAISY.h
--- gen/objc/xfeatures2d/DAISY.h 2022-12-21 13:50:22.815757439 +0000
+++ gen/objc/xfeatures2d/DAISY.h 2022-12-21 12:37:19.093327300 +0000
@@ -18,10 +18,10 @@
// C++: enum NormalizationType (cv.xfeatures2d.DAISY.NormalizationType)
typedef NS_ENUM(int, NormalizationType) {
- NRM_NONE = 100,
- NRM_PARTIAL = 101,
- NRM_FULL = 102,
- NRM_SIFT = 103
+ DAISY_NRM_NONE = 100,
+ DAISY_NRM_PARTIAL = 101,
+ DAISY_NRM_FULL = 102,
+ DAISY_NRM_SIFT = 103
};
diff -r -U3 gen/objc/xfeatures2d/PCTSignatures.h gen/objc/xfeatures2d/PCTSignatures.h
--- gen/objc/xfeatures2d/PCTSignatures.h 2022-12-21 13:50:22.819757509 +0000
+++ gen/objc/xfeatures2d/PCTSignatures.h 2022-12-21 12:42:31.631730500 +0000
@@ -21,29 +21,29 @@
// C++: enum DistanceFunction (cv.xfeatures2d.PCTSignatures.DistanceFunction)
typedef NS_ENUM(int, DistanceFunction) {
- L0_25 = 0,
- L0_5 = 1,
- L1 = 2,
- L2 = 3,
- L2SQUARED = 4,
- L5 = 5,
- L_INFINITY = 6
+ PCTSignatures_L0_25 = 0,
+ PCTSignatures_L0_5 = 1,
+ PCTSignatures_L1 = 2,
+ PCTSignatures_L2 = 3,
+ PCTSignatures_L2SQUARED = 4,
+ PCTSignatures_L5 = 5,
+ PCTSignatures_L_INFINITY = 6
};
// C++: enum PointDistribution (cv.xfeatures2d.PCTSignatures.PointDistribution)
typedef NS_ENUM(int, PointDistribution) {
- UNIFORM = 0,
- REGULAR = 1,
- NORMAL = 2
+ PCTSignatures_UNIFORM = 0,
+ PCTSignatures_REGULAR = 1,
+ PCTSignatures_NORMAL = 2
};
// C++: enum SimilarityFunction (cv.xfeatures2d.PCTSignatures.SimilarityFunction)
typedef NS_ENUM(int, SimilarityFunction) {
- MINUS = 0,
- SIMFUN_GAUSSIAN = 1,
- HEURISTIC = 2
+ PCTSignatures_MINUS = 0,
+ PCTSignatures_GAUSSIAN = 1,
+ PCTSignatures_HEURISTIC = 2
};
diff -r -U3 gen/objc/xfeatures2d/TEBLID.h gen/objc/xfeatures2d/TEBLID.h
--- gen/objc/xfeatures2d/TEBLID.h 2022-12-21 13:50:22.821757543 +0000
+++ gen/objc/xfeatures2d/TEBLID.h 2022-12-21 12:37:19.099327400 +0000
@@ -18,8 +18,8 @@
// C++: enum TeblidSize (cv.xfeatures2d.TEBLID.TeblidSize)
typedef NS_ENUM(int, TeblidSize) {
- SIZE_256_BITS = 102,
- SIZE_512_BITS = 103
+ TEBLID_SIZE_256_BITS = 102,
+ TEBLID_SIZE_512_BITS = 103
};
diff -r -U3 gen/objc/ximgproc/EdgeDrawing.h gen/objc/ximgproc/EdgeDrawing.h
--- gen/objc/ximgproc/EdgeDrawing.h 2022-12-21 13:50:22.868758364 +0000
+++ gen/objc/ximgproc/EdgeDrawing.h 2022-12-21 12:37:19.146328200 +0000
@@ -22,10 +22,10 @@
// C++: enum GradientOperator (cv.ximgproc.EdgeDrawing.GradientOperator)
typedef NS_ENUM(int, GradientOperator) {
- PREWITT = 0,
- SOBEL = 1,
- SCHARR = 2,
- LSD = 3
+ EdgeDrawing_PREWITT = 0,
+ EdgeDrawing_SOBEL = 1,
+ EdgeDrawing_SCHARR = 2,
+ EdgeDrawing_LSD = 3
};
|
@alalek For better Swift interoperability/compatibility with previous releases I think you can do like:
|
logging.info('class not found: %s', constinfo) | ||
constinfo.name = constinfo.classname + '_' + constinfo.name | ||
if not constinfo.name.startswith(constinfo.classname + "_"): | ||
constinfo.name = constinfo.classname + '_' + constinfo.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constinfo.name = constinfo.classname + '_' + constinfo.name + ' NS_SWIFT_NAME(' + constinfo.name ')'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is about duplicates?
Check SIZE_256_BITS
and SIZE_512_BITS
from 2 files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alalek In Swift the values of an enum are not global - they are scoped by the enum type.
So you can have something like:
class Test {
enum BiblibSize {
case SIZE_256 = 100
case SIZE_512 = 101
}
enum TeblidSize {
case SIZE_256 = 102
case SIZE_512 = 103
}
let biblibSize: BiblibSize = .SIZE_256
let teblidSize: TeblidSize = .SIZE_256
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Please validate with opencv_contrib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please validate with opencv_contrib.
I build with open_contrib and can confirm the enums are working well in Swift. This code works fine:
let b: BeblidSize = .SIZE_256_BITS
let t: TeblidSize = .SIZE_256_BITS
However I discovered the Objective-C code generation for the aruco module is not working (the problem is unrelated to this code change) - I will prepare a fix for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@komakai Thank you!
👍 |
* obj-c: de-duplicate values of nested enums - prefix with outer class name * obj-c: handle enum names change in assigned values * obj-c: switch on 'const_fix' * obj-c: add NS_SWIFT_NAME
Merge with contrib: opencv/opencv_contrib#3398
resolves #22206
resolves opencv/opencv_contrib#3302
relates #17165
TODO:
Other classes are affected too. E.g.
Also some values already have prefix: