Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fwl/basewidget/fxmath_barcodeimp.h" | 7 #include "xfa/fwl/basewidget/fxmath_barcodeimp.h" |
| 8 | 8 |
| 9 #include "xfa/fxbarcode/cbc_codabar.h" | |
| 10 #include "xfa/fxbarcode/cbc_code128.h" | |
| 11 #include "xfa/fxbarcode/cbc_code39.h" | |
| 12 #include "xfa/fxbarcode/cbc_codebase.h" | |
| 13 #include "xfa/fxbarcode/cbc_datamatrix.h" | |
| 14 #include "xfa/fxbarcode/cbc_ean13.h" | |
| 15 #include "xfa/fxbarcode/cbc_ean8.h" | |
| 16 #include "xfa/fxbarcode/cbc_pdf417i.h" | |
| 17 #include "xfa/fxbarcode/cbc_qrcode.h" | |
| 18 #include "xfa/fxbarcode/cbc_upca.h" | |
| 19 | |
| 9 static CBC_CodeBase* FX_Barcode_CreateBarCodeEngineObject(BC_TYPE type) { | 20 static CBC_CodeBase* FX_Barcode_CreateBarCodeEngineObject(BC_TYPE type) { |
| 10 switch (type) { | 21 switch (type) { |
| 11 case BC_CODE39: | 22 case BC_CODE39: |
| 12 return new CBC_Code39(); | 23 return new CBC_Code39(); |
| 13 case BC_CODABAR: | 24 case BC_CODABAR: |
| 14 return new CBC_Codabar(); | 25 return new CBC_Codabar(); |
| 15 case BC_CODE128: | 26 case BC_CODE128: |
| 16 return new CBC_Code128(BC_CODE128_B); | 27 return new CBC_Code128(BC_CODE128_B); |
| 17 case BC_CODE128_B: | 28 case BC_CODE128_B: |
| 18 return new CBC_Code128(BC_CODE128_B); | 29 return new CBC_Code128(BC_CODE128_B); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 35 return NULL; | 46 return NULL; |
| 36 } | 47 } |
| 37 } | 48 } |
| 38 CFX_Barcode::CFX_Barcode() {} | 49 CFX_Barcode::CFX_Barcode() {} |
| 39 CFX_Barcode::~CFX_Barcode() { | 50 CFX_Barcode::~CFX_Barcode() { |
| 40 if (m_pBCEngine) { | 51 if (m_pBCEngine) { |
| 41 delete m_pBCEngine; | 52 delete m_pBCEngine; |
| 42 m_pBCEngine = NULL; | 53 m_pBCEngine = NULL; |
| 43 } | 54 } |
| 44 } | 55 } |
| 45 FX_BOOL CFX_Barcode::Crreate(BC_TYPE type) { | 56 FX_BOOL CFX_Barcode::Crreate(BC_TYPE type) { |
|
Tom Sepez
2016/03/21 16:49:29
nit: grrrrreat!
dsinclair
2016/03/21 17:52:39
Done.
| |
| 46 m_pBCEngine = FX_Barcode_CreateBarCodeEngineObject(type); | 57 m_pBCEngine = FX_Barcode_CreateBarCodeEngineObject(type); |
| 47 return m_pBCEngine != NULL; | 58 return m_pBCEngine != NULL; |
| 48 } | 59 } |
| 49 void CFX_Barcode::Release() { | 60 void CFX_Barcode::Release() { |
| 50 delete this; | 61 delete this; |
| 51 } | 62 } |
| 52 BC_TYPE CFX_Barcode::GetType() { | 63 BC_TYPE CFX_Barcode::GetType() { |
| 53 return m_pBCEngine ? m_pBCEngine->GetType() : BC_UNKNOWN; | 64 return m_pBCEngine ? m_pBCEngine->GetType() : BC_UNKNOWN; |
| 54 } | 65 } |
| 55 FX_BOOL CFX_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { | 66 FX_BOOL CFX_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 71 switch (GetType()) { | 82 switch (GetType()) { |
| 72 case BC_CODE39: | 83 case BC_CODE39: |
| 73 case BC_CODABAR: | 84 case BC_CODABAR: |
| 74 case BC_CODE128: | 85 case BC_CODE128: |
| 75 case BC_CODE128_B: | 86 case BC_CODE128_B: |
| 76 case BC_CODE128_C: | 87 case BC_CODE128_C: |
| 77 case BC_EAN8: | 88 case BC_EAN8: |
| 78 case BC_EAN13: | 89 case BC_EAN13: |
| 79 case BC_UPCA: | 90 case BC_UPCA: |
| 80 return m_pBCEngine | 91 return m_pBCEngine |
| 81 ? static_cast<CBC_OneCode*>(m_pBCEngine) | 92 ? static_cast<CBC_OneCode*>(m_pBCEngine) |
|
Tom Sepez
2016/03/21 16:49:29
follow-up: virtualize.
dsinclair
2016/03/21 17:52:39
pdfium:440
| |
| 82 ->CheckContentValidity(contents) | 93 ->CheckContentValidity(contents) |
| 83 : TRUE; | 94 : TRUE; |
| 84 default: | 95 default: |
| 85 return TRUE; | 96 return TRUE; |
| 86 } | 97 } |
| 87 } | 98 } |
| 88 FX_BOOL CFX_Barcode::SetPrintChecksum(FX_BOOL checksum) { | 99 FX_BOOL CFX_Barcode::SetPrintChecksum(FX_BOOL checksum) { |
| 89 switch (GetType()) { | 100 switch (GetType()) { |
| 90 case BC_CODE39: | 101 case BC_CODE39: |
| 91 case BC_CODABAR: | 102 case BC_CODABAR: |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 return CFX_WideString(); | 387 return CFX_WideString(); |
| 377 } | 388 } |
| 378 IFX_Barcode* FX_Barcode_Create(BC_TYPE type) { | 389 IFX_Barcode* FX_Barcode_Create(BC_TYPE type) { |
| 379 CFX_Barcode* pBarcode = new CFX_Barcode; | 390 CFX_Barcode* pBarcode = new CFX_Barcode; |
| 380 if (pBarcode->Crreate(type)) { | 391 if (pBarcode->Crreate(type)) { |
| 381 return pBarcode; | 392 return pBarcode; |
| 382 } | 393 } |
| 383 pBarcode->Release(); | 394 pBarcode->Release(); |
| 384 return NULL; | 395 return NULL; |
| 385 } | 396 } |
| OLD | NEW |