├── .gitignore ├── README.md ├── examples └── QRUI │ ├── Classes │ ├── QRUIAppDelegate.h │ ├── QRUIAppDelegate.m │ ├── ViewController.h │ └── ViewController.m │ ├── QRUI-Info.plist │ ├── QRUI.xcodeproj │ └── project.pbxproj │ ├── QRUI_Prefix.pch │ └── main.m ├── google.com.png └── src ├── Classes ├── QRBitBuffer.h ├── QRBitBuffer.m ├── QREncoder.m ├── QREncoder │ ├── QRCorrectionLevel.h │ └── QREncoder.h ├── QRMath.h ├── QRMath.m ├── QRMatrix.h ├── QRMatrix.m ├── QRPolynomial.h ├── QRPolynomial.m ├── QRRSBlock.h ├── QRRSBlock.m └── tests │ ├── QREncoderTests.h │ └── QREncoderTests.m ├── QREncoder.xcodeproj └── project.pbxproj ├── QREncoderTest-Info.plist ├── QREncoder_Prefix.pch └── Resources └── google.com.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.pbxuser 3 | xcuserdata/ 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Objective C QR Encoder 2 | ====================== 3 | 4 | This repository contains an open source Objective C QR Encoder 5 | licensed under the Apache Licence, Version 2.0 6 | (http://www.apache.org/licenses/LICENSE-2.0.html). 7 | 8 | Ported from http://github.com/whomwah/rqrcode by Bill Jacobs. 9 | 10 | Adding the QR Encoder to your project 11 | ===================================== 12 | 13 | The QR Encoder is compiled as a static library, and the easiest way to add it to your project is to use 14 | Xcode's "dependent project" facilities. Here is how: 15 | 16 | 1. Clone the ObjQR git repository: `git clone git://github.com/jverkoey/objqr.git`. Make sure 17 | you store the repository in a permanent place because Xcode will need to reference the files 18 | every time you compile your project. 19 | 20 | 2. Locate the "QREncoder.xcodeproj" file under "objqr/src/". Drag QREncoder.xcodeproj and drop it onto 21 | the root of your Xcode project's "Groups and Files" sidebar. A dialog will appear -- make sure 22 | "Copy items" is unchecked and "Reference Type" is "Relative to Project" before clicking "Add". 23 | 24 | 3. Now you need to link the QREncoder static library to your project. Click the "QREncoder.xcodeproj" 25 | item that has just been added to the sidebar. Under the "Details" table, you will see a single 26 | item: libQREncoder.a. Check the checkbox on the far right of libQREncoder.a. 27 | 28 | 4. Now you need to add QREncoder as a dependency of your project so that Xcode compiles it whenever 29 | you compile your project. Expand the "Targets" section of the sidebar and double-click your 30 | application's target. Under the "General" tab you will see a "Direct Dependencies" section. 31 | Click the "+" button, select "QREncoder", and click "Add Target". 32 | 33 | 5. Finally, we need to tell your project where to find the QREncoder headers. Open your 34 | "Project Settings" and go to the "Build" tab. Look for "Header Search Paths" and double-click 35 | it. Add the relative path from your project's directory to the "objqr/src/Classes" directory. 36 | 37 | 6. You're ready to go. Just #import "QREncoder/QREncoder.h" anywhere you want to use QREncoder classes 38 | in your project. 39 | 40 | 41 | Example QR Output 42 | ================= 43 | 44 | ![google.com](google.com.png "google.com") 45 | -------------------------------------------------------------------------------- /examples/QRUI/Classes/QRUIAppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// 18 | @interface QRUIAppDelegate : NSObject { 19 | UIWindow* _window; 20 | } 21 | 22 | @end 23 | 24 | -------------------------------------------------------------------------------- /examples/QRUI/Classes/QRUIAppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import "QRUIAppDelegate.h" 18 | #import "ViewController.h" 19 | 20 | 21 | //////////////////////////////////////////////////////////////////////////////////////////////////// 22 | //////////////////////////////////////////////////////////////////////////////////////////////////// 23 | //////////////////////////////////////////////////////////////////////////////////////////////////// 24 | @implementation QRUIAppDelegate 25 | 26 | 27 | //////////////////////////////////////////////////////////////////////////////////////////////////// 28 | - (void)applicationDidFinishLaunching:(UIApplication *)application { 29 | _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | 31 | ViewController* controller = [[ViewController alloc] init]; 32 | [_window addSubview:controller.view]; 33 | [controller release]; 34 | 35 | // Override point for customization after application launch 36 | [_window makeKeyAndVisible]; 37 | } 38 | 39 | 40 | //////////////////////////////////////////////////////////////////////////////////////////////////// 41 | - (void)dealloc { 42 | [_window release]; 43 | 44 | [super dealloc]; 45 | } 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /examples/QRUI/Classes/ViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// 18 | @interface ViewController : UIViewController { 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /examples/QRUI/Classes/ViewController.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import "ViewController.h" 20 | 21 | static const CGFloat kPadding = 10; 22 | 23 | //////////////////////////////////////////////////////////////////////////////////////////////////// 24 | //////////////////////////////////////////////////////////////////////////////////////////////////// 25 | //////////////////////////////////////////////////////////////////////////////////////////////////// 26 | @implementation ViewController 27 | 28 | 29 | //////////////////////////////////////////////////////////////////////////////////////////////////// 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | 33 | self.view.backgroundColor = [UIColor whiteColor]; 34 | 35 | UIImage* image = [QREncoder encode:@"http://www.google.com/"]; 36 | 37 | UIImageView* imageView = [[UIImageView alloc] initWithImage:image]; 38 | CGFloat qrSize = self.view.bounds.size.width - kPadding * 2; 39 | imageView.frame = CGRectMake(kPadding, (self.view.bounds.size.height - qrSize) / 2, 40 | qrSize, qrSize); 41 | [imageView layer].magnificationFilter = kCAFilterNearest; 42 | 43 | [self.view addSubview:imageView]; 44 | [imageView release]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /examples/QRUI/QRUI-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/QRUI/QRUI.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* QRUIAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* QRUIAppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; 15 | 4720A01A10A1BB4500D42649 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4720A01910A1BB4500D42649 /* ViewController.m */; }; 16 | 4720A13810A23F5400D42649 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4720A13710A23F5400D42649 /* QuartzCore.framework */; }; 17 | EB7DA36310A4F1B20071984A /* libQREncoder.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EB7DA36210A4F1B00071984A /* libQREncoder.a */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | EB7DA36110A4F1B00071984A /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = EB7DA35A10A4F1B00071984A /* QREncoder.xcodeproj */; 24 | proxyType = 2; 25 | remoteGlobalIDString = D2AAC07E0554694100DB518D; 26 | remoteInfo = QREncoder; 27 | }; 28 | EB7DA36510A4F1CE0071984A /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = EB7DA35A10A4F1B00071984A /* QREncoder.xcodeproj */; 31 | proxyType = 1; 32 | remoteGlobalIDString = D2AAC07D0554694100DB518D; 33 | remoteInfo = QREncoder; 34 | }; 35 | EB7DA44F10A4FA0A0071984A /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = EB7DA35A10A4F1B00071984A /* QREncoder.xcodeproj */; 38 | proxyType = 2; 39 | remoteGlobalIDString = EB7DA3AE10A4F5D90071984A; 40 | remoteInfo = QREncoderTest; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 46 | 1D3623240D0F684500981E51 /* QRUIAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QRUIAppDelegate.h; sourceTree = ""; }; 47 | 1D3623250D0F684500981E51 /* QRUIAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QRUIAppDelegate.m; sourceTree = ""; }; 48 | 1D6058910D05DD3D006BFB54 /* QRUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QRUI.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 50 | 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 51 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 32CA4F630368D1EE00C91783 /* QRUI_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QRUI_Prefix.pch; sourceTree = ""; }; 53 | 4720A01810A1BB4500D42649 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 54 | 4720A01910A1BB4500D42649 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55 | 4720A13710A23F5400D42649 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = ""; }; 56 | 8D1107310486CEB800E47090 /* QRUI-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "QRUI-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 57 | EB7DA35A10A4F1B00071984A /* QREncoder.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = QREncoder.xcodeproj; path = ../../src/QREncoder.xcodeproj; sourceTree = SOURCE_ROOT; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 66 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 67 | 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, 68 | 4720A13810A23F5400D42649 /* QuartzCore.framework in Frameworks */, 69 | EB7DA36310A4F1B20071984A /* libQREncoder.a in Frameworks */, 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | 080E96DDFE201D6D7F000001 /* Classes */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 1D3623240D0F684500981E51 /* QRUIAppDelegate.h */, 80 | 1D3623250D0F684500981E51 /* QRUIAppDelegate.m */, 81 | 4720A01810A1BB4500D42649 /* ViewController.h */, 82 | 4720A01910A1BB4500D42649 /* ViewController.m */, 83 | ); 84 | path = Classes; 85 | sourceTree = ""; 86 | }; 87 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 1D6058910D05DD3D006BFB54 /* QRUI.app */, 91 | ); 92 | name = Products; 93 | sourceTree = ""; 94 | }; 95 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 080E96DDFE201D6D7F000001 /* Classes */, 99 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 100 | 29B97317FDCFA39411CA2CEA /* Resources */, 101 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 102 | 19C28FACFE9D520D11CA2CBB /* Products */, 103 | ); 104 | name = CustomTemplate; 105 | sourceTree = ""; 106 | }; 107 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 32CA4F630368D1EE00C91783 /* QRUI_Prefix.pch */, 111 | 29B97316FDCFA39411CA2CEA /* main.m */, 112 | ); 113 | name = "Other Sources"; 114 | sourceTree = ""; 115 | }; 116 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 8D1107310486CEB800E47090 /* QRUI-Info.plist */, 120 | ); 121 | name = Resources; 122 | sourceTree = ""; 123 | }; 124 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | EB7DA35A10A4F1B00071984A /* QREncoder.xcodeproj */, 128 | 288765FC0DF74451002DB57D /* CoreGraphics.framework */, 129 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 130 | 4720A13710A23F5400D42649 /* QuartzCore.framework */, 131 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 132 | ); 133 | name = Frameworks; 134 | sourceTree = ""; 135 | }; 136 | EB7DA35B10A4F1B00071984A /* Products */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | EB7DA36210A4F1B00071984A /* libQREncoder.a */, 140 | EB7DA45010A4FA0A0071984A /* QREncoderTest.octest */, 141 | ); 142 | name = Products; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 1D6058900D05DD3D006BFB54 /* QRUI */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "QRUI" */; 151 | buildPhases = ( 152 | 1D60588D0D05DD3D006BFB54 /* Resources */, 153 | 1D60588E0D05DD3D006BFB54 /* Sources */, 154 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | EB7DA36610A4F1CE0071984A /* PBXTargetDependency */, 160 | ); 161 | name = QRUI; 162 | productName = QRUI; 163 | productReference = 1D6058910D05DD3D006BFB54 /* QRUI.app */; 164 | productType = "com.apple.product-type.application"; 165 | }; 166 | /* End PBXNativeTarget section */ 167 | 168 | /* Begin PBXProject section */ 169 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 170 | isa = PBXProject; 171 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "QRUI" */; 172 | compatibilityVersion = "Xcode 3.1"; 173 | hasScannedForEncodings = 1; 174 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 175 | projectDirPath = ""; 176 | projectReferences = ( 177 | { 178 | ProductGroup = EB7DA35B10A4F1B00071984A /* Products */; 179 | ProjectRef = EB7DA35A10A4F1B00071984A /* QREncoder.xcodeproj */; 180 | }, 181 | ); 182 | projectRoot = ""; 183 | targets = ( 184 | 1D6058900D05DD3D006BFB54 /* QRUI */, 185 | ); 186 | }; 187 | /* End PBXProject section */ 188 | 189 | /* Begin PBXReferenceProxy section */ 190 | EB7DA36210A4F1B00071984A /* libQREncoder.a */ = { 191 | isa = PBXReferenceProxy; 192 | fileType = archive.ar; 193 | path = libQREncoder.a; 194 | remoteRef = EB7DA36110A4F1B00071984A /* PBXContainerItemProxy */; 195 | sourceTree = BUILT_PRODUCTS_DIR; 196 | }; 197 | EB7DA45010A4FA0A0071984A /* QREncoderTest.octest */ = { 198 | isa = PBXReferenceProxy; 199 | fileType = wrapper.cfbundle; 200 | path = QREncoderTest.octest; 201 | remoteRef = EB7DA44F10A4FA0A0071984A /* PBXContainerItemProxy */; 202 | sourceTree = BUILT_PRODUCTS_DIR; 203 | }; 204 | /* End PBXReferenceProxy section */ 205 | 206 | /* Begin PBXResourcesBuildPhase section */ 207 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 208 | isa = PBXResourcesBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXResourcesBuildPhase section */ 215 | 216 | /* Begin PBXSourcesBuildPhase section */ 217 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 218 | isa = PBXSourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 222 | 1D3623260D0F684500981E51 /* QRUIAppDelegate.m in Sources */, 223 | 4720A01A10A1BB4500D42649 /* ViewController.m in Sources */, 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | }; 227 | /* End PBXSourcesBuildPhase section */ 228 | 229 | /* Begin PBXTargetDependency section */ 230 | EB7DA36610A4F1CE0071984A /* PBXTargetDependency */ = { 231 | isa = PBXTargetDependency; 232 | name = QREncoder; 233 | targetProxy = EB7DA36510A4F1CE0071984A /* PBXContainerItemProxy */; 234 | }; 235 | /* End PBXTargetDependency section */ 236 | 237 | /* Begin XCBuildConfiguration section */ 238 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | COPY_PHASE_STRIP = NO; 243 | GCC_DYNAMIC_NO_PIC = NO; 244 | GCC_OPTIMIZATION_LEVEL = 0; 245 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 246 | GCC_PREFIX_HEADER = QRUI_Prefix.pch; 247 | HEADER_SEARCH_PATHS = ../../src/Classes/; 248 | INFOPLIST_FILE = "QRUI-Info.plist"; 249 | PRODUCT_NAME = QRUI; 250 | }; 251 | name = Debug; 252 | }; 253 | 1D6058950D05DD3E006BFB54 /* Release */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ALWAYS_SEARCH_USER_PATHS = NO; 257 | COPY_PHASE_STRIP = YES; 258 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 259 | GCC_PREFIX_HEADER = QRUI_Prefix.pch; 260 | HEADER_SEARCH_PATHS = ../../src/Classes/; 261 | INFOPLIST_FILE = "QRUI-Info.plist"; 262 | PRODUCT_NAME = QRUI; 263 | }; 264 | name = Release; 265 | }; 266 | C01FCF4F08A954540054247B /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 270 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 271 | GCC_C_LANGUAGE_STANDARD = c99; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 273 | GCC_WARN_UNUSED_VARIABLE = YES; 274 | PREBINDING = NO; 275 | SDKROOT = iphoneos3.0; 276 | }; 277 | name = Debug; 278 | }; 279 | C01FCF5008A954540054247B /* Release */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | GCC_C_LANGUAGE_STANDARD = c99; 285 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | PREBINDING = NO; 288 | SDKROOT = iphoneos3.0; 289 | }; 290 | name = Release; 291 | }; 292 | /* End XCBuildConfiguration section */ 293 | 294 | /* Begin XCConfigurationList section */ 295 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "QRUI" */ = { 296 | isa = XCConfigurationList; 297 | buildConfigurations = ( 298 | 1D6058940D05DD3E006BFB54 /* Debug */, 299 | 1D6058950D05DD3E006BFB54 /* Release */, 300 | ); 301 | defaultConfigurationIsVisible = 0; 302 | defaultConfigurationName = Release; 303 | }; 304 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "QRUI" */ = { 305 | isa = XCConfigurationList; 306 | buildConfigurations = ( 307 | C01FCF4F08A954540054247B /* Debug */, 308 | C01FCF5008A954540054247B /* Release */, 309 | ); 310 | defaultConfigurationIsVisible = 0; 311 | defaultConfigurationName = Release; 312 | }; 313 | /* End XCConfigurationList section */ 314 | }; 315 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 316 | } 317 | -------------------------------------------------------------------------------- /examples/QRUI/QRUI_Prefix.pch: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifdef __OBJC__ 18 | #import 19 | #import 20 | #endif 21 | -------------------------------------------------------------------------------- /examples/QRUI/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | int main(int argc, char *argv[]) { 18 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 19 | int retVal = UIApplicationMain(argc, argv, nil, @"QRUIAppDelegate"); 20 | [pool release]; 21 | return retVal; 22 | } 23 | -------------------------------------------------------------------------------- /google.com.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jverkoey/ObjQREncoder/e1841fea7dbd8e0b82a6c7132b17d6d96a3afeac/google.com.png -------------------------------------------------------------------------------- /src/Classes/QRBitBuffer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// 18 | @interface QRBitBuffer : NSObject { 19 | char* _buffer; 20 | int _size; 21 | int _numBits; 22 | } 23 | 24 | @property (nonatomic, readonly) int numBits; 25 | 26 | - (void)append:(BOOL)bit; 27 | - (void)append:(int)value length:(int)length; 28 | - (BOOL)get:(int)index; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /src/Classes/QRBitBuffer.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import "QRBitBuffer.h" 18 | 19 | //////////////////////////////////////////////////////////////////////////////////////////////////// 20 | //////////////////////////////////////////////////////////////////////////////////////////////////// 21 | //////////////////////////////////////////////////////////////////////////////////////////////////// 22 | @implementation QRBitBuffer 23 | 24 | @synthesize numBits = _numBits; 25 | 26 | 27 | //////////////////////////////////////////////////////////////////////////////////////////////////// 28 | - (id)init { 29 | if (self = [super init]) { 30 | _size = 32; 31 | _buffer = (char *)malloc(_size); 32 | memset(_buffer, 0, _size); 33 | } 34 | return self; 35 | } 36 | 37 | 38 | //////////////////////////////////////////////////////////////////////////////////////////////////// 39 | - (void)dealloc { 40 | free(_buffer); 41 | 42 | [super dealloc]; 43 | } 44 | 45 | 46 | //////////////////////////////////////////////////////////////////////////////////////////////////// 47 | - (void)append:(BOOL)bit { 48 | if (_numBits == _size * 8) { 49 | char *newBuffer = (char *)malloc(_size * 2); 50 | memcpy(newBuffer, _buffer, _size); 51 | memset(newBuffer + _size, 0, _size); 52 | free(_buffer); 53 | _buffer = newBuffer; 54 | _size *= 2; 55 | } 56 | 57 | if (bit) { 58 | _buffer[_numBits / 8] |= 1 << (7 - (_numBits % 8)); 59 | } 60 | 61 | _numBits++; 62 | } 63 | 64 | 65 | //////////////////////////////////////////////////////////////////////////////////////////////////// 66 | - (void)append:(int)value length:(int)length { 67 | for(int i = 0; i < length; i++) { 68 | [self append:((value >> (length - i - 1)) & 1) == 1]; 69 | } 70 | } 71 | 72 | 73 | //////////////////////////////////////////////////////////////////////////////////////////////////// 74 | - (BOOL)get:(int)index { 75 | return (_buffer[index / 8] & (1 << (7 - (index % 8)))) != 0; 76 | } 77 | 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /src/Classes/QREncoder.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import "QRBitBuffer.h" 18 | #import "QRMatrix.h" 19 | #import "QREncoder.h" 20 | #import "QRMath.h" 21 | #import "QRPolynomial.h" 22 | #import "QRRSBlock.h" 23 | 24 | //////////////////////////////////////////////////////////////////////////////////////////////////// 25 | #pragma mark Tables and macros 26 | 27 | #define G15 (1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0) 28 | #define G15_MASK (1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1) 29 | #define G18 (1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0) 30 | 31 | static int PATTERN_POSITION_TABLE[][8] = 32 | {{0, 0, 0, 0, 0, 0, 0, 0}, 33 | {6, 18, 0, 0, 0, 0, 0, 0}, 34 | {6, 22, 0, 0, 0, 0, 0, 0}, 35 | {6, 26, 0, 0, 0, 0, 0, 0}, 36 | {6, 30, 0, 0, 0, 0, 0, 0}, 37 | {6, 34, 0, 0, 0, 0, 0, 0}, 38 | {6, 22, 38, 0, 0, 0, 0, 0}, 39 | {6, 24, 42, 0, 0, 0, 0, 0}, 40 | {6, 26, 46, 0, 0, 0, 0, 0}, 41 | {6, 28, 50, 0, 0, 0, 0, 0}, 42 | {6, 30, 54, 0, 0, 0, 0, 0}, 43 | {6, 32, 58, 0, 0, 0, 0, 0}, 44 | {6, 34, 62, 0, 0, 0, 0, 0}, 45 | {6, 26, 46, 66, 0, 0, 0, 0}, 46 | {6, 26, 48, 70, 0, 0, 0, 0}, 47 | {6, 26, 50, 74, 0, 0, 0, 0}, 48 | {6, 30, 54, 78, 0, 0, 0, 0}, 49 | {6, 30, 56, 82, 0, 0, 0, 0}, 50 | {6, 30, 58, 86, 0, 0, 0, 0}, 51 | {6, 34, 62, 90, 0, 0, 0, 0}, 52 | {6, 28, 50, 72, 94, 0, 0, 0}, 53 | {6, 26, 50, 74, 98, 0, 0, 0}, 54 | {6, 30, 54, 78, 102, 0, 0, 0}, 55 | {6, 28, 54, 80, 106, 0, 0, 0}, 56 | {6, 32, 58, 84, 110, 0, 0, 0}, 57 | {6, 30, 58, 86, 114, 0, 0, 0}, 58 | {6, 34, 62, 90, 118, 0, 0, 0}, 59 | {6, 26, 50, 74, 98, 122, 0, 0}, 60 | {6, 30, 54, 78, 102, 126, 0, 0}, 61 | {6, 26, 52, 78, 104, 130, 0, 0}, 62 | {6, 30, 56, 82, 108, 134, 0, 0}, 63 | {6, 34, 60, 86, 112, 138, 0, 0}, 64 | {6, 30, 58, 86, 114, 142, 0, 0}, 65 | {6, 34, 62, 90, 118, 146, 0, 0}, 66 | {6, 30, 54, 78, 102, 126, 150, 0}, 67 | {6, 24, 50, 76, 102, 128, 154, 0}, 68 | {6, 28, 54, 80, 106, 132, 158, 0}, 69 | {6, 32, 58, 84, 110, 136, 162, 0}, 70 | {6, 26, 54, 82, 110, 138, 166, 0}, 71 | {6, 30, 58, 86, 114, 142, 170, 0}}; 72 | 73 | 74 | static int RS_BLOCK_TABLE[][7] = { 75 | //1 76 | {1, 26, 19, 0, 0, 0, 0}, 77 | {1, 26, 16, 0, 0, 0, 0}, 78 | {1, 26, 13, 0, 0, 0, 0}, 79 | {1, 26, 9, 0, 0, 0, 0}, 80 | 81 | //2 82 | {1, 44, 34, 0, 0, 0, 0}, 83 | {1, 44, 28, 0, 0, 0, 0}, 84 | {1, 44, 22, 0, 0, 0, 0}, 85 | {1, 44, 16, 0, 0, 0, 0}, 86 | 87 | //3 88 | {1, 70, 55, 0, 0, 0, 0}, 89 | {1, 70, 44, 0, 0, 0, 0}, 90 | {2, 35, 17, 0, 0, 0, 0}, 91 | {2, 35, 13, 0, 0, 0, 0}, 92 | 93 | //4 94 | {1, 100, 80, 0, 0, 0, 0}, 95 | {2, 50, 32, 0, 0, 0, 0}, 96 | {2, 50, 24, 0, 0, 0, 0}, 97 | {4, 25, 9, 0, 0, 0, 0}, 98 | 99 | //5 100 | {1, 134, 108, 0, 0, 0, 0}, 101 | {2, 67, 43, 0, 0, 0, 0}, 102 | {2, 33, 15, 2, 34, 16, 0}, 103 | {2, 33, 11, 2, 34, 12, 0}, 104 | 105 | //6 106 | {2, 86, 68, 0, 0, 0, 0}, 107 | {4, 43, 27, 0, 0, 0, 0}, 108 | {4, 43, 19, 0, 0, 0, 0}, 109 | {4, 43, 15, 0, 0, 0, 0}, 110 | 111 | //7 112 | {2, 98, 78, 0, 0, 0, 0}, 113 | {4, 49, 31, 0, 0, 0, 0}, 114 | {2, 32, 14, 4, 33, 15, 0}, 115 | {4, 39, 13, 1, 40, 14, 0}, 116 | 117 | //8 118 | {2, 121, 97, 0, 0, 0, 0}, 119 | {2, 60, 38, 2, 61, 39, 0}, 120 | {4, 40, 18, 2, 41, 19, 0}, 121 | {4, 40, 14, 2, 41, 15, 0}, 122 | 123 | //9 124 | {2, 146, 116, 0, 0, 0, 0}, 125 | {3, 58, 36, 2, 59, 37, 0}, 126 | {4, 36, 16, 4, 37, 17, 0}, 127 | {4, 36, 12, 4, 37, 13, 0}, 128 | 129 | //10 130 | {2, 86, 68, 2, 87, 69, 0}, 131 | {4, 69, 43, 1, 70, 44, 0}, 132 | {6, 43, 19, 2, 44, 20, 0}, 133 | {6, 43, 15, 2, 44, 16, 0}, 134 | 135 | //11 136 | {4, 101, 81, 0, 0, 0, 0}, 137 | {1, 80, 50, 4, 81, 51, 0}, 138 | {4, 50, 22, 4, 51, 23, 0}, 139 | {3, 36, 12, 8, 37, 13, 0}, 140 | 141 | //12 142 | {2, 116, 92, 2, 117, 93, 0}, 143 | {6, 58, 36, 2, 59, 37, 0}, 144 | {4, 46, 20, 6, 47, 21, 0}, 145 | {7, 42, 14, 4, 43, 15, 0}, 146 | 147 | //13 148 | {4, 133, 107, 0, 0, 0, 0}, 149 | {8, 59, 37, 1, 60, 38, 0}, 150 | {8, 44, 20, 4, 45, 21, 0}, 151 | {12, 33, 11, 4, 34, 12, 0}, 152 | 153 | //14 154 | {3, 145, 115, 1, 146, 116, 0}, 155 | {4, 64, 40, 5, 65, 41, 0}, 156 | {11, 36, 16, 5, 37, 17, 0}, 157 | {11, 36, 12, 5, 37, 13, 0}, 158 | 159 | //15 160 | {5, 109, 87, 1, 110, 88, 0}, 161 | {5, 65, 41, 5, 66, 42, 0}, 162 | {5, 54, 24, 7, 55, 25, 0}, 163 | {11, 36, 12, 0, 0, 0, 0}, 164 | 165 | //16 166 | {5, 122, 98, 1, 123, 99, 0}, 167 | {7, 73, 45, 3, 74, 46, 0}, 168 | {15, 43, 19, 2, 44, 20, 0}, 169 | {3, 45, 15, 13, 46, 16, 0}, 170 | 171 | //17 172 | {1, 135, 107, 5, 136, 108, 0}, 173 | {10, 74, 46, 1, 75, 47, 0}, 174 | {1, 50, 22, 15, 51, 23, 0}, 175 | {2, 42, 14, 17, 43, 15, 0}, 176 | 177 | //18 178 | {5, 150, 120, 1, 151, 121, 0}, 179 | {9, 69, 43, 4, 70, 44, 0}, 180 | {17, 50, 22, 1, 51, 23, 0}, 181 | {2, 42, 14, 19, 43, 15, 0}, 182 | 183 | //19 184 | {3, 141, 113, 4, 142, 114, 0}, 185 | {3, 70, 44, 11, 71, 45, 0}, 186 | {17, 47, 21, 4, 48, 22, 0}, 187 | {9, 39, 13, 16, 40, 14, 0}, 188 | 189 | //20 190 | {3, 135, 107, 5, 136, 108, 0}, 191 | {3, 67, 41, 13, 68, 42, 0}, 192 | {15, 54, 24, 5, 55, 25, 0}, 193 | {15, 43, 15, 10, 44, 16, 0}, 194 | 195 | //21 196 | {4, 144, 116, 4, 145, 117, 0}, 197 | {17, 68, 42, 0, 0, 0, 0}, 198 | {17, 50, 22, 6, 51, 23, 0}, 199 | {19, 46, 16, 6, 47, 17, 0}, 200 | 201 | //22 202 | {2, 139, 111, 7, 140, 112, 0}, 203 | {17, 74, 46, 0, 0, 0, 0}, 204 | {7, 54, 24, 16, 55, 25, 0}, 205 | {34, 37, 13, 0, 0, 0, 0}, 206 | 207 | //23 208 | {4, 151, 121, 5, 152, 122, 0}, 209 | {4, 75, 47, 14, 76, 48, 0}, 210 | {11, 54, 24, 14, 55, 25, 0}, 211 | {16, 45, 15, 14, 46, 16, 0}, 212 | 213 | //24 214 | {6, 147, 117, 4, 148, 118, 0}, 215 | {6, 73, 45, 14, 74, 46, 0}, 216 | {11, 54, 24, 16, 55, 25, 0}, 217 | {30, 46, 16, 2, 47, 17, 0}, 218 | 219 | //25 220 | {8, 132, 106, 4, 133, 107, 0}, 221 | {8, 75, 47, 13, 76, 48, 0}, 222 | {7, 54, 24, 22, 55, 25, 0}, 223 | {22, 45, 15, 13, 46, 16, 0}, 224 | 225 | //26 226 | {10, 142, 114, 2, 143, 115, 0}, 227 | {19, 74, 46, 4, 75, 47, 0}, 228 | {28, 50, 22, 6, 51, 23, 0}, 229 | {33, 46, 16, 4, 47, 17, 0}, 230 | 231 | //27 232 | {8, 152, 122, 4, 153, 123, 0}, 233 | {22, 73, 45, 3, 74, 46, 0}, 234 | {8, 53, 23, 26, 54, 24, 0}, 235 | {12, 45, 15, 28, 46, 16, 0}, 236 | 237 | //28 238 | {3, 147, 117, 10, 148, 118, 0}, 239 | {3, 73, 45, 23, 74, 46, 0}, 240 | {4, 54, 24, 31, 55, 25, 0}, 241 | {11, 45, 15, 31, 46, 16, 0}, 242 | 243 | //29 244 | {7, 146, 116, 7, 147, 117, 0}, 245 | {21, 73, 45, 7, 74, 46, 0}, 246 | {1, 53, 23, 37, 54, 24, 0}, 247 | {19, 45, 15, 26, 46, 16, 0}, 248 | 249 | //30 250 | {5, 145, 115, 10, 146, 116, 0}, 251 | {19, 75, 47, 10, 76, 48, 0}, 252 | {15, 54, 24, 25, 55, 25, 0}, 253 | {23, 45, 15, 25, 46, 16, 0}, 254 | 255 | //31 256 | {13, 145, 115, 3, 146, 116, 0}, 257 | {2, 74, 46, 29, 75, 47, 0}, 258 | {42, 54, 24, 1, 55, 25, 0}, 259 | {23, 45, 15, 28, 46, 16, 0}, 260 | 261 | //32 262 | {17, 145, 115, 0, 0, 0, 0}, 263 | {10, 74, 46, 23, 75, 47, 0}, 264 | {10, 54, 24, 35, 55, 25, 0}, 265 | {19, 45, 15, 35, 46, 16, 0}, 266 | 267 | //33 268 | {17, 145, 115, 1, 146, 116, 0}, 269 | {14, 74, 46, 21, 75, 47, 0}, 270 | {29, 54, 24, 19, 55, 25, 0}, 271 | {11, 45, 15, 46, 46, 16, 0}, 272 | 273 | //34 274 | {13, 145, 115, 6, 146, 116, 0}, 275 | {14, 74, 46, 23, 75, 47, 0}, 276 | {44, 54, 24, 7, 55, 25, 0}, 277 | {59, 46, 16, 1, 47, 17, 0}, 278 | 279 | //35 280 | {12, 151, 121, 7, 152, 122, 0}, 281 | {12, 75, 47, 26, 76, 48, 0}, 282 | {39, 54, 24, 14, 55, 25, 0}, 283 | {22, 45, 15, 41, 46, 16, 0}, 284 | 285 | //36 286 | {6, 151, 121, 14, 152, 122, 0}, 287 | {6, 75, 47, 34, 76, 48, 0}, 288 | {46, 54, 24, 10, 55, 25, 0}, 289 | {2, 45, 15, 64, 46, 16, 0}, 290 | 291 | //37 292 | {17, 152, 122, 4, 153, 123, 0}, 293 | {29, 74, 46, 14, 75, 47, 0}, 294 | {49, 54, 24, 10, 55, 25, 0}, 295 | {24, 45, 15, 46, 46, 16, 0}, 296 | 297 | //38 298 | {4, 152, 122, 18, 153, 123, 0}, 299 | {13, 74, 46, 32, 75, 47, 0}, 300 | {48, 54, 24, 14, 55, 25, 0}, 301 | {42, 45, 15, 32, 46, 16, 0}, 302 | 303 | //39 304 | {20, 147, 117, 4, 148, 118, 0}, 305 | {40, 75, 47, 7, 76, 48, 0}, 306 | {43, 54, 24, 22, 55, 25, 0}, 307 | {10, 45, 15, 67, 46, 16, 0}, 308 | 309 | //40 310 | {19, 148, 118, 6, 149, 119, 0}, 311 | {18, 75, 47, 31, 76, 48, 0}, 312 | {34, 54, 24, 34, 55, 25, 0}, 313 | {20, 45, 15, 61, 46, 16, 0} 314 | }; 315 | 316 | 317 | 318 | //////////////////////////////////////////////////////////////////////////////////////////////////// 319 | //////////////////////////////////////////////////////////////////////////////////////////////////// 320 | //////////////////////////////////////////////////////////////////////////////////////////////////// 321 | #pragma mark - 322 | @interface QREncoder() 323 | - (void)encode; 324 | - (int)lostPoint; 325 | 326 | @end 327 | 328 | 329 | //////////////////////////////////////////////////////////////////////////////////////////////////// 330 | //////////////////////////////////////////////////////////////////////////////////////////////////// 331 | //////////////////////////////////////////////////////////////////////////////////////////////////// 332 | #pragma mark - 333 | @implementation QREncoder 334 | 335 | 336 | //////////////////////////////////////////////////////////////////////////////////////////////////// 337 | - (id)initWithStr: (NSString*)str 338 | size: (int)size 339 | correctionLevel: (QRCorrectionLevel)correctionLevel 340 | pattern: (int)pattern { 341 | 342 | if (self = [super init]) { 343 | _str = [str copy]; 344 | _size = size; 345 | _correctionLevel = correctionLevel; 346 | _pattern = pattern; 347 | 348 | int matrixSize = 4 * _size + 17; 349 | _matrix = [[QRMatrix alloc] initWithWidth:matrixSize height:matrixSize]; 350 | } 351 | 352 | return self; 353 | } 354 | 355 | 356 | //////////////////////////////////////////////////////////////////////////////////////////////////// 357 | - (void)dealloc { 358 | [_str release]; 359 | [_matrix release]; 360 | [super dealloc]; 361 | } 362 | 363 | 364 | //////////////////////////////////////////////////////////////////////////////////////////////////// 365 | //////////////////////////////////////////////////////////////////////////////////////////////////// 366 | #pragma mark - 367 | #pragma mark Global methods 368 | 369 | 370 | //////////////////////////////////////////////////////////////////////////////////////////////////// 371 | + (UIImage *)imageForMatrix:(QRMatrix *)matrix { 372 | int width = matrix.width; 373 | int height = matrix.height; 374 | unsigned char *bytes = (unsigned char *)malloc(width * height * 4); 375 | for(int y = 0; y < height; y++) { 376 | for(int x = 0; x < width; x++) { 377 | BOOL bit = [matrix getX:x y:y]; 378 | unsigned char intensity = bit ? 0 : 255; 379 | for(int i = 0; i < 3; i++) { 380 | bytes[y * width * 4 + x * 4 + i] = intensity; 381 | } 382 | bytes[y * width * 4 + x * 4 + 3] = 255; 383 | } 384 | } 385 | 386 | //int width = 32; 387 | //int height = 32; 388 | //unsigned char *bytes = (unsigned char *)malloc(width * height); 389 | //memset(bytes, 255, width * height * 4); 390 | 391 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 392 | CGContextRef c = CGBitmapContextCreate(bytes, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast); 393 | CFRelease(colorSpace); 394 | CGImageRef image = CGBitmapContextCreateImage(c); 395 | CFRelease(c); 396 | UIImage *image2 = [UIImage imageWithCGImage:image]; 397 | CFRelease(image); 398 | return image2; 399 | } 400 | 401 | 402 | //////////////////////////////////////////////////////////////////////////////////////////////////// 403 | + (UIImage *)encode:(NSString *)str { 404 | return [QREncoder encode:str size:4 correctionLevel:QRCorrectionLevelHigh]; 405 | } 406 | 407 | 408 | //////////////////////////////////////////////////////////////////////////////////////////////////// 409 | + (UIImage *)encode:(NSString *)str size:(int)size correctionLevel:(QRCorrectionLevel)level { 410 | QREncoder *encoders[8]; 411 | for(int i = 0; i < 8; i++) { 412 | encoders[i] = [[QREncoder alloc] initWithStr:str size:size correctionLevel:level pattern:i]; 413 | [encoders[i] encode]; 414 | } 415 | 416 | int minLostPoint = LONG_MAX; 417 | QREncoder *encoder = nil; 418 | for(int i = 0; i < 8; i++) { 419 | if (encoders[i]->_matrix != nil) { 420 | int lostPoint = [encoders[i] lostPoint]; 421 | if (lostPoint < minLostPoint) { 422 | minLostPoint = lostPoint; 423 | encoder = encoders[i]; 424 | } 425 | } 426 | } 427 | 428 | UIImage *image; 429 | if (encoder != nil) { 430 | image = [QREncoder imageForMatrix:encoder->_matrix]; 431 | } else { 432 | image = nil; 433 | } 434 | 435 | for(int i = 0; i < 8; i++) { 436 | [encoders[i] release]; 437 | } 438 | 439 | return image; 440 | } 441 | 442 | 443 | //////////////////////////////////////////////////////////////////////////////////////////////////// 444 | - (void)setupPositionProbePatternAtRow:(int)row column:(int)col { 445 | for(int r = -1; r <= 7; r++) { 446 | if (row + r < 0 || row + r >= _matrix.height) { 447 | continue; 448 | } 449 | 450 | for(int c = -1; c <= 7; c++) { 451 | if (col + c < 0 || col + c >= _matrix.width) { 452 | continue; 453 | } 454 | 455 | BOOL bit = (r >= 0 && r <= 6 && (c == 0 || c == 6)) || 456 | (c >= 0 && c <= 6 && (r == 0 || r == 6)) || 457 | (r >= 2 && r <= 4 && c >= 2 && c <= 4); 458 | [_matrix setX:col + c y:row + r value:bit]; 459 | } 460 | } 461 | } 462 | 463 | 464 | //////////////////////////////////////////////////////////////////////////////////////////////////// 465 | - (void)setupPositionAdjustPattern { 466 | int *patterns = PATTERN_POSITION_TABLE[_size - 1]; 467 | 468 | for(int i = 0; patterns[i] != 0; i++) { 469 | int row = patterns[i]; 470 | 471 | for(int j = 0; patterns[j] != 0; j++) { 472 | int col = patterns[j]; 473 | if ([_matrix hasSetX:col y:row]) { 474 | continue; 475 | } 476 | 477 | for(int r = -2; r <= 2; r++) { 478 | for(int c = -2; c <= 2; c++) { 479 | BOOL bit = ABS(r) == 2 || ABS(c) == 2 || (r == 0 && c == 0); 480 | [_matrix setX:col + c y:row + r value:bit]; 481 | } 482 | } 483 | } 484 | } 485 | } 486 | 487 | 488 | //////////////////////////////////////////////////////////////////////////////////////////////////// 489 | - (void)setupTimingPattern { 490 | for(int i = 8; i < _matrix.width - 8; i++) { 491 | [_matrix setX:i y:6 value:i % 2 == 0]; 492 | [_matrix setX:6 y:i value:i % 2 == 0]; 493 | } 494 | } 495 | 496 | 497 | //////////////////////////////////////////////////////////////////////////////////////////////////// 498 | - (int)getBchDigit:(int)data { 499 | int digit = 0; 500 | while (data != 0) { 501 | digit++; 502 | data >>= 1; 503 | } 504 | return digit; 505 | } 506 | 507 | 508 | //////////////////////////////////////////////////////////////////////////////////////////////////// 509 | - (int)getBchTypeInfo:(int)data { 510 | int d = data << 10; 511 | 512 | while ([self getBchDigit:d] >= [self getBchDigit:G15]) { 513 | d ^= G15 << ([self getBchDigit:d] - [self getBchDigit:G15]); 514 | } 515 | 516 | return ((data << 10) | d) ^ G15_MASK; 517 | } 518 | 519 | 520 | //////////////////////////////////////////////////////////////////////////////////////////////////// 521 | - (int)getBchTypeNumber:(int)data { 522 | int d = data << 12; 523 | 524 | while ([self getBchDigit:d] >= [self getBchDigit:G18]) { 525 | d ^= (G18 << ([self getBchDigit:d] - [self getBchDigit:G18])); 526 | } 527 | 528 | return (data << 12) | d; 529 | } 530 | 531 | 532 | //////////////////////////////////////////////////////////////////////////////////////////////////// 533 | - (int)correctionLevelNum { 534 | switch (_correctionLevel) { 535 | case QRCorrectionLevelLow: 536 | return 1; 537 | case QRCorrectionLevelMedium: 538 | return 0; 539 | case QRCorrectionLevelQ: 540 | return 3; 541 | case QRCorrectionLevelHigh: 542 | return 2; 543 | default: 544 | NSAssert(NO, @"Unknown correction level"); 545 | return 0; 546 | } 547 | } 548 | 549 | 550 | //////////////////////////////////////////////////////////////////////////////////////////////////// 551 | - (void)setupTypeInfo { 552 | int data = ([self correctionLevelNum] << 3) | _pattern; 553 | int bits = [self getBchTypeInfo:data]; 554 | 555 | for(int i = 0; i < 15; i++) { 556 | BOOL bit = ((bits >> i) & 1) == 1; 557 | 558 | // Vertical 559 | if (i < 6) { 560 | [_matrix setX:8 y:i value:bit]; 561 | } else if (i < 8) { 562 | [_matrix setX:8 y:i + 1 value:bit]; 563 | } else { 564 | [_matrix setX:8 y:_matrix.height - 15 + i value:bit]; 565 | } 566 | 567 | // Horizontal 568 | if (i < 8) { 569 | [_matrix setX:_matrix.width - i - 1 y:8 value:bit]; 570 | } else if (i < 9) { 571 | [_matrix setX:15 - i y:8 value:bit]; 572 | } else { 573 | [_matrix setX:14 - i y:8 value:bit]; 574 | } 575 | } 576 | 577 | // Fixed module 578 | [_matrix setX:8 y:_matrix.height - 8 value:YES]; 579 | } 580 | 581 | 582 | //////////////////////////////////////////////////////////////////////////////////////////////////// 583 | - (void)setupTypeNumber { 584 | int bits = [self getBchTypeNumber:_size]; 585 | for(int i = 0; i < 18; i++) { 586 | BOOL bit = ((bits >> i) & 1) == 1; 587 | [_matrix setX:i % 3 + _matrix.width - 11 y:i / 3 value:bit]; 588 | [_matrix setX:i / 3 y:i % 3 + _matrix.width - 11 value:bit]; 589 | } 590 | } 591 | 592 | 593 | //////////////////////////////////////////////////////////////////////////////////////////////////// 594 | - (int *)getRSBlockTable { 595 | int offset = [self correctionLevelNum]; 596 | switch (_correctionLevel) { 597 | case QRCorrectionLevelLow: 598 | offset = 0; 599 | break; 600 | case QRCorrectionLevelMedium: 601 | offset = 1; 602 | break; 603 | case QRCorrectionLevelQ: 604 | offset = 2; 605 | break; 606 | case QRCorrectionLevelHigh: 607 | offset = 3; 608 | break; 609 | default: 610 | NSAssert(NO, @"Unknown correction level"); 611 | offset = 0; 612 | break; 613 | } 614 | 615 | return RS_BLOCK_TABLE[4 * (_size - 1) + offset]; 616 | } 617 | 618 | 619 | //////////////////////////////////////////////////////////////////////////////////////////////////// 620 | - (NSArray *)getRSBlocks { 621 | NSMutableArray *blocks = [[NSMutableArray alloc] init]; 622 | int *block = [self getRSBlockTable]; 623 | for(int i = 0; i == 0 || block[i - 2] != 0; i += 3) { 624 | QRRSBlock *block2 = [[QRRSBlock alloc] initWithTotalCount:block[i + 1] dataCount:block[i + 2]]; 625 | for(int j = 0; j < block[i]; j++) { 626 | [blocks addObject:block2]; 627 | } 628 | [block2 release]; 629 | } 630 | return [blocks autorelease]; 631 | } 632 | 633 | 634 | //////////////////////////////////////////////////////////////////////////////////////////////////// 635 | - (QRBitBuffer *)getData { 636 | QRBitBuffer *buffer = [[QRBitBuffer alloc] init]; 637 | [buffer append:4 length:4]; 638 | [buffer append:[_str length] length:8]; 639 | 640 | for(int i = 0; i < [_str length]; i++) { 641 | unichar c = [_str characterAtIndex:i]; 642 | if (c >= 256) { 643 | [buffer release]; 644 | return nil; 645 | } 646 | [buffer append:c length:8]; 647 | } 648 | 649 | NSArray *rsBlocks = [self getRSBlocks]; 650 | int totalDataCount = 0; 651 | 652 | for(QRRSBlock *rsBlock in rsBlocks) { 653 | totalDataCount += rsBlock.dataCount; 654 | } 655 | 656 | if (buffer.numBits > totalDataCount * 8) { 657 | //Code overflow 658 | [buffer release]; 659 | return nil; 660 | } 661 | 662 | if (buffer.numBits + 4 <= totalDataCount * 8) { 663 | [buffer append:0 length:4]; 664 | } 665 | 666 | while (buffer.numBits % 8 != 0) { 667 | [buffer append:NO]; 668 | } 669 | 670 | while (YES) { 671 | if (buffer.numBits >= totalDataCount * 8) { 672 | break; 673 | } 674 | [buffer append:0xEC length:8]; 675 | if (buffer.numBits >= totalDataCount * 8) { 676 | break; 677 | } 678 | [buffer append:0x11 length:8]; 679 | } 680 | 681 | return buffer; 682 | } 683 | 684 | 685 | //////////////////////////////////////////////////////////////////////////////////////////////////// 686 | - (QRPolynomial *)errorCorrectPolynomial:(int)length { 687 | int cs[2] = {1, 0}; 688 | 689 | QRPolynomial *p = [[[QRPolynomial alloc] initWithCoeffs:cs length:1 shift:0] autorelease]; 690 | 691 | for(int i = 0; i < length; i++) { 692 | cs[1] = [QRMath exp:i]; 693 | QRPolynomial *p2 = [[QRPolynomial alloc] initWithCoeffs:cs length:2 shift:0]; 694 | p = [p multiply:p2]; 695 | [p2 release]; 696 | } 697 | 698 | return p; 699 | } 700 | 701 | 702 | //////////////////////////////////////////////////////////////////////////////////////////////////// 703 | - (int *)computeBytes:(QRBitBuffer *)data size:(int *)resultSize { 704 | NSArray *rsBlocks = [self getRSBlocks]; 705 | int offset = 0; 706 | int maxDCCount = 0; 707 | int maxECCount = 0; 708 | int **dcData = (int **)malloc([rsBlocks count] * sizeof(int *)); 709 | int **ecData = (int **)malloc([rsBlocks count] * sizeof(int *)); 710 | int *ecCounts = (int *)malloc([rsBlocks count] * sizeof(int)); 711 | for(int r = 0; r < [rsBlocks count]; r++) { 712 | QRRSBlock *rsBlock = [rsBlocks objectAtIndex:r]; 713 | int dcCount = rsBlock.dataCount; 714 | int ecCount = rsBlock.totalCount - dcCount; 715 | maxDCCount = MAX(maxDCCount, dcCount); 716 | maxECCount = MAX(maxECCount, ecCount); 717 | 718 | int *buffer = (int *)malloc(dcCount * sizeof(int)); 719 | memset(buffer, 0, dcCount * sizeof(int)); 720 | for(int i = 0; i < 8 * dcCount; i++) { 721 | if ([data get:i + 8 * offset]) 722 | buffer[i / 8] |= 1 << (7 - (i % 8)); 723 | } 724 | offset += dcCount; 725 | dcData[r] = buffer; 726 | 727 | QRPolynomial *rsPoly = [self errorCorrectPolynomial:ecCount]; 728 | QRPolynomial *rawPoly = 729 | [[QRPolynomial alloc] initWithCoeffs:buffer 730 | length:dcCount 731 | shift:rsPoly.length - 1]; 732 | QRPolynomial *modPoly = [rawPoly mod:rsPoly]; 733 | 734 | int length = rsPoly.length - 1; 735 | ecCounts[r] = length; 736 | int *es = (int *)malloc(length * sizeof(int)); 737 | for(int i = 0; i < length; i++) { 738 | int modIndex = i + modPoly.length - length; 739 | es[i] = modIndex >= 0 ? [modPoly get:modIndex] : 0; 740 | } 741 | ecData[r] = es; 742 | } 743 | 744 | int totalCodeCount = 0; 745 | for(QRRSBlock *rsBlock in rsBlocks) 746 | totalCodeCount += rsBlock.totalCount; 747 | 748 | *resultSize = totalCodeCount; 749 | int *data2 = (int *)malloc(totalCodeCount * sizeof(int)); 750 | int index = 0; 751 | for(int i = 0; i < maxDCCount; i++) { 752 | for(int r = 0; r < [rsBlocks count]; r++) { 753 | QRRSBlock *rsBlock = [rsBlocks objectAtIndex:r]; 754 | if (i < rsBlock.dataCount) { 755 | data2[index] = dcData[r][i]; 756 | index++; 757 | } 758 | } 759 | } 760 | 761 | for(int i = 0; i < maxECCount; i++) { 762 | for(int r = 0; r < [rsBlocks count]; r++) { 763 | if (i < ecCounts[r]) { 764 | data2[index] = ecData[r][i]; 765 | index++; 766 | } 767 | } 768 | } 769 | 770 | for(int i = 0; i < [rsBlocks count]; i++) { 771 | free(dcData[i]); 772 | free(ecData[i]); 773 | } 774 | free(dcData); 775 | free(ecData); 776 | free(ecCounts); 777 | 778 | return data2; 779 | } 780 | 781 | 782 | //////////////////////////////////////////////////////////////////////////////////////////////////// 783 | - (BOOL)maskForRow:(int)i col:(int)j { 784 | switch (_pattern) { 785 | case 0: 786 | return (i + j) % 2 == 0; 787 | case 1: 788 | return i % 2 == 0; 789 | case 2: 790 | return j % 3 == 0; 791 | case 3: 792 | return (i + j) % 3 == 0; 793 | case 4: 794 | return ((i / 2) + (j / 3)) % 2 == 0; 795 | case 5: 796 | return (i * j) % 2 + (i * j) % 3 == 0; 797 | case 6: 798 | return ((i * j) % 2 + (i * j) % 3) % 2 == 0; 799 | case 7: 800 | return ((i * j) % 3 + (i * j) % 2) % 2 == 0; 801 | default: 802 | NSAssert(NO, @"Unknown pattern"); 803 | return NO; 804 | } 805 | } 806 | 807 | 808 | //////////////////////////////////////////////////////////////////////////////////////////////////// 809 | - (void)mapData:(int *)bytes size:(int)dataSize { 810 | int inc = -1; 811 | int row = _matrix.height - 1; 812 | int bitIndex = 7; 813 | int byteIndex = 0; 814 | for(int col2 = _matrix.width - 1; col2 >= 1; col2 -= 2) { 815 | int col; 816 | if (col2 > 6) { 817 | col = col2; 818 | } else { 819 | col = col2 - 1; 820 | } 821 | 822 | while (YES) { 823 | for(int c = 0; c < 2; c++) { 824 | if (![_matrix hasSetX:col - c y:row]) { 825 | BOOL bit = NO; 826 | if (byteIndex < dataSize) { 827 | bit = ((bytes[byteIndex] >> bitIndex) & 1) == 1; 828 | } 829 | if ([self maskForRow:row col:col - c]) { 830 | bit = !bit; 831 | } 832 | [_matrix setX:col - c y:row value:bit]; 833 | if (bitIndex == 0) { 834 | byteIndex++; 835 | bitIndex = 7; 836 | } 837 | else { 838 | bitIndex--; 839 | } 840 | } 841 | } 842 | 843 | row += inc; 844 | if (row < 0 || row >= _matrix.height) { 845 | row -= inc; 846 | inc = -inc; 847 | break; 848 | } 849 | } 850 | } 851 | } 852 | 853 | 854 | //////////////////////////////////////////////////////////////////////////////////////////////////// 855 | - (void)encode { 856 | [self setupPositionProbePatternAtRow:0 column:0]; 857 | [self setupPositionProbePatternAtRow:_matrix.height - 7 column:0]; 858 | [self setupPositionProbePatternAtRow:0 column:_matrix.width - 7]; 859 | [self setupPositionAdjustPattern]; 860 | [self setupTypeInfo]; 861 | [self setupTimingPattern]; 862 | if (_pattern >= 7) { 863 | [self setupTypeNumber]; 864 | } 865 | QRBitBuffer *data = [self getData]; 866 | if (data == nil) { 867 | // Code overflow 868 | [_matrix release]; 869 | _matrix = nil; 870 | 871 | } else { 872 | int dataSize = 0; 873 | int *bytes = [self computeBytes:data size:&dataSize]; 874 | [self mapData:bytes size:dataSize]; 875 | free(bytes); 876 | } 877 | } 878 | 879 | 880 | //////////////////////////////////////////////////////////////////////////////////////////////////// 881 | - (int)lostPoint { 882 | int lostPoint = 0; 883 | 884 | //Level 1 885 | for(int row = 0; row < _matrix.height; row++) { 886 | for(int col = 0; col < _matrix.width; col++) { 887 | int sameCount = 0; 888 | BOOL bit = [_matrix getX:col y:row]; 889 | for(int r = -1; r <= 1; r++) { 890 | if (row + r < 0 || row + r >= _matrix.height) { 891 | continue; 892 | } 893 | for(int c = -1; c <= 1; c++) { 894 | if (col + c < 0 || col + c >= _matrix.height) { 895 | continue; 896 | } 897 | if (bit == [_matrix getX:col + c y:row + r]) { 898 | sameCount++; 899 | } 900 | } 901 | } 902 | if (sameCount > 5) { 903 | lostPoint += sameCount - 2; 904 | } 905 | } 906 | } 907 | 908 | //Level 2 909 | for(int row = 0; row < _matrix.height - 1; row++) { 910 | for(int col = 0; col < _matrix.width - 1; col++) { 911 | int count = 0; 912 | 913 | for(int r = 0; r < 1; r++) { 914 | for(int c = 0; c < 1; c++) { 915 | if ([_matrix getX:col + c y:row + r]) { 916 | count++; 917 | } 918 | } 919 | } 920 | 921 | if (count == 0 || count == 4) { 922 | lostPoint += 3; 923 | } 924 | } 925 | } 926 | 927 | //Level 3 928 | for(int row = 0; row < _matrix.height - 6; row++) { 929 | for(int col = 0; col < _matrix.width; col++) { 930 | if ([_matrix getX:col y:row] && 931 | ![_matrix getX:col y:row + 1] && 932 | [_matrix getX:col y:row + 2] && 933 | [_matrix getX:col y:row + 3] && 934 | ![_matrix getX:col y:row + 4] && 935 | [_matrix getX:col y:row + 5]) { 936 | lostPoint += 40; 937 | } 938 | } 939 | } 940 | 941 | return lostPoint * 10; 942 | } 943 | 944 | @end 945 | -------------------------------------------------------------------------------- /src/Classes/QREncoder/QRCorrectionLevel.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | typedef enum { 18 | QRCorrectionLevelLow, 19 | QRCorrectionLevelMedium, 20 | QRCorrectionLevelQ, 21 | QRCorrectionLevelHigh 22 | } QRCorrectionLevel; 23 | -------------------------------------------------------------------------------- /src/Classes/QREncoder/QREncoder.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // 18 | // Ported from http://github.com/whomwah/rqrcode 19 | // by Bill Jacobs. 20 | // 21 | 22 | #import "QRCorrectionLevel.h" 23 | 24 | @class QRMatrix; 25 | 26 | //////////////////////////////////////////////////////////////////////////////////////////////////// 27 | @interface QREncoder : NSObject { 28 | NSString* _str; 29 | QRCorrectionLevel _correctionLevel; 30 | int _size; 31 | int _pattern; 32 | QRMatrix* _matrix; 33 | } 34 | 35 | + (UIImage *)encode:(NSString *)str; 36 | + (UIImage *)encode:(NSString *)str size:(int)size correctionLevel:(QRCorrectionLevel)level; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /src/Classes/QRMath.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// 18 | @interface QRMath : NSObject { 19 | 20 | } 21 | 22 | + (int)exp:(int)val; 23 | + (int)log:(int)val; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /src/Classes/QRMath.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import "QRMath.h" 18 | 19 | 20 | //////////////////////////////////////////////////////////////////////////////////////////////////// 21 | //////////////////////////////////////////////////////////////////////////////////////////////////// 22 | //////////////////////////////////////////////////////////////////////////////////////////////////// 23 | @implementation QRMath 24 | 25 | static int LOG_TABLE[256]; 26 | static int EXP_TABLE[256]; 27 | 28 | 29 | //////////////////////////////////////////////////////////////////////////////////////////////////// 30 | + (void)initialize { 31 | for(int i = 0; i < 8; i++) { 32 | EXP_TABLE[i] = 1 << i; 33 | } 34 | 35 | for(int i = 8; i < 256; i++) { 36 | EXP_TABLE[i] = EXP_TABLE[i - 4] ^ 37 | EXP_TABLE[i - 5] ^ 38 | EXP_TABLE[i - 6] ^ 39 | EXP_TABLE[i - 8]; 40 | } 41 | 42 | for(int i = 0; i < 255; i++) { 43 | LOG_TABLE[EXP_TABLE[i]] = i; 44 | } 45 | } 46 | 47 | 48 | //////////////////////////////////////////////////////////////////////////////////////////////////// 49 | + (int)exp:(int)val { 50 | val %= 255; 51 | if (val < 0) { 52 | val += 255; 53 | } 54 | return EXP_TABLE[val]; 55 | } 56 | 57 | 58 | //////////////////////////////////////////////////////////////////////////////////////////////////// 59 | + (int)log:(int)val { 60 | return LOG_TABLE[val]; 61 | } 62 | 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /src/Classes/QRMatrix.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// 18 | @interface QRMatrix : NSObject { 19 | char* _bits; 20 | char* _set; 21 | int _width; 22 | int _height; 23 | } 24 | 25 | @property (nonatomic, readonly) int width; 26 | @property (nonatomic, readonly) int height; 27 | 28 | - (id)initWithWidth:(int)width height:(int)height; 29 | 30 | - (void)setX:(int)x y:(int)y value:(BOOL)value; 31 | - (BOOL)getX:(int)x y:(int)y; 32 | - (void)getBits:(char *)bits; 33 | - (BOOL)hasSetX:(int)x y:(int)y; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /src/Classes/QRMatrix.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import "QRMatrix.h" 18 | 19 | 20 | //////////////////////////////////////////////////////////////////////////////////////////////////// 21 | //////////////////////////////////////////////////////////////////////////////////////////////////// 22 | //////////////////////////////////////////////////////////////////////////////////////////////////// 23 | @implementation QRMatrix 24 | 25 | @synthesize height = _height; 26 | @synthesize width = _width; 27 | 28 | 29 | //////////////////////////////////////////////////////////////////////////////////////////////////// 30 | - (id)initWithWidth:(int)width height:(int)height { 31 | if (self = [super init]) { 32 | _width = width; 33 | _height = height; 34 | 35 | int size = (_width * _height + 7) / 8; 36 | _bits = (char *)malloc(size); 37 | _set = (char *)malloc(size); 38 | 39 | memset(_bits, 0, size); 40 | memset(_set, 0, size); 41 | } 42 | return self; 43 | } 44 | 45 | 46 | //////////////////////////////////////////////////////////////////////////////////////////////////// 47 | - (void)dealloc { 48 | free(_bits); 49 | free(_set); 50 | 51 | [super dealloc]; 52 | } 53 | 54 | 55 | //////////////////////////////////////////////////////////////////////////////////////////////////// 56 | - (void)setX:(int)x y:(int)y value:(BOOL)value { 57 | NSAssert(x >= 0 && y >= 0 && x < _width && y < _height, @"Bad coordinates"); 58 | int index = y * _width + x; 59 | 60 | if (value) { 61 | _bits[index / 8] |= (1 << (index % 8)); 62 | } else { 63 | _bits[index / 8] &= ~(1 << (index % 8)); 64 | } 65 | 66 | _set[index / 8] |= (1 << (index % 8)); 67 | } 68 | 69 | 70 | //////////////////////////////////////////////////////////////////////////////////////////////////// 71 | - (BOOL)getX:(int)x y:(int)y { 72 | NSAssert(x >= 0 && y >= 0 && x < _width && y < _height, @"Bad coordinates"); 73 | int index = y * _width + x; 74 | return (_bits[index / 8] & (1 << (index % 8))) != 0; 75 | } 76 | 77 | 78 | //////////////////////////////////////////////////////////////////////////////////////////////////// 79 | - (void)getBits:(char *)bits { 80 | memcpy(bits, _bits, (_width * _height + 7) / 8); 81 | } 82 | 83 | 84 | //////////////////////////////////////////////////////////////////////////////////////////////////// 85 | - (BOOL)hasSetX:(int)x y:(int)y { 86 | int index = y * _width + x; 87 | return (_set[index / 8] & (1 << (index % 8))) != 0; 88 | } 89 | 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /src/Classes/QRPolynomial.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// 18 | @interface QRPolynomial : NSObject { 19 | int* _coeffs; 20 | int _length; 21 | } 22 | 23 | @property (nonatomic, readonly) int length; 24 | 25 | - (id)initWithCoeffs:(int *)coeffs length:(int)length shift:(int)shift; 26 | - (int)get:(int)index; 27 | - (QRPolynomial *)multiply:(QRPolynomial *)p; 28 | - (QRPolynomial *)mod:(QRPolynomial *)p; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /src/Classes/QRPolynomial.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import "QRMath.h" 18 | #import "QRPolynomial.h" 19 | 20 | 21 | //////////////////////////////////////////////////////////////////////////////////////////////////// 22 | //////////////////////////////////////////////////////////////////////////////////////////////////// 23 | //////////////////////////////////////////////////////////////////////////////////////////////////// 24 | @implementation QRPolynomial 25 | 26 | @synthesize length = _length; 27 | 28 | 29 | //////////////////////////////////////////////////////////////////////////////////////////////////// 30 | - (id)initWithCoeffs:(int *)coeffs length:(int)length shift:(int)shift { 31 | if (self = [super init]) { 32 | int offset; 33 | for(offset = 0; offset < length && coeffs[offset] == 0; offset++); 34 | _length = length - offset + shift; 35 | _coeffs = (int *)malloc(_length * sizeof(int)); 36 | for(int i = 0; i < length - offset; i++) { 37 | _coeffs[i] = coeffs[i + offset]; 38 | } 39 | memset(_coeffs + length - offset, 0, shift * sizeof(int)); 40 | } 41 | return self; 42 | } 43 | 44 | 45 | //////////////////////////////////////////////////////////////////////////////////////////////////// 46 | - (void)dealloc { 47 | free(_coeffs); 48 | 49 | [super dealloc]; 50 | } 51 | 52 | 53 | //////////////////////////////////////////////////////////////////////////////////////////////////// 54 | - (int)get:(int)index { 55 | return _coeffs[index]; 56 | } 57 | 58 | 59 | //////////////////////////////////////////////////////////////////////////////////////////////////// 60 | - (QRPolynomial *)multiply:(QRPolynomial *)p { 61 | int length2 = _length + p->_length - 1; 62 | int *cs = (int *)malloc(length2 * sizeof(int)); 63 | memset(cs, 0, length2 * sizeof(int)); 64 | for(int i = 0; i < _length; i++) { 65 | for(int j = 0; j < p->_length; j++) { 66 | cs[i + j] ^= [QRMath exp:[QRMath log:_coeffs[i]] + 67 | [QRMath log:p->_coeffs[j]]]; 68 | } 69 | } 70 | QRPolynomial *p2 = [[QRPolynomial alloc] initWithCoeffs:cs length:length2 shift:0]; 71 | free(cs); 72 | return [p2 autorelease]; 73 | } 74 | 75 | 76 | //////////////////////////////////////////////////////////////////////////////////////////////////// 77 | - (QRPolynomial *)mod:(QRPolynomial *)p { 78 | if (_length < p->_length) { 79 | return [[self retain] autorelease]; 80 | } 81 | int ratio = [QRMath log:_coeffs[0]] - [QRMath log:p->_coeffs[0]]; 82 | int *cs = (int *)malloc(_length * sizeof(int)); 83 | memcpy(cs, _coeffs, _length * sizeof(int)); 84 | for(int i = 0; i < p->_length; i++) { 85 | cs[i] ^= [QRMath exp:[QRMath log:p->_coeffs[i]] + ratio]; 86 | } 87 | QRPolynomial *p2 = [[QRPolynomial alloc] initWithCoeffs:cs length:_length shift:0]; 88 | free(cs); 89 | QRPolynomial *p3 = [p2 mod:p]; 90 | [p2 release]; 91 | return p3; 92 | } 93 | 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /src/Classes/QRRSBlock.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //////////////////////////////////////////////////////////////////////////////////////////////////// 18 | @interface QRRSBlock : NSObject { 19 | int _totalCount; 20 | int _dataCount; 21 | } 22 | 23 | @property (nonatomic, readonly) int totalCount; 24 | @property (nonatomic, readonly) int dataCount; 25 | 26 | - (id)initWithTotalCount:(int)totalCount dataCount:(int)dataCount; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /src/Classes/QRRSBlock.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import "QRRSBlock.h" 18 | 19 | 20 | //////////////////////////////////////////////////////////////////////////////////////////////////// 21 | //////////////////////////////////////////////////////////////////////////////////////////////////// 22 | //////////////////////////////////////////////////////////////////////////////////////////////////// 23 | @implementation QRRSBlock 24 | 25 | @synthesize totalCount = _totalCount; 26 | @synthesize dataCount = _dataCount; 27 | 28 | 29 | //////////////////////////////////////////////////////////////////////////////////////////////////// 30 | - (id)initWithTotalCount:(int)totalCount dataCount:(int)dataCount { 31 | if (self = [super init]) { 32 | _totalCount = totalCount; 33 | _dataCount = dataCount; 34 | } 35 | return self; 36 | } 37 | 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /src/Classes/tests/QREncoderTests.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // See Also: http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html 18 | 19 | #import 20 | 21 | 22 | /////////////////////////////////////////////////////////////////////////////////////////////////// 23 | /////////////////////////////////////////////////////////////////////////////////////////////////// 24 | /////////////////////////////////////////////////////////////////////////////////////////////////// 25 | @interface QREncoderTests : SenTestCase { 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /src/Classes/tests/QREncoderTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import "QREncoderTests.h" 18 | 19 | #import "QREncoder.h" 20 | 21 | 22 | /////////////////////////////////////////////////////////////////////////////////////////////////// 23 | /////////////////////////////////////////////////////////////////////////////////////////////////// 24 | /////////////////////////////////////////////////////////////////////////////////////////////////// 25 | @implementation QREncoderTests 26 | 27 | // See: http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/905-A-Unit-Test_Result_Macro_Reference/unit-test_results.html#//apple_ref/doc/uid/TP40007959-CH21-SW2 28 | // for unit test macros. 29 | 30 | // NSData* pngRepresentation = UIImagePNGRepresentation(genImage); 31 | // [pngRepresentation writeToFile:@"Resources/google.com.png" atomically:YES]; 32 | 33 | 34 | /////////////////////////////////////////////////////////////////////////////////////////////////// 35 | - (void)setUp { 36 | } 37 | 38 | 39 | /////////////////////////////////////////////////////////////////////////////////////////////////// 40 | - (void)tearDown { 41 | } 42 | 43 | 44 | /////////////////////////////////////////////////////////////////////////////////////////////////// 45 | - (void)testEnsureTestImageExistence { 46 | UIImage* image = [UIImage imageWithContentsOfFile:@"Resources/google.com.png"]; 47 | 48 | STAssertNotNil(image, @"Couldn't find the test image %@", 49 | [[NSFileManager defaultManager] currentDirectoryPath]); 50 | } 51 | 52 | 53 | /////////////////////////////////////////////////////////////////////////////////////////////////// 54 | - (void)testURL { 55 | UIImage* srcImage = [UIImage imageWithContentsOfFile:@"Resources/google.com.png"]; 56 | UIImage* genImage = [QREncoder encode:@"http://www.google.com/"]; 57 | 58 | NSData* srcData = UIImagePNGRepresentation(srcImage); 59 | NSData* genData = UIImagePNGRepresentation(genImage); 60 | 61 | STAssertEquals([srcData hash], [genData hash], @"Generated QR doesn't match test case."); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /src/QREncoder.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; 11 | EB7DA2E710A4ECE30071984A /* QREncoder_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = EB7DA2E610A4ECE30071984A /* QREncoder_Prefix.pch */; }; 12 | EB7DA33F10A4F1840071984A /* QRBitBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = EB7DA33110A4F1840071984A /* QRBitBuffer.h */; }; 13 | EB7DA34010A4F1840071984A /* QRBitBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33210A4F1840071984A /* QRBitBuffer.m */; }; 14 | EB7DA34110A4F1840071984A /* QRMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = EB7DA33310A4F1840071984A /* QRMatrix.h */; }; 15 | EB7DA34210A4F1840071984A /* QRMatrix.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33410A4F1840071984A /* QRMatrix.m */; }; 16 | EB7DA34310A4F1840071984A /* QRCorrectionLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = EB7DA33610A4F1840071984A /* QRCorrectionLevel.h */; }; 17 | EB7DA34410A4F1840071984A /* QREncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = EB7DA33710A4F1840071984A /* QREncoder.h */; }; 18 | EB7DA34510A4F1840071984A /* QREncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33810A4F1840071984A /* QREncoder.m */; }; 19 | EB7DA34610A4F1840071984A /* QRMath.h in Headers */ = {isa = PBXBuildFile; fileRef = EB7DA33910A4F1840071984A /* QRMath.h */; }; 20 | EB7DA34710A4F1840071984A /* QRMath.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33A10A4F1840071984A /* QRMath.m */; }; 21 | EB7DA34810A4F1840071984A /* QRPolynomial.h in Headers */ = {isa = PBXBuildFile; fileRef = EB7DA33B10A4F1840071984A /* QRPolynomial.h */; }; 22 | EB7DA34910A4F1840071984A /* QRPolynomial.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33C10A4F1840071984A /* QRPolynomial.m */; }; 23 | EB7DA34A10A4F1840071984A /* QRRSBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = EB7DA33D10A4F1840071984A /* QRRSBlock.h */; }; 24 | EB7DA34B10A4F1840071984A /* QRRSBlock.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33E10A4F1840071984A /* QRRSBlock.m */; }; 25 | EB7DA3DC10A4F67E0071984A /* QREncoderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA3D610A4F6560071984A /* QREncoderTests.m */; }; 26 | EB7DA43710A4F9C50071984A /* QRBitBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33210A4F1840071984A /* QRBitBuffer.m */; }; 27 | EB7DA43810A4F9C60071984A /* QRMatrix.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33410A4F1840071984A /* QRMatrix.m */; }; 28 | EB7DA43910A4F9C70071984A /* QRMath.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33A10A4F1840071984A /* QRMath.m */; }; 29 | EB7DA43A10A4F9C70071984A /* QRPolynomial.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33C10A4F1840071984A /* QRPolynomial.m */; }; 30 | EB7DA43B10A4F9C90071984A /* QRRSBlock.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33E10A4F1840071984A /* QRRSBlock.m */; }; 31 | EB7DA43C10A4F9CC0071984A /* QREncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7DA33810A4F1840071984A /* QREncoder.m */; }; 32 | EB7DA44010A4F9E00071984A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EB7DA43F10A4F9E00071984A /* CoreGraphics.framework */; }; 33 | /* End PBXBuildFile section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 37 | D2AAC07E0554694100DB518D /* libQREncoder.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libQREncoder.a; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | EB7DA2E610A4ECE30071984A /* QREncoder_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QREncoder_Prefix.pch; sourceTree = ""; }; 39 | EB7DA33110A4F1840071984A /* QRBitBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QRBitBuffer.h; path = Classes/QRBitBuffer.h; sourceTree = ""; }; 40 | EB7DA33210A4F1840071984A /* QRBitBuffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QRBitBuffer.m; path = Classes/QRBitBuffer.m; sourceTree = ""; }; 41 | EB7DA33310A4F1840071984A /* QRMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QRMatrix.h; path = Classes/QRMatrix.h; sourceTree = ""; }; 42 | EB7DA33410A4F1840071984A /* QRMatrix.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QRMatrix.m; path = Classes/QRMatrix.m; sourceTree = ""; }; 43 | EB7DA33610A4F1840071984A /* QRCorrectionLevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QRCorrectionLevel.h; path = Classes/QREncoder/QRCorrectionLevel.h; sourceTree = ""; }; 44 | EB7DA33710A4F1840071984A /* QREncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QREncoder.h; path = Classes/QREncoder/QREncoder.h; sourceTree = ""; }; 45 | EB7DA33810A4F1840071984A /* QREncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QREncoder.m; path = Classes/QREncoder.m; sourceTree = ""; }; 46 | EB7DA33910A4F1840071984A /* QRMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QRMath.h; path = Classes/QRMath.h; sourceTree = ""; }; 47 | EB7DA33A10A4F1840071984A /* QRMath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QRMath.m; path = Classes/QRMath.m; sourceTree = ""; }; 48 | EB7DA33B10A4F1840071984A /* QRPolynomial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QRPolynomial.h; path = Classes/QRPolynomial.h; sourceTree = ""; }; 49 | EB7DA33C10A4F1840071984A /* QRPolynomial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QRPolynomial.m; path = Classes/QRPolynomial.m; sourceTree = ""; }; 50 | EB7DA33D10A4F1840071984A /* QRRSBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QRRSBlock.h; path = Classes/QRRSBlock.h; sourceTree = ""; }; 51 | EB7DA33E10A4F1840071984A /* QRRSBlock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QRRSBlock.m; path = Classes/QRRSBlock.m; sourceTree = ""; }; 52 | EB7DA3AE10A4F5D90071984A /* QREncoderTest.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QREncoderTest.octest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | EB7DA3AF10A4F5D90071984A /* QREncoderTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "QREncoderTest-Info.plist"; sourceTree = ""; }; 54 | EB7DA3D510A4F6560071984A /* QREncoderTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QREncoderTests.h; path = Classes/tests/QREncoderTests.h; sourceTree = ""; }; 55 | EB7DA3D610A4F6560071984A /* QREncoderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QREncoderTests.m; path = Classes/tests/QREncoderTests.m; sourceTree = ""; }; 56 | EB7DA43F10A4F9E00071984A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | D2AAC07C0554694100DB518D /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | EB7DA3AB10A4F5D90071984A /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | EB7DA44010A4F9E00071984A /* CoreGraphics.framework in Frameworks */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | 034768DFFF38A50411DB9C8B /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | D2AAC07E0554694100DB518D /* libQREncoder.a */, 83 | EB7DA3AE10A4F5D90071984A /* QREncoderTest.octest */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 0867D691FE84028FC02AAC07 /* QREncoder */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | EB7DA3C610A4F6290071984A /* Tests */, 92 | 08FB77AEFE84172EC02AAC07 /* Encoder */, 93 | 32C88DFF0371C24200C91783 /* Other Sources */, 94 | 0867D69AFE84028FC02AAC07 /* Frameworks */, 95 | 034768DFFF38A50411DB9C8B /* Products */, 96 | EB7DA3AF10A4F5D90071984A /* QREncoderTest-Info.plist */, 97 | EB7DA43F10A4F9E00071984A /* CoreGraphics.framework */, 98 | ); 99 | name = QREncoder; 100 | sourceTree = ""; 101 | }; 102 | 0867D69AFE84028FC02AAC07 /* Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | AACBBE490F95108600F1A2B1 /* Foundation.framework */, 106 | ); 107 | name = Frameworks; 108 | sourceTree = ""; 109 | }; 110 | 08FB77AEFE84172EC02AAC07 /* Encoder */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | EB7DA15D10A4DCD50071984A /* Maths */, 114 | EB7DA33610A4F1840071984A /* QRCorrectionLevel.h */, 115 | EB7DA33710A4F1840071984A /* QREncoder.h */, 116 | EB7DA33810A4F1840071984A /* QREncoder.m */, 117 | ); 118 | name = Encoder; 119 | sourceTree = ""; 120 | }; 121 | 32C88DFF0371C24200C91783 /* Other Sources */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | EB7DA2E610A4ECE30071984A /* QREncoder_Prefix.pch */, 125 | ); 126 | name = "Other Sources"; 127 | sourceTree = ""; 128 | }; 129 | EB7DA15D10A4DCD50071984A /* Maths */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | EB7DA33110A4F1840071984A /* QRBitBuffer.h */, 133 | EB7DA33210A4F1840071984A /* QRBitBuffer.m */, 134 | EB7DA33310A4F1840071984A /* QRMatrix.h */, 135 | EB7DA33410A4F1840071984A /* QRMatrix.m */, 136 | EB7DA33910A4F1840071984A /* QRMath.h */, 137 | EB7DA33A10A4F1840071984A /* QRMath.m */, 138 | EB7DA33B10A4F1840071984A /* QRPolynomial.h */, 139 | EB7DA33C10A4F1840071984A /* QRPolynomial.m */, 140 | EB7DA33D10A4F1840071984A /* QRRSBlock.h */, 141 | EB7DA33E10A4F1840071984A /* QRRSBlock.m */, 142 | ); 143 | name = Maths; 144 | sourceTree = ""; 145 | }; 146 | EB7DA3C610A4F6290071984A /* Tests */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | EB7DA3D510A4F6560071984A /* QREncoderTests.h */, 150 | EB7DA3D610A4F6560071984A /* QREncoderTests.m */, 151 | ); 152 | name = Tests; 153 | sourceTree = ""; 154 | }; 155 | /* End PBXGroup section */ 156 | 157 | /* Begin PBXHeadersBuildPhase section */ 158 | D2AAC07A0554694100DB518D /* Headers */ = { 159 | isa = PBXHeadersBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | EB7DA2E710A4ECE30071984A /* QREncoder_Prefix.pch in Headers */, 163 | EB7DA33F10A4F1840071984A /* QRBitBuffer.h in Headers */, 164 | EB7DA34110A4F1840071984A /* QRMatrix.h in Headers */, 165 | EB7DA34310A4F1840071984A /* QRCorrectionLevel.h in Headers */, 166 | EB7DA34410A4F1840071984A /* QREncoder.h in Headers */, 167 | EB7DA34610A4F1840071984A /* QRMath.h in Headers */, 168 | EB7DA34810A4F1840071984A /* QRPolynomial.h in Headers */, 169 | EB7DA34A10A4F1840071984A /* QRRSBlock.h in Headers */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXHeadersBuildPhase section */ 174 | 175 | /* Begin PBXNativeTarget section */ 176 | D2AAC07D0554694100DB518D /* QREncoder */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "QREncoder" */; 179 | buildPhases = ( 180 | D2AAC07A0554694100DB518D /* Headers */, 181 | D2AAC07B0554694100DB518D /* Sources */, 182 | D2AAC07C0554694100DB518D /* Frameworks */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | ); 188 | name = QREncoder; 189 | productName = QREncoder; 190 | productReference = D2AAC07E0554694100DB518D /* libQREncoder.a */; 191 | productType = "com.apple.product-type.library.static"; 192 | }; 193 | EB7DA3AD10A4F5D90071984A /* QREncoderTest */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = EB7DA3B210A4F5DA0071984A /* Build configuration list for PBXNativeTarget "QREncoderTest" */; 196 | buildPhases = ( 197 | EB7DA3A910A4F5D90071984A /* Resources */, 198 | EB7DA3AA10A4F5D90071984A /* Sources */, 199 | EB7DA3AB10A4F5D90071984A /* Frameworks */, 200 | EB7DA3AC10A4F5D90071984A /* ShellScript */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = QREncoderTest; 207 | productName = QREncoderTest; 208 | productReference = EB7DA3AE10A4F5D90071984A /* QREncoderTest.octest */; 209 | productType = "com.apple.product-type.bundle"; 210 | }; 211 | /* End PBXNativeTarget section */ 212 | 213 | /* Begin PBXProject section */ 214 | 0867D690FE84028FC02AAC07 /* Project object */ = { 215 | isa = PBXProject; 216 | buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "QREncoder" */; 217 | compatibilityVersion = "Xcode 3.1"; 218 | hasScannedForEncodings = 1; 219 | mainGroup = 0867D691FE84028FC02AAC07 /* QREncoder */; 220 | productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 221 | projectDirPath = ""; 222 | projectRoot = ""; 223 | targets = ( 224 | D2AAC07D0554694100DB518D /* QREncoder */, 225 | EB7DA3AD10A4F5D90071984A /* QREncoderTest */, 226 | ); 227 | }; 228 | /* End PBXProject section */ 229 | 230 | /* Begin PBXResourcesBuildPhase section */ 231 | EB7DA3A910A4F5D90071984A /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXResourcesBuildPhase section */ 239 | 240 | /* Begin PBXShellScriptBuildPhase section */ 241 | EB7DA3AC10A4F5D90071984A /* ShellScript */ = { 242 | isa = PBXShellScriptBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | inputPaths = ( 247 | ); 248 | outputPaths = ( 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | shellPath = /bin/sh; 252 | shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; 253 | }; 254 | /* End PBXShellScriptBuildPhase section */ 255 | 256 | /* Begin PBXSourcesBuildPhase section */ 257 | D2AAC07B0554694100DB518D /* Sources */ = { 258 | isa = PBXSourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | EB7DA34010A4F1840071984A /* QRBitBuffer.m in Sources */, 262 | EB7DA34210A4F1840071984A /* QRMatrix.m in Sources */, 263 | EB7DA34510A4F1840071984A /* QREncoder.m in Sources */, 264 | EB7DA34710A4F1840071984A /* QRMath.m in Sources */, 265 | EB7DA34910A4F1840071984A /* QRPolynomial.m in Sources */, 266 | EB7DA34B10A4F1840071984A /* QRRSBlock.m in Sources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | EB7DA3AA10A4F5D90071984A /* Sources */ = { 271 | isa = PBXSourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | EB7DA3DC10A4F67E0071984A /* QREncoderTests.m in Sources */, 275 | EB7DA43710A4F9C50071984A /* QRBitBuffer.m in Sources */, 276 | EB7DA43810A4F9C60071984A /* QRMatrix.m in Sources */, 277 | EB7DA43910A4F9C70071984A /* QRMath.m in Sources */, 278 | EB7DA43A10A4F9C70071984A /* QRPolynomial.m in Sources */, 279 | EB7DA43B10A4F9C90071984A /* QRRSBlock.m in Sources */, 280 | EB7DA43C10A4F9CC0071984A /* QREncoder.m in Sources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXSourcesBuildPhase section */ 285 | 286 | /* Begin XCBuildConfiguration section */ 287 | 1DEB921F08733DC00010E9CD /* Debug */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ALWAYS_SEARCH_USER_PATHS = NO; 291 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 292 | COPY_PHASE_STRIP = NO; 293 | DSTROOT = /tmp/QREncoder.dst; 294 | GCC_DYNAMIC_NO_PIC = NO; 295 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 296 | GCC_MODEL_TUNING = G5; 297 | GCC_OPTIMIZATION_LEVEL = 0; 298 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 299 | GCC_PREFIX_HEADER = QREncoder_Prefix.pch; 300 | INSTALL_PATH = /usr/local/lib; 301 | PRODUCT_NAME = QREncoder; 302 | }; 303 | name = Debug; 304 | }; 305 | 1DEB922008733DC00010E9CD /* Release */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ALWAYS_SEARCH_USER_PATHS = NO; 309 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 310 | DSTROOT = /tmp/QREncoder.dst; 311 | GCC_MODEL_TUNING = G5; 312 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 313 | GCC_PREFIX_HEADER = QREncoder_Prefix.pch; 314 | INSTALL_PATH = /usr/local/lib; 315 | PRODUCT_NAME = QREncoder; 316 | }; 317 | name = Release; 318 | }; 319 | 1DEB922308733DC00010E9CD /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 323 | GCC_C_LANGUAGE_STANDARD = c99; 324 | GCC_OPTIMIZATION_LEVEL = 0; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 326 | GCC_WARN_UNUSED_VARIABLE = YES; 327 | OTHER_LDFLAGS = "-ObjC"; 328 | PREBINDING = NO; 329 | SDKROOT = iphoneos3.1.2; 330 | }; 331 | name = Debug; 332 | }; 333 | 1DEB922408733DC00010E9CD /* Release */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 337 | GCC_C_LANGUAGE_STANDARD = c99; 338 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 339 | GCC_WARN_UNUSED_VARIABLE = YES; 340 | OTHER_LDFLAGS = "-ObjC"; 341 | PREBINDING = NO; 342 | SDKROOT = iphoneos3.1.2; 343 | }; 344 | name = Release; 345 | }; 346 | EB7DA3B010A4F5DA0071984A /* Debug */ = { 347 | isa = XCBuildConfiguration; 348 | buildSettings = { 349 | ALWAYS_SEARCH_USER_PATHS = NO; 350 | COPY_PHASE_STRIP = NO; 351 | FRAMEWORK_SEARCH_PATHS = ( 352 | "\"$(SDKROOT)/Developer/Library/Frameworks\"", 353 | "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", 354 | ); 355 | GCC_DYNAMIC_NO_PIC = NO; 356 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 357 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 358 | GCC_OPTIMIZATION_LEVEL = 0; 359 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 360 | GCC_PREFIX_HEADER = QREncoder_Prefix.pch; 361 | INFOPLIST_FILE = "QREncoderTest-Info.plist"; 362 | OTHER_LDFLAGS = ( 363 | "-framework", 364 | Foundation, 365 | "-framework", 366 | SenTestingKit, 367 | "-framework", 368 | UIKit, 369 | ); 370 | PREBINDING = NO; 371 | PRODUCT_NAME = QREncoderTest; 372 | WRAPPER_EXTENSION = octest; 373 | }; 374 | name = Debug; 375 | }; 376 | EB7DA3B110A4F5DA0071984A /* Release */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | COPY_PHASE_STRIP = YES; 381 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 382 | FRAMEWORK_SEARCH_PATHS = ( 383 | "\"$(SDKROOT)/Developer/Library/Frameworks\"", 384 | "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", 385 | ); 386 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 387 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 388 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 389 | GCC_PREFIX_HEADER = QREncoder_Prefix.pch; 390 | INFOPLIST_FILE = "QREncoderTest-Info.plist"; 391 | OTHER_LDFLAGS = ( 392 | "-framework", 393 | Foundation, 394 | "-framework", 395 | SenTestingKit, 396 | "-framework", 397 | UIKit, 398 | ); 399 | PREBINDING = NO; 400 | PRODUCT_NAME = QREncoderTest; 401 | WRAPPER_EXTENSION = octest; 402 | ZERO_LINK = NO; 403 | }; 404 | name = Release; 405 | }; 406 | /* End XCBuildConfiguration section */ 407 | 408 | /* Begin XCConfigurationList section */ 409 | 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "QREncoder" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | 1DEB921F08733DC00010E9CD /* Debug */, 413 | 1DEB922008733DC00010E9CD /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "QREncoder" */ = { 419 | isa = XCConfigurationList; 420 | buildConfigurations = ( 421 | 1DEB922308733DC00010E9CD /* Debug */, 422 | 1DEB922408733DC00010E9CD /* Release */, 423 | ); 424 | defaultConfigurationIsVisible = 0; 425 | defaultConfigurationName = Release; 426 | }; 427 | EB7DA3B210A4F5DA0071984A /* Build configuration list for PBXNativeTarget "QREncoderTest" */ = { 428 | isa = XCConfigurationList; 429 | buildConfigurations = ( 430 | EB7DA3B010A4F5DA0071984A /* Debug */, 431 | EB7DA3B110A4F5DA0071984A /* Release */, 432 | ); 433 | defaultConfigurationIsVisible = 0; 434 | defaultConfigurationName = Release; 435 | }; 436 | /* End XCConfigurationList section */ 437 | }; 438 | rootObject = 0867D690FE84028FC02AAC07 /* Project object */; 439 | } 440 | -------------------------------------------------------------------------------- /src/QREncoderTest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/QREncoder_Prefix.pch: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifdef __OBJC__ 18 | #import 19 | #import 20 | #endif 21 | -------------------------------------------------------------------------------- /src/Resources/google.com.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jverkoey/ObjQREncoder/e1841fea7dbd8e0b82a6c7132b17d6d96a3afeac/src/Resources/google.com.png --------------------------------------------------------------------------------