File indexing completed on 2024-05-12 05:46:55
0001 /* 0002 Copyright (c) 2010-2016 Sune Vuorela <sune@vuorela.dk> 0003 0004 Permission is hereby granted, free of charge, to any person 0005 obtaining a copy of this software and associated documentation 0006 files (the "Software"), to deal in the Software without 0007 restriction, including without limitation the rights to use, 0008 copy, modify, merge, publish, distribute, sublicense, and/or sell 0009 copies of the Software, and to permit persons to whom the 0010 Software is furnished to do so, subject to the following 0011 conditions: 0012 0013 The above copyright notice and this permission notice shall be 0014 included in all copies or substantial portions of the Software. 0015 0016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 0017 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 0018 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 0019 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 0020 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 0021 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 0022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 0023 OTHER DEALINGS IN THE SOFTWARE. 0024 0025 */ 0026 0027 #include <config-prison.h> 0028 #include "prison.h" 0029 #include "aztecbarcode.h" 0030 #include "datamatrixbarcode.h" 0031 #include "qrcodebarcode.h" 0032 #include "code39barcode.h" 0033 #include "code93barcode.h" 0034 #include "code128barcode.h" 0035 0036 Prison::AbstractBarcode *Prison::createBarcode(BarcodeType type) 0037 { 0038 switch(type) 0039 { 0040 case Prison::Null: 0041 return nullptr; 0042 case Prison::QRCode: 0043 return new QRCodeBarcode; 0044 case Prison::DataMatrix: 0045 #ifdef HAVE_DMTX 0046 return new DataMatrixBarcode; 0047 #else 0048 return nullptr; 0049 #endif 0050 case Prison::Aztec: 0051 return new AztecBarcode; 0052 case Prison::Code39: 0053 return new Code39Barcode; 0054 case Prison::Code93: 0055 return new Code93Barcode; 0056 case Prison::Code128: 0057 return new Code128Barcode; 0058 } 0059 return nullptr; 0060 0061 }