Skip to content

Commit f05c424

Browse files
committed
Switched to NS_ENUM from C enum
1 parent 1a90030 commit f05c424

File tree

7 files changed

+48
-48
lines changed

7 files changed

+48
-48
lines changed

proj-ios/PROJProjection.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ @interface PROJProjection()
3232
/**
3333
* Projection unit
3434
*/
35-
@property (nonatomic) enum PROJUnit unit;
35+
@property (nonatomic) PROJUnit unit;
3636
/**
3737
* Well-Known Text Coordinate Definition
3838
*/
@@ -271,11 +271,11 @@ -(PROJProjectionTransform *) transformationWithProjection: (PROJProjection *) pr
271271
return [PROJProjectionTransform transformFromProjection:self andToProjection:projection];
272272
}
273273

274-
-(enum PROJUnit) unit{
274+
-(PROJUnit) unit{
275275
return _unit;
276276
}
277277

278-
-(BOOL) isUnit: (enum PROJUnit) unit{
278+
-(BOOL) isUnit: (PROJUnit) unit{
279279
return [self unit] == unit;
280280
}
281281

proj-ios/PROJProjectionFactory.m

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ +(void) resetOrder{
7777
return [NSOrderedSet orderedSetWithOrderedSet:cachelessOrder];
7878
}
7979

80-
+(void) removeOrderType: (enum PROJProjectionFactoryType) type{
80+
+(void) removeOrderType: (PROJProjectionFactoryType) type{
8181
[order removeObject:[NSNumber numberWithInt:type]];
8282
if(order.count == 0){
8383
[self resetOrder];
@@ -119,7 +119,7 @@ +(PROJProjection *) cachelessProjectionWithEpsg: (NSNumber *) epsg{
119119
return [self cachelessProjectionWithAuthority:PROJ_AUTHORITY_EPSG andNumberCode:epsg];
120120
}
121121

122-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andEpsg: (NSNumber *) epsg{
122+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andEpsg: (NSNumber *) epsg{
123123
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andEpsg:epsg];
124124
}
125125

@@ -135,7 +135,7 @@ +(PROJProjection *) cachelessProjectionWithEpsgInt: (int) epsg{
135135
return [self cachelessProjectionWithEpsg:[NSNumber numberWithInt:epsg]];
136136
}
137137

138-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andEpsgInt: (int) epsg{
138+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andEpsgInt: (int) epsg{
139139
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andEpsgInt:epsg];
140140
}
141141

@@ -153,7 +153,7 @@ +(PROJProjection *) cachelessProjectionWithName: (NSString *) name{
153153
return [self cachelessProjectionWithAuthority:[authorityAndCode objectAtIndex:0] andCode:[authorityAndCode objectAtIndex:1]];
154154
}
155155

156-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andName: (NSString *) name{
156+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andName: (NSString *) name{
157157
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andName:name];
158158
}
159159

@@ -170,7 +170,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
170170
return [self cachelessProjectionWithAuthority:authority andCode:[code stringValue]];
171171
}
172172

173-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andNumberCode: (NSNumber *) code{
173+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andNumberCode: (NSNumber *) code{
174174
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andNumberCode:code];
175175
}
176176

@@ -186,7 +186,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
186186
return [self cachelessProjectionWithAuthority:authority andNumberCode:[NSNumber numberWithInt:code]];
187187
}
188188

189-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andIntCode: (int) code{
189+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andIntCode: (int) code{
190190
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andIntCode:code];
191191
}
192192

@@ -202,7 +202,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
202202
return [self cachelessProjectionWithAuthority:authority andCode:code andParams:nil andDefinition:nil];
203203
}
204204

205-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andCode: (NSString *) code{
205+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andCode: (NSString *) code{
206206
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andCode:code];
207207
}
208208

@@ -218,7 +218,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
218218
return [self cachelessProjectionWithAuthority:authority andCode:[code stringValue] andParams:params];
219219
}
220220

221-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andNumberCode: (NSNumber *) code andParams: (NSString *) params{
221+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andNumberCode: (NSNumber *) code andParams: (NSString *) params{
222222
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andNumberCode:code andParams:params];
223223
}
224224

@@ -234,7 +234,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
234234
return [self cachelessProjectionWithAuthority:authority andNumberCode:[NSNumber numberWithInt:code] andParams:params];
235235
}
236236

237-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andIntCode: (int) code andParams: (NSString *) params{
237+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andIntCode: (int) code andParams: (NSString *) params{
238238
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andIntCode:code andParams:params];
239239
}
240240

@@ -250,7 +250,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
250250
return [self cachelessProjectionWithAuthority:authority andCode:code andParams:params andDefinition:nil];
251251
}
252252

253-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andCode: (NSString *) code andParams: (NSString *) params{
253+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andCode: (NSString *) code andParams: (NSString *) params{
254254
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andCode:code andParams:params];
255255
}
256256

@@ -266,7 +266,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
266266
return [self cachelessProjectionWithAuthority:authority andCode:[code stringValue] andDefinition:definition];
267267
}
268268

269-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andNumberCode: (NSNumber *) code andDefinition: (NSString *) definition{
269+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andNumberCode: (NSNumber *) code andDefinition: (NSString *) definition{
270270
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andNumberCode:code andDefinition:definition];
271271
}
272272

@@ -282,7 +282,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
282282
return [self cachelessProjectionWithAuthority:authority andNumberCode:[NSNumber numberWithInt:code] andDefinition:definition];
283283
}
284284

285-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andIntCode: (int) code andDefinition: (NSString *) definition{
285+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andIntCode: (int) code andDefinition: (NSString *) definition{
286286
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andIntCode:code andDefinition:definition];
287287
}
288288

@@ -298,7 +298,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
298298
return [self cachelessProjectionWithAuthority:authority andCode:code andParams:nil andDefinition:definition];
299299
}
300300

301-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andCode: (NSString *) code andDefinition: (NSString *) definition{
301+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andCode: (NSString *) code andDefinition: (NSString *) definition{
302302
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andCode:code andDefinition:definition];
303303
}
304304

@@ -314,7 +314,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
314314
return [self cachelessProjectionWithAuthority:authority andCode:[code stringValue] andParams:params andDefinition:definition];
315315
}
316316

317-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andNumberCode: (NSNumber *) code andParams: (NSString *) params andDefinition: (NSString *) definition{
317+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andNumberCode: (NSNumber *) code andParams: (NSString *) params andDefinition: (NSString *) definition{
318318
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andNumberCode:code andParams:params andDefinition:definition];
319319
}
320320

@@ -330,7 +330,7 @@ +(PROJProjection *) cachelessProjectionWithAuthority: (NSString *) authority and
330330
return [self cachelessProjectionWithAuthority:authority andNumberCode:[NSNumber numberWithInt:code] andParams:params andDefinition:definition];
331331
}
332332

333-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andIntCode: (int) code andParams: (NSString *) params andDefinition: (NSString *) definition{
333+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andIntCode: (int) code andParams: (NSString *) params andDefinition: (NSString *) definition{
334334
return [self projectionWithTypes:[NSOrderedSet orderedSetWithObject:[NSNumber numberWithInt:type]] andAuthority:authority andIntCode:code andParams:params andDefinition:definition];
335335
}
336336

@@ -353,7 +353,7 @@ +(PROJProjection *) projectionWithTypes: (NSOrderedSet<NSNumber *> *) types andA
353353
for(int i = 0; i < types.count; i++){ // <- a for each loop here causes a memory leak, keep as for loop
354354
NSNumber *typeNumber = [types objectAtIndex:i];
355355

356-
enum PROJProjectionFactoryType type = [typeNumber intValue];
356+
PROJProjectionFactoryType type = [typeNumber intValue];
357357
projection = [self projectionWithType:type andAuthority:authority andCode:code andParams:params andDefinition:definition];
358358

359359
if(projection != nil){
@@ -403,7 +403,7 @@ +(PROJProjection *) projectionWithTypes: (NSOrderedSet<NSNumber *> *) types andA
403403
* definition
404404
* @return projection
405405
*/
406-
+(PROJProjection *) projectionWithType: (enum PROJProjectionFactoryType) type andAuthority: (NSString *) authority andCode: (NSString *) code andParams: (NSString *) params andDefinition: (NSString *) definition{
406+
+(PROJProjection *) projectionWithType: (PROJProjectionFactoryType) type andAuthority: (NSString *) authority andCode: (NSString *) code andParams: (NSString *) params andDefinition: (NSString *) definition{
407407

408408
PROJProjection *projection = nil;
409409

@@ -610,7 +610,7 @@ +(NSString *) coordinateNameWithAuthority: (NSString *) authority andIntCode: (i
610610
return [self coordinateNameWithAuthority:authority andCode:[NSString stringWithFormat:@"%d", code]];
611611
}
612612

613-
+(enum PROJUnit) unitOfCRS: (PJ *) crs{
613+
+(PROJUnit) unitOfCRS: (PJ *) crs{
614614

615615
PJ_PROJ_INFO info = proj_pj_info(crs);
616616
BOOL degrees = info.id != NULL && [[NSString stringWithUTF8String:info.id] isEqualToString:@"longlat"];
@@ -630,7 +630,7 @@ +(enum PROJUnit) unitOfCRS: (PJ *) crs{
630630
proj_context_destroy(context);
631631
}
632632

633-
enum PROJUnit unit = PROJ_UNIT_NONE;
633+
PROJUnit unit = PROJ_UNIT_NONE;
634634

635635
if (degrees) {
636636
unit = PROJ_UNIT_DEGREES;

proj-ios/PROJProjectionTransform.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ -(BOOL) swapAxisWithProjection: (PROJProjection *) projection{
241241
const char *secondAxisDirection = "";
242242
proj_cs_get_axis_info(_context, cs, 0, NULL, NULL, &firstAxisDirection, NULL, NULL, NULL, NULL);
243243
proj_cs_get_axis_info(_context, cs, 1, NULL, NULL, &secondAxisDirection, NULL, NULL, NULL, NULL);
244-
enum CRSAxisDirectionType firstAxis = [CRSAxisDirectionTypes type:[NSString stringWithUTF8String:firstAxisDirection]];
245-
enum CRSAxisDirectionType secondAxis = [CRSAxisDirectionTypes type:[NSString stringWithUTF8String:secondAxisDirection]];
244+
CRSAxisDirectionType firstAxis = [CRSAxisDirectionTypes type:[NSString stringWithUTF8String:firstAxisDirection]];
245+
CRSAxisDirectionType secondAxis = [CRSAxisDirectionTypes type:[NSString stringWithUTF8String:secondAxisDirection]];
246246
swap = [self swapWithFirstAxis:firstAxis andSecondAxis:secondAxis];
247247
}
248248
} else {
@@ -274,16 +274,16 @@ -(BOOL) swapWithCRS: (CRSObject *) crs {
274274
if (cs != nil) {
275275
NSMutableArray<CRSAxis *> *axes = cs.axes;
276276
if (axes != nil && axes.count > 1) {
277-
enum CRSAxisDirectionType firstAxis = [axes objectAtIndex:0].direction;
278-
enum CRSAxisDirectionType secondAxis = [axes objectAtIndex:1].direction;
277+
CRSAxisDirectionType firstAxis = [axes objectAtIndex:0].direction;
278+
CRSAxisDirectionType secondAxis = [axes objectAtIndex:1].direction;
279279
swap = [self swapWithFirstAxis:firstAxis andSecondAxis:secondAxis];
280280
}
281281
}
282282
}
283283
return swap;
284284
}
285285

286-
-(BOOL) swapWithFirstAxis: (enum CRSAxisDirectionType) firstAxis andSecondAxis: (enum CRSAxisDirectionType) secondAxis {
286+
-(BOOL) swapWithFirstAxis: (CRSAxisDirectionType) firstAxis andSecondAxis: (CRSAxisDirectionType) secondAxis {
287287
BOOL swap = NO;
288288
if (firstAxis != -1 && secondAxis != -1) {
289289
switch (firstAxis) {

proj-ios/include/Projections/PROJProjection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ typedef struct PJconsts PJ;
450450
*
451451
* @return unit
452452
*/
453-
-(enum PROJUnit) unit;
453+
-(PROJUnit) unit;
454454

455455
/**
456456
* Determine if the projection is in the provided unit
@@ -459,7 +459,7 @@ typedef struct PJconsts PJ;
459459
* unit
460460
* @return true if in the provided unit
461461
*/
462-
-(BOOL) isUnit: (enum PROJUnit) unit;
462+
-(BOOL) isUnit: (PROJUnit) unit;
463463

464464
/**
465465
* Check if this projection is equal to the authority and code

0 commit comments

Comments
 (0)