forked from netshade/Cocoa-Touch-Barcodes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NKDModifiedPlesseyHexBarcode.m
40 lines (36 loc) · 1.81 KB
/
NKDModifiedPlesseyHexBarcode.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// -----------------------------------------------------------------------------------
// NKDModifiedPlesseyHexBarcode.m
// -----------------------------------------------------------------------------------
// Created by Jeff LaMarche on Wed May 08 2002.
// ©2002 Naked Software. All rights reserved.
// -----------------------------------------------------------------------------------
// THIS SOURCE CODE IS PROVIDED AS-IS WITH NO WARRANTY OF ANY KIND
// -----------------------------------------------------------------------------------
// You may use and redistribute this source code without limitation
// -----------------------------------------------------------------------------------
#import "NKDModifiedPlesseyHexBarcode.h"
@implementation NKDModifiedPlesseyHexBarcode
// -----------------------------------------------------------------------------------
-(NSString *)_encodeChar:(char)inChar
// -----------------------------------------------------------------------------------
{
if (![[super _encodeChar:inChar] isEqual:@""])
return [super _encodeChar:inChar];
switch (inChar)
{
case 'A':
return [NSString stringWithFormat:@"%@%@%@%@", ZERO_BIT, ONE_BIT, ZERO_BIT, ONE_BIT];
case 'B':
return [NSString stringWithFormat:@"%@%@%@%@", ONE_BIT, ONE_BIT, ZERO_BIT, ONE_BIT];
case 'C':
return [NSString stringWithFormat:@"%@%@%@%@", ZERO_BIT, ZERO_BIT, ONE_BIT, ONE_BIT];
case 'D':
return [NSString stringWithFormat:@"%@%@%@%@", ONE_BIT, ZERO_BIT, ONE_BIT, ONE_BIT];
case 'E':
return [NSString stringWithFormat:@"%@%@%@%@", ZERO_BIT, ONE_BIT, ONE_BIT, ONE_BIT];
case 'F':
return [NSString stringWithFormat:@"%@%@%@%@", ONE_BIT, ONE_BIT, ONE_BIT, ONE_BIT];
}
return @"";
}
@end