forked from netshade/Cocoa-Touch-Barcodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NKDCodabarBarcode.m
65 lines (62 loc) · 2.03 KB
/
NKDCodabarBarcode.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -----------------------------------------------------------------------------------
// NKDCodabarBarcode.h
// -----------------------------------------------------------------------------------
// Created by Jeff LaMarche on Sun May 12 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 "NKDCodabarBarcode.h"
@implementation NKDCodabarBarcode
// -----------------------------------------------------------------------------------
-(NSString *) _encodeChar:(char)inChar
// -----------------------------------------------------------------------------------
{
switch (inChar)
{
case '0':
return @"1010100110";
case '1':
return @"1010110010";
case '2':
return @"1010010110";
case '3':
return @"1100101010";
case '4':
return @"1011010010";
case '5':
return @"1101010010";
case '6':
return @"1001010110";
case '7':
return @"1001011010";
case '8':
return @"100110101";
case '9':
return @"1101001010";
case '-':
return @"1010011010";
case '$':
return @"1011001010";
case ':':
return @"11010110110";
case '/':
return @"11011010110";
case '.':
return @"11011011010";
case '+':
return @"1011001100110";
case 'A':
return @"10110010010";
case 'B':
return @"10100100110";
case 'C':
return @"10010010110";
case 'D':
return @"10100110010";
}
return @"";
}
@end